Computing and Information Technology

Programming with Python Practice Exam, Flashcards & Questions

Master foundational to advanced Programming with Python with 726 verified curriculum items, worked engineering solutions, and spaced-repetition cards.

570 Total Questions 232 MCQs 222 Calculations 116 Flashcards
Free Interactive Preview

Programming with Python Sample Exam Questions & Rationale

Preview official questions below. The complete pool of 570 items is available in the offline app.

Question 1 of 4 Boolean logic

What property characterizes the evaluation of `and` and `or` logical operators in Python?

A Eager parallel evaluation
B Short-circuit evaluation
C Bitwise evaluation
D Lazy thread spawning
Accepted Answer: Option B (Short-circuit evaluation)

Rationale: Python's logical operators use short-circuiting: in 'A and B', B is not evaluated if A is false; in 'A or B', B is not evaluated if A is true.

Question 2 of 4 Comments and PEP 8 style

According to PEP 8, what naming convention should be used for functions and variable names?

A camelCase (lowercase first letter with capitalized next words)
B snake_case (lowercase with words separated by underscores)
C kebab-case (lowercase words separated by hyphens)
D PascalCase (capitalized words without underscores)
Accepted Answer: Option B (snake_case (lowercase with words separated by underscores))

Rationale: PEP 8 specifies snake_case for functions and variables, CapWords (PascalCase) for classes, and ALL_CAPS for constants.

Question 3 of 4 Conditionals

In Python, what syntax defines code blocks within conditional statements rather than curly braces or keywords like `end`?

A Curly braces { }
B Consistent indentation level
C Semicolons at statement ends
D begin ... end delimiters
Accepted Answer: Option B (Consistent indentation level)

Rationale: Python uses whitespace indentation (typically 4 spaces per level) to delimit code blocks within if, elif, and else statements.

Question 4 of 4 Input and output

What data type is always returned by Python's built-in `input()` function?

A int
B auto-inferred type based on text
C NoneType
D str
Accepted Answer: Option D (str)

Rationale: In Python 3, input() reads a line from standard input and always returns it as a string (str), stripping the trailing newline.

Active Recall Spaced Repetition Cards (Preview)

Card 1 • Boolean logic
The logical expression x and y returns x immediately if x evaluates as {{c1::falsy}}.
Because false AND anything is false, short-circuit evaluation returns the first falsy operand.
Card 2 • Comments and PEP 8 style
Code indentation should strictly use {{c1::4 spaces}} per indentation level.
PEP 8 strongly discourages mixing tabs and spaces, standardizing on exactly 4 spaces per level.

Programming with Python Curriculum Modules & Topics Covered

Modules
BasicsData StructuresFunctions and ModulesObject-Oriented ProgrammingFiles and ErrorsScientific Computing with Python
Core Exam Topics
  • Variables and data types
  • Operators
  • Input and output
  • Conditionals
  • Loops
  • Type conversion
  • String formatting
  • Comments and PEP 8 style
  • Boolean logic
  • Range and enumerate
Learning Objectives
  • Develop core conceptual recall and analytical problem-solving in Basics.
  • Develop core conceptual recall and analytical problem-solving in Data Structures.
  • Develop core conceptual recall and analytical problem-solving in Functions and Modules.
  • Develop core conceptual recall and analytical problem-solving in Object-Oriented Programming.
  • Develop core conceptual recall and analytical problem-solving in Files and Errors.

Free Downloadable Programming with Python Study Packs (.ZIP / .TSV)

Full Spreadsheet Data (TSV)
TSV • 570 items
Complete Course Pack
ZIP • 570 items
Elements (Complete)
ZIP • 570 items
Elements (Mastery)
ZIP • 570 items
Elements (Standard)
ZIP • 570 items
Active Recall Flashcards
ZIP • 570 items
Formula Codex
ZIP • 570 items
Problem Solving (Mastery)
ZIP • 570 items
Artificial Intelligence (1,579) Artificial Intelligence and Machine Learning (507) Cloud Computing and DevOps (144) Compiler Design & Formal Languages (1,579) Computational Contact Mechanics: Penalty Function Method, Lagrange Multipliers & Mortar Contact Formulations (128) Computer Engineering & Algorithms (1,365)
Full Question Pool: 570 Verified Items

Unlock All 570 Programming with Python Practice Questions

Study the full question pool with 13 active recall battle modes, FSRS v5 spaced repetition, and 1-click printable PDF mock exams with full answer keys on Android and Windows PC.

Get on Google Play (Android) Get on Microsoft Store (Windows PC)