101. A file containing reusable Python code that can be imported is a:
- loop
- comment
- variable
- module
Answer: D) module
Explanation: A module is a .py file of reusable code. SLO CS-11-C-04
MCQs / Computer Science / Unit 3: Programming Fundamentals
116 multiple-choice questions on Unit 3: Programming Fundamentals from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
Answer: D) module
Explanation: A module is a .py file of reusable code. SLO CS-11-C-04
Answer: A) [20, 30]
Explanation: Slicing includes the start index and excludes the stop index. SLO CS-11-C-05
Answer: B) TypeError
Explanation: An int and a str cannot be added; convert with int(num2). SLO CS-11-C-02
Answer: D) totalmarks
Explanation: Names cannot start with a digit, contain spaces or be keywords. SLO CS-11-C-02
Answer: D) breakpoint
Explanation: Breakpoints stop execution so you can inspect variables. SLO CS-11-C-07
Answer: C) A function can be called with test inputs and its return value checked
Explanation: Functions isolate a task so it can be tested separately. SLO CS-11-C-07
Answer: D) append()
Explanation: append(x) adds x to the end. SLO CS-11-C-05
Answer: B) 6
Explanation: There are six items. SLO CS-11-C-05
Answer: A) 10
Explanation: range(1, 5) gives 1, 2, 3, 4 → 10. SLO CS-11-C-02
Answer: D) 60°
Explanation: Exterior angle = 360°/n = 360°/6 = 60°. SLO CS-11-C-03
Answer: C) [1, 4, 9, 16]
Explanation: Each square is appended in order. SLO CS-11-C-05
Answer: B) True
Explanation: in checks whether a value is in the list. SLO CS-11-C-05
Answer: D) translates the whole program before it runs
Explanation: Compilers translate the complete program into machine code first. SLO CS-11-C-01
Answer: B) from random import randint
Explanation: from module import name brings the name into the program. SLO CS-11-C-04
Answer: C) False
Explanation: and is True only if both sides are True; 2 4 is False. SLO CS-11-C-02
Answer: D) IndexError
Explanation: Valid indexes are 0, 1, 2. SLO CS-11-C-05
Previous Page 5 of 5
Practise Unit 3: Programming Fundamentals MCQs