Week 1 Quiz
Predict, then check: what does this one-line program print?
print(2 + 3 * 4)Select one.
- 20
- 14
- 24
- 9
What does this one-line program print?
print((2 + 3) * 4)Select one.
- 20
- 14
- 23
- 9
What does this one-line program print?
print("2" + "3")Select one.
- 5
- 2 3
- 23
- "2" + "3"
A classmate predicts that this line prints 5. What does Python actually print when the line runs?
print(10 / 2)Select one.
- 5
- 5.0
- 2
- 0.5
The reading log's goal line has three arguments separated by commas. What does it print?
print("Goal:", 300, "pages")Select one.
- Goal:300pages
- Goal:, 300, pages
- "Goal:" 300 "pages"
- Goal: 300 pages
This two-line program has a capital P on line 2. When it runs, what appears, and which error type does the last line of the error message name?
print("Reading log: day 1") Print("Goal: 300 pages")Select one.
- Nothing appears, and the last line names SyntaxError
- Nothing appears, and the last line names NameError
- Reading log: day 1 appears, and then the last line names NameError
- Both lines appear, because Python ignores capital letters
Line 2 of this program is missing its closing parenthesis. When you press Run, what appears, and which error type does the last line name?
print("Reading log: day 1") print("Goal: 300 pages"Select one.
- Nothing appears, and the last line names SyntaxError
- Reading log: day 1 appears, and then the last line names SyntaxError
- Reading log: day 1 appears, and then the last line names NameError
- Both lines appear, and Python adds the missing parenthesis
Which statements about reading a Python error message are true? Select every true statement.
Select every option that applies.
- Start with the last line, because it names the error type
- A SyntaxError means the parser refused the text, so no line ran
- If a line printed before the error, the program was running when it stopped
- Python treats print and Print as the same name
- A red error message means the program cannot be fixed
Python runs the lines of a script in order, from the top line to the bottom line, unless the program tells it to do otherwise.
True or false.
- True
- False
A chatbot tells you that
print(2 + 3 * 4)displays 20, because Python works from left to right. What is the best next step?Select one.
- Accept the claim, since the chatbot explained its reasoning
- Ask the chatbot the same question again until it agrees with itself
- Look for a different chatbot that gives a more confident reply
- Run the line in a Python runner and compare its output with the claim
Built with The Course Maker · samples.thecoursemaker.com