Programming Foundations Final Exam
Prep (Latest Update )
Questions and Verified Answers | 100%
Correct | Grade A.
1. Which statement best describes a computer program?
A. A physical device used to store information
B. A sequence of instructions that tells a computer how to perform
tasks
C. A collection of hardware components
D. A type of operating system
Rationale: A computer program is a structured set of instructions
written in a programming language that directs a computer to perform
specific operations. Programs can range from simple calculators to
complex operating systems and applications.
2. What is the primary purpose of an algorithm?
A. To compile source code
B. To increase processor speed
,C. To provide a step-by-step solution to a problem
D. To store information permanently
Rationale: An algorithm is a logical sequence of steps designed to solve
a problem efficiently. Algorithms are independent of programming
languages and serve as the blueprint for writing code.
3. Which of the following is considered a high-level programming
language?
A. Binary
B. Machine code
C. Python
D. Assembly language
Rationale: Python is a high-level programming language because it uses
syntax that is easier for humans to read and write. Machine code and
assembly language are low-level languages that interact more directly
with computer hardware.
4. Which programming construct allows a program to make
decisions?
A. Sequence
B. Variable
C. Selection
D. Compilation
,Rationale: Selection structures, such as if and if-else statements,
evaluate conditions and determine which block of code should execute
based on the result.
5. Which programming construct repeats a block of code multiple
times?
A. Selection
B. Iteration
C. Compilation
D. Assignment
Rationale: Iteration, commonly implemented with loops, allows
repetitive execution of statements until a specified condition is met or
for a predetermined number of repetitions.
6. What is a variable?
A. A permanent hardware component
B. A programming language
C. A named storage location for data
D. A compiler error
Rationale: Variables temporarily store data that can change during
program execution. Each variable has a name, a data type, and a value
that may be updated.
7. Which data type is most appropriate for storing a person's age?
, A. String
B. Integer
C. Boolean
D. Character
Rationale: Age is typically represented as a whole number without
decimal places, making the integer data type the most appropriate
choice.
8. Which data type stores only two possible values?
A. Integer
B. Float
C. String
D. Boolean
Rationale: Boolean variables represent logical values of either true or
false and are commonly used in conditional statements.
9. What is the output of the following expression?
5+3*2
A. 16
B. 11
C. 13
D. 10
Rationale: Multiplication has higher precedence than addition, so 3 × 2
is evaluated first, producing 6. Then 5 + 6 equals 11.