Skip to content

Module 3 Chapter 1 Quiz Answers

Question 1

When Python is running in interactive mode and displaying the chevron prompt (>>>), what question is Python asking you?

A. What would you like to do?
B. What is the next machine language instruction to run?
C. What Python script would you like me to run?
D. What is your favorite color?

โœ… Correct Answer: A. What would you like to do?

๐Ÿ”น Explanation:
When Python shows >>>, it is asking for user inputโ€”expecting you to type a command or execute a statement. It is not running a script but waiting for instructions interactively.


Question 2

What will the following program print out?

>>> x = 15
>>> x = x + 5
>>> print(x)

A. 20
B. 5
C. 15
D. “print x”
E. x + 5

โœ… Correct Answer: A. 20

๐Ÿ”น Explanation:

  • x = 15 assigns the value 15 to x.
  • x = x + 5 increases x by 5, so now x = 20.
  • print(x) displays 20.

Question 3

Python scripts (files) have names that end with:

A. .doc
B. .py
C. .png
D. .exe

โœ… Correct Answer: B. .py

๐Ÿ”น Explanation:
Python scripts use the .py extension (e.g., script.py). Other file extensions like .doc are for Word documents, .png is for images, and .exe is for executable programs.


Question 4

Which of these words are reserved words in Python?

A. make
B. break
C. concat
D. if
E. todo

โœ… Correct Answers: B. break, D. if

๐Ÿ”น Explanation:
Reserved words (keywords) are predefined in Python and cannot be used as variable names.

  • break is used to exit loops.
  • if is used for conditional statements.
  • make, concat, and todo are not Python keywords.

Question 5

What is the proper way to say โ€œgoodbyeโ€ to Python?

A. while
B. #EXIT
C. // stop
D. quit()

โœ… Correct Answer: D. quit()

๐Ÿ”น Explanation:

  • quit() is a built-in function to exit the Python interpreter.
  • while is a loop keyword.
  • #EXIT is a comment, and // stop is not valid syntax in Python.

Question 6

Which part of a computer actually executes the program instructions?

A. Central Processing Unit
B. Secondary Memory
C. Main Memory
D. Input/Output Devices

โœ… Correct Answer: A. Central Processing Unit (CPU)

๐Ÿ”น Explanation:
The CPU (Central Processing Unit) executes program instructions.

  • Main Memory (RAM) temporarily holds data for quick access.
  • Secondary Memory (like hard drives) stores data permanently.
  • Input/Output Devices (like keyboards and monitors) allow user interaction.

Question 7

What is “code” in the context of this course?

A. A set of rules that govern the style of programs
B. A sequence of instructions in a programming language
C. A way to encrypt data during World War II
D. A password we use to unlock Python features

โœ… Correct Answer: B. A sequence of instructions in a programming language

๐Ÿ”น Explanation:
“Code” refers to written instructions in a programming language (e.g., Python). These instructions tell the computer what to do.


Question 8

A USB memory stick is an example of which component of computer architecture?

A. Secondary Memory
B. Central Processing Unit
C. Output Device
D. Main Memory

โœ… Correct Answer: A. Secondary Memory

๐Ÿ”น Explanation:
A USB memory stick stores data permanently, making it secondary memory.

  • Main Memory (RAM) is temporary storage.
  • CPU executes instructions.
  • Output Devices (like monitors) display information.

Question 9

What is the best way to think about a “Syntax Error” while programming?

A. The computer did not understand the statement that you entered
B. The computer needs to have its software upgraded
C. The computer has used GPS to find your location and hates everyone from your town
D. The computer is overheating and just wants you to stop to let it cool down

โœ… Correct Answer: A. The computer did not understand the statement that you entered

๐Ÿ”น Explanation:
A syntax error happens when Python does not understand your code due to incorrect grammar (e.g., missing a colon in a function definition).


Question 10

Which of the following is NOT one of the programming patterns covered in Chapter 1?

A. Random steps
B. Repeated Steps
C. Sequential Steps
D. Conditional Steps

โœ… Correct Answer: A. Random steps

๐Ÿ”น Explanation:
Programming patterns include:

  • Sequential Steps: Executing instructions in order.
  • Repeated Steps: Using loops to repeat tasks.
  • Conditional Steps: Making decisions using if statements.
  • Random Steps are not a structured programming pattern.