Multiple choice › Algorithms (validation)
Algorithms (validation)
1. Algorithms (validation)
A program requires the user to enter the number of tickets to be purchased. This must be an integer from 1 to 10 inclusive. Which algorithm should be used to validate the entered data?
- Get NumTick WHILE NumTick <1 AND NumTick >10 Display “Please enter a valid number of tickets” Get NumTick ENDWHILE ProcessPurchase
- Get NumTick REPEAT Display “Please enter a valid number of tickets” UNTIL NumTick > 0 AND NumTick < 10 ProcessPurchase
- Get NumTick IF NumTick <1 OR NumTick > 10 Display “Please enter a valid number of tickets” ENDIF ProcessPurchase
- Get NumTick WHILE NumTick <1 OR NumTick >10 Display “Please enter a valid number of tickets” Get NumTick ENDWHILE ProcessPurchase
Answer
D
NESA answer key: D. Old syllabus (SDD): useful as overlap practice only.