LearnFrenzy
Sign in Take a free test

Python Basics and Syntax · Exercise 1 of 4

Python Basics and Syntax Python Basics MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on Python basics: how CPython runs code, indentation, comments, docstrings, identifiers and keywords, print() and input(), and the main guard. Pick an option to check your answer instantly.

Question 11 Medium

Which way of splitting a long statement over several lines does PEP 8 prefer?

A Implicit continuation inside parentheses, brackets or braces
B Ending each line with a semicolon
C Starting the next line with a plus sign
D Writing the statement in a triple-quoted string
Question page & discussion
Question 12 Easy

What does the pass statement do?

A Skips the rest of the loop
B Exits the function
C Nothing: it is a placeholder where a statement is required
D Passes a value to the caller
Question page & discussion
Question 13 Medium

Which statement about Python is false?

A Every variable must be declared with its type before use
B A variable is created the first time a value is assigned to it
C The same name can refer to an int and later to a str
D Every object has a type that type() reports
Question page & discussion
Question 14 Easy

Which character lets you write several simple statements on one line, as in a = 1 ? b = 2?

A a semicolon
B a comma
C a colon
D a period
Question page & discussion
Question 15 Hard

Line 1 of a script prints "Start" and line 50 has a missing closing bracket. What happens when you run it?

A Nothing is printed: the SyntaxError is reported before any line runs
B "Start" is printed, then a SyntaxError is reported at line 50
C Lines 1–49 run and line 50 is skipped
D Python fixes the bracket automatically
Question page & discussion
Up next · Exercise 2Predict the Output15 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links