SCRIPTING AND PROGRAMMING
FOUNDATIONS 2026 TEST PAPER SOLVED
QUESTIONS AND SOLUTIONS
◉ function P(integer x) returns integer y
y=2*x
What does P(5) evaluate to?
A2
B5
C 10
D 25. Answer: 10
◉ Function F()
Put "Hey" to output
What entire output appears after three successive calls to F()?
A Hey
B HHHey
C HeyHeyHey
D Hey Hey Hey. Answer: HeyHeyHey
,◉ What is a valid user-defined function name?
A A reserved word
B Any valid identifier
C Any variable name
D A floating-point number. Answer: Any valid identifier
◉ A function MyFct has an input x and an output z.
What does MyFct return?
A Nothing
B x only
C z only
D x and z. Answer: Z only
◉ What is the return value of a function?
A Output of a function
B Call to run the function
C Data passed to the function
D Variable in the declaration of the function. Answer: Output of a
function
, ◉ A program should continue accepting input numbers, adding each
to a sum, until a 0 is input.
Which control structure should be used?
A If statement
B For loop
C Multiple if statements
D While loop. Answer: While loop
◉ Joe is building an online game. He wants to provide a riddle and
have the player guess the answer. The game needs to prompt the
user to enter the answer, check to see if it the input provided does
not match the correct answer, and continue prompting the user until
the answer entered matches the correct answer.
Which control structure supports Joe's needs?
A For loop
B While loop
C Do-while loop
D If-else branch. Answer: Do-while loop
◉ What is put to output by the following pseudocode?
FOUNDATIONS 2026 TEST PAPER SOLVED
QUESTIONS AND SOLUTIONS
◉ function P(integer x) returns integer y
y=2*x
What does P(5) evaluate to?
A2
B5
C 10
D 25. Answer: 10
◉ Function F()
Put "Hey" to output
What entire output appears after three successive calls to F()?
A Hey
B HHHey
C HeyHeyHey
D Hey Hey Hey. Answer: HeyHeyHey
,◉ What is a valid user-defined function name?
A A reserved word
B Any valid identifier
C Any variable name
D A floating-point number. Answer: Any valid identifier
◉ A function MyFct has an input x and an output z.
What does MyFct return?
A Nothing
B x only
C z only
D x and z. Answer: Z only
◉ What is the return value of a function?
A Output of a function
B Call to run the function
C Data passed to the function
D Variable in the declaration of the function. Answer: Output of a
function
, ◉ A program should continue accepting input numbers, adding each
to a sum, until a 0 is input.
Which control structure should be used?
A If statement
B For loop
C Multiple if statements
D While loop. Answer: While loop
◉ Joe is building an online game. He wants to provide a riddle and
have the player guess the answer. The game needs to prompt the
user to enter the answer, check to see if it the input provided does
not match the correct answer, and continue prompting the user until
the answer entered matches the correct answer.
Which control structure supports Joe's needs?
A For loop
B While loop
C Do-while loop
D If-else branch. Answer: Do-while loop
◉ What is put to output by the following pseudocode?