Programming Fundamentals Practice
Exam Questions And Correct Answers
(Verified Answers) Plus Rationales
2026 Q&A | Instant Download Pdf
1.
Which of the following best describes an algorithm?
A. A programming language
B. A hardware component
C. A step-by-step procedure for solving a problem
D. A type of computer memory
Answer: A step-by-step procedure for solving a problem
Rationale: An algorithm is a finite, ordered sequence of instructions
designed to accomplish a specific task or solve a problem. Algorithms
can be expressed using natural language, pseudocode, flowcharts, or
programming code.
2.
What is a variable in programming?
A. A permanent hardware device
B. A named storage location whose value can change
C. A program error
D. A programming language
Answer: A named storage location whose value can change
,Rationale: A variable provides a named location for storing data
during program execution. Its stored value may change as the
program runs, depending on the programming language and how the
variable is used.
3.
Which data type is normally used to represent whole numbers?
A. Boolean
B. String
C. Character
D. Integer
Answer: Integer
Rationale: An integer data type represents whole numbers such as -10,
0, and 25. Integers generally do not contain a fractional or decimal
component.
4.
Which data type is most appropriate for storing true or false values?
A. Integer
B. String
C. Boolean
D. Floating-point
Answer: Boolean
Rationale: Boolean values represent logical states and normally have
two possible values: true and false. They are commonly used in
conditions, comparisons, and decision-making statements.
5.
What does a compiler generally do?
,A. Physically repairs computer hardware
B. Translates source code into a form that can be executed
C. Deletes unused files
D. Connects a computer to the Internet
Answer: Translates source code into a form that can be executed
Rationale: A compiler translates source code written in a programming
language into another representation, commonly machine code or an
intermediate form. Compilation may also identify syntax and semantic
errors.
6.
What is the primary purpose of an interpreter?
A. To manufacture processors
B. To store files permanently
C. To execute program instructions through interpretation
D. To increase monitor resolution
Answer: To execute program instructions through interpretation
Rationale: An interpreter processes program instructions during
execution, often translating or evaluating them as the program runs.
This differs from traditional compilation, where source code is
translated before execution.
7.
Which symbol commonly represents assignment in many programming
languages?
A. ==
B. !=
, C. >=
D. =
Answer: =
Rationale: In many languages, the single equals sign assigns a value to
a variable. The double equals sign is commonly used for equality
comparison, although exact syntax varies between languages.
8.
What is the purpose of an if statement?
A. To repeat code indefinitely
B. To define a variable
C. To execute code conditionally
D. To terminate the operating system
Answer: To execute code conditionally
Rationale: An if statement evaluates a condition and executes a
particular block of code when that condition is satisfied. It is one of
the fundamental mechanisms for controlling program flow.
9.
Which control structure is primarily used to repeat instructions?
A. Selection
B. Declaration
C. Iteration
D. Compilation
Answer: Iteration
Rationale: Iteration means repeatedly executing a block of
instructions. Loops such as for, while, and do-while are common
examples of iterative control structures.
Exam Questions And Correct Answers
(Verified Answers) Plus Rationales
2026 Q&A | Instant Download Pdf
1.
Which of the following best describes an algorithm?
A. A programming language
B. A hardware component
C. A step-by-step procedure for solving a problem
D. A type of computer memory
Answer: A step-by-step procedure for solving a problem
Rationale: An algorithm is a finite, ordered sequence of instructions
designed to accomplish a specific task or solve a problem. Algorithms
can be expressed using natural language, pseudocode, flowcharts, or
programming code.
2.
What is a variable in programming?
A. A permanent hardware device
B. A named storage location whose value can change
C. A program error
D. A programming language
Answer: A named storage location whose value can change
,Rationale: A variable provides a named location for storing data
during program execution. Its stored value may change as the
program runs, depending on the programming language and how the
variable is used.
3.
Which data type is normally used to represent whole numbers?
A. Boolean
B. String
C. Character
D. Integer
Answer: Integer
Rationale: An integer data type represents whole numbers such as -10,
0, and 25. Integers generally do not contain a fractional or decimal
component.
4.
Which data type is most appropriate for storing true or false values?
A. Integer
B. String
C. Boolean
D. Floating-point
Answer: Boolean
Rationale: Boolean values represent logical states and normally have
two possible values: true and false. They are commonly used in
conditions, comparisons, and decision-making statements.
5.
What does a compiler generally do?
,A. Physically repairs computer hardware
B. Translates source code into a form that can be executed
C. Deletes unused files
D. Connects a computer to the Internet
Answer: Translates source code into a form that can be executed
Rationale: A compiler translates source code written in a programming
language into another representation, commonly machine code or an
intermediate form. Compilation may also identify syntax and semantic
errors.
6.
What is the primary purpose of an interpreter?
A. To manufacture processors
B. To store files permanently
C. To execute program instructions through interpretation
D. To increase monitor resolution
Answer: To execute program instructions through interpretation
Rationale: An interpreter processes program instructions during
execution, often translating or evaluating them as the program runs.
This differs from traditional compilation, where source code is
translated before execution.
7.
Which symbol commonly represents assignment in many programming
languages?
A. ==
B. !=
, C. >=
D. =
Answer: =
Rationale: In many languages, the single equals sign assigns a value to
a variable. The double equals sign is commonly used for equality
comparison, although exact syntax varies between languages.
8.
What is the purpose of an if statement?
A. To repeat code indefinitely
B. To define a variable
C. To execute code conditionally
D. To terminate the operating system
Answer: To execute code conditionally
Rationale: An if statement evaluates a condition and executes a
particular block of code when that condition is satisfied. It is one of
the fundamental mechanisms for controlling program flow.
9.
Which control structure is primarily used to repeat instructions?
A. Selection
B. Declaration
C. Iteration
D. Compilation
Answer: Iteration
Rationale: Iteration means repeatedly executing a block of
instructions. Loops such as for, while, and do-while are common
examples of iterative control structures.