(Answers NOT Included) Principles of Programming
Languages Concordia University
COMP 348 - PYTHON 50 Midterm
Practice MCQs
1. Which of the following is NOT one of the first 10 principles in the Zen of Python?
A. Complex is better than complicated
B. Errors should never pass silently
C. Flat is better than nested
D. Sparse is better than dense
E. Now is better than never
2. Which Zen principle directly enforces that code layout must be consistent?
A. Beautiful is better than ugly
B. Flat is better than nested
C. Readability counts
D. Special cases aren’t special enough to break the rules
E. Namespaces are one honking great idea
3. In Python, code blocks are delimited by:
A. { }
, B. Semicolons ;
C. Whitespace indentation
D. BEGIN/END keywords
E. Parentheses ()
4. Mixing tabs and spaces in the same file in Python raises:
A. SyntaxError
B. TabError
C. IndentationError
D. TypeError
E. No error—Python auto-converts them
5. Forgetting the colon after an if header causes:
A. SyntaxError