Our site uses cookies. Some of the cookies we use are essential for parts of the site to operate and have already been set. You may delete and block all cookies from this site, but parts of the site will not work. To find out more about cookies on this website, see our Cookie Policy
Accept
© eRevision.uk and ZigZag Education 2025
This test is run by .
Note that your final mark will not be saved in the system.

Robust and Secure Programming Typeit

Target Level
4-5
Running Total
0
0%
Attempt
1 of 3

Type the correct answers into the spaces. Fill all the spaces before clicking ‘Check Answers!’

The code snippet below shows a type of validation. Complete the missing code.

valid ← 
PRINT('Please enter your age: ') 
REPEAT
	age ← USERINPUT
	TRY	
		age_Num ← STRING_TO_INT() # the type check
		valid ← 
		IF  < 16 THEN
			PRINT('You cannot drive anything yet')
		 age_Num >= 16  age_Num < 21 THEN
			PRINT('You can drive a moped at 16 and a car at 17')
		ELSE
			PRINT('You can now drive any vehicle') 
		
	CATCH
		PRINT('Please enter age as a number in years')
 valid

This is your 1st attempt! You get 3 marks for each one you get right. Good luck!

Pass Mark
69%