Foundations Final Exam Actual Exam
2026/2027 | Questions with Verified Answers
100% Correct | Pass Guaranteed | Grade A
Q01 Which of the following is the correct definition of an algorithm?
Answer: A finite set of well-defined instructions for solving a problem or performing a task
Rationale: An algorithm must be precise, finite, and effective — producing the correct result in
a finite number of steps.
Q02 What is the primary purpose of pseudocode?
Answer: To plan and document the logic of a program before writing actual code
Rationale: Pseudocode uses plain language and simple programming-like structures to outline
the steps without worrying about syntax.
Q03 Which data type is best suited to store a person's age (whole number)?
Answer: Integer
Rationale: Age is typically a whole number without decimal places, making integer the most
appropriate and memory-efficient choice.
Q04 What is the result of the expression 17 % 5 in most programming languages?
Answer: 2
Rationale: The modulus operator (%) returns the remainder of division: 17 ÷ 5 = 3 remainder 2.
, Q05 Which operator has the highest precedence in most programming languages?
Answer: Parentheses ( )
Rationale: Parentheses are evaluated first, overriding normal operator precedence rules.
Q06 What is the purpose of a relational operator?
Answer: To compare two values and return a Boolean (true/false) result
Rationale: Relational operators (==, !=, >, <, >=, <=) are used in conditions and loops.
Q07 In a Boolean expression, what is the result of true AND false?
Answer: false
Rationale: Logical AND returns true only when both operands are true.
Q08 Which control structure is used when a block of code must execute at least once, regardless
of the condition?
Answer: Do-while loop
Rationale: The condition is checked after the first execution in a do-while loop.
Q09 What is the primary difference between a while loop and a for loop?
Answer: A for loop is typically used when the number of iterations is known; a while loop is
used when it is unknown
Rationale: For loops have built-in initialization, condition, and increment; while loops only have
a condition.
Q10 Which keyword is used in most languages to exit a loop prematurely?
Answer: break