Procedural Programming Certificate Practice
Exam
**Question 1.** Which of the following best describes the role of abstraction in computer
science?
A) Storing data efficiently in memory
B) Hiding implementation details to focus on higher‑level concepts
C) Executing machine code directly on the CPU
D) Converting high‑level code to binary executables
Answer: B
Explanation: Abstraction allows programmers to work with simplified models, hiding lower‑level
details so they can concentrate on solving problems at a higher level.
**Question 2.** In the basic computer model, which component is primarily responsible for
performing arithmetic and logical operations?
A) Memory (RAM)
B) Input device
C) Central Processing Unit (CPU)
D) Hard disk drive
Answer: C
Explanation: The CPU contains the arithmetic‑logic unit (ALU) that carries out calculations and
logical decisions.
**Question 3.** Which statement correctly differentiates a compiled language from an
interpreted language?
A) Compiled languages execute line‑by‑line, while interpreted languages translate the whole
program before execution.
B) Compiled languages are converted to machine code before running; interpreted languages
are executed directly by an interpreter at runtime.
, Computing in Python I Fundamentals and
Procedural Programming Certificate Practice
Exam
C) Interpreted languages require a separate linking step; compiled languages do not.
D) Compiled languages cannot be used on multiple platforms, whereas interpreted languages
can.
Answer: B
Explanation: Compilation produces a standalone executable (machine code). Interpretation runs
source code via an interpreter each time.
**Question 4.** Which of the following file extensions indicates a Python script that can be
executed directly by the Python interpreter?
A) .txt
B) .pyc
C) .py
D) .exe
Answer: C
Explanation: The .py extension denotes a plain‑text Python source file.
**Question 5.** What is the purpose of the `#` character in a Python source file?
A) It indicates the start of a function definition.
B) It begins a multi‑line comment.
C) It marks the end of a statement.
D) It starts a single‑line comment.
Answer: D
Explanation: In Python, `#` begins a comment that extends to the end of the line.
**Question 6.** Which syntax correctly creates a multi‑line comment (docstring) in Python?
, Computing in Python I Fundamentals and
Procedural Programming Certificate Practice
Exam
A) `/* comment */`
B) `''' This is a comment '''`
C) `# This is a comment`
D) `-- comment --`
Answer: B
Explanation: Triple single quotes (or triple double quotes) create a string literal that can serve as
a multi‑line comment or docstring.
**Question 7.** What will be printed by the following code?
```python
print("Result:", 5 + 3 * 2)
```
A) Result: 16
B) Result: 11
C) Result: 13
D) Result: 10
Answer: B
Explanation: Multiplication has higher precedence than addition, so 3*2 = 6; then 5+6 = 11.
**Question 8.** Which function is used to receive input from the user in a Python console
program?
A) `read()`
B) `input()`
C) `scan()`
, Computing in Python I Fundamentals and
Procedural Programming Certificate Practice
Exam
D) `gets()`
Answer: B
Explanation: `input()` prompts the user and returns the entered text as a string.
**Question 9.** If a user enters the number `42` at an `input()` prompt, which of the following
statements correctly converts the value to an integer?
A) `num = int(input)`
B) `num = int(input())`
C) `num = input(int)`
D) `num = int(str)`
Answer: B
Explanation: `input()` returns a string; wrapping it with `int()` converts the string `"42"` to the
integer 42.
**Question 10.** Which of the following is a consequence of Python’s reliance on indentation?
A) Curly braces are required to define code blocks.
B) Whitespace is ignored by the interpreter.
C) Misaligned indentation causes a `IndentationError`.
D) Indentation determines variable scope only for global variables.
Answer: C
Explanation: Python uses indentation to delimit blocks; inconsistent indentation raises an
`IndentationError`.
**Question 11.** What is the type of the value returned by the expression `type(3.14)`?
A) `<class 'float'>`