Which statement correctly distinguishes syntax from semantics in a programming language?
3 Programming Fundamentals Online Quiz Questions
Use this free practice quiz with 20 questions to review 3 Programming Fundamentals, test your knowledge, and prepare for your next test or exam.
True or false: In Python, the single equals sign (=) assigns a value, while the double equals sign (==) tests equality.
- A
True
- B
False
What Python data type does input() return for the user's response before any explicit conversion?
Python uses uppercase names as a for values intended not to change during program execution.
What value does the Python expression 17 // 5 produce?
- A
2
- B
3
- C
4
- D
3.4
Which statements correctly describe variables and names in Python? Select all that apply.
- A
A name is bound to a value or object.
- B
A name can later be bound to a value of another type.
- C
total,Total, andTOTALare different identifiers. - D
A variable receives a permanent type declaration when it is first assigned.
True or false: In Python, a comment beginning with # continues to the end of the physical line and is normally ignored during execution.
- A
True
- B
False
What category of error occurs when a program runs successfully but produces an incorrect result because its algorithm or expression is wrong?
Before executing valid code blocks, the interpreter the source code.
Which statements correctly describe expressions and statements in Python? Select all that apply.
- A
An expression can compute or produce a value.
- B
A statement can perform an action or control which code runs.
- C
A comparison expression produces a Boolean value.
- D
An
if,for, orwhilecompound statement introduces a block of indented statements.
A syntactically valid Python program attempts to divide a number by zero while it is running. What kind of error is this?
- A
Syntax error
- B
Logic error
- C
Runtime error
- D
Name error caused by comments
Consider the notebook-cost program from the material. Explain how it follows an input–processing–output pattern, including why numeric conversion is needed and how the intermediate values are used. Then calculate the subtotal, tax, and total when the quantity is 3, the price of one notebook is 4.00, and the tax rate is 0.07.
A Python program contains the statement print("Hello" with no closing parenthesis. What kind of error occurs first?
- A
A runtime error caused while the statement runs
- B
A syntax error detected before execution
- C
A logic error that produces an incorrect value
- D
No error because Python adds the missing parenthesis
What value is displayed by this code?
x = 10print(x == 10)
- A
It assigns False to x
- B
It produces the number 10
- C
It evaluates to True
- D
It causes a syntax error
A program executes quantity = int(input()), and the user enters three. What is the most likely result?
- A
A runtime exception during integer conversion
- B
A syntax error before the program starts
- C
The integer 3
- D
The string
threestored as an integer
What happens when this code runs?
print(total)total = 12
- A
The program prints 0
- B
The program waits for input to define total
- C
The program produces a syntax error because print() cannot use variables
- D
The program raises a NameError when total is referenced
A programmer writes DAYS_PER_WEEK = 7. Which statement best describes this name in Python?
- A
Python prevents any later assignment to an uppercase name
- B
An uppercase name is automatically given the constant data type
- C
Uppercase naming communicates intent but does not prevent reassignment
- D
Only values defined with a special constant keyword can be used in expressions
True or false: In Python, a comment beginning with # is normally ignored during program execution.
- A
True
- B
False
What integer does the Python expression 17 // 5 produce?
What type does Python’s input() function return before any explicit conversion?
Related study packs and tools
02 — Information and Representation
A progressive guide to how computers encode numbers, text, images, and sound as binary data, including the trade-offs and limits of digital representation.
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
03 — Python Programming Fundamentals
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
05 — Data Structures: Concepts, Operations, and Trade-Offs
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
6 Computer Memory
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
07 Trees and Binary Search Trees
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
08 — Discrete Mathematics for Computer Science
A focused review of propositional logic, quantifiers, sets, relations, functions, and foundational proof methods in discrete mathematics for computer science.
10 — Data, Systems, and Applications
A progression through how data is organized, searched, exposed through software interfaces, and managed through abstraction layers in modern computer systems.
12 — Foundations Capstone
A medium-difficulty quiz on integrating problem definition, representation, algorithms, complexity analysis, testing, correctness, ethical evaluation, and documentation in a computer science capstone.
12 — Foundations Capstone: Integrating Computer Science
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
OS Processes
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.