Free Practice Quiz Question List

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.

20 questions
01
Choose one
1 point

Which statement correctly distinguishes syntax from semantics in a programming language?

  1. A

    Syntax determines what a valid program means; semantics determines whether punctuation is correct.

  2. B

    Syntax determines whether code is written according to language rules; semantics concerns what valid code means.

  3. C

    Syntax and semantics are two names for the same process.

  4. D

    Syntax applies only to comments; semantics applies only to variables.

02
True or false
1 point

True or false: In Python, the single equals sign (=) assigns a value, while the double equals sign (==) tests equality.

  1. A

    True

  2. B

    False

03
Written response
1 point

What Python data type does input() return for the user's response before any explicit conversion?

04
Fill in the blank
1 point

Python uses uppercase names as a for values intended not to change during program execution.

05
Choose one
1 point

What value does the Python expression 17 // 5 produce?

  1. A

    2

  2. B

    3

  3. C

    4

  4. D

    3.4

06
Choose all
1 point

Which statements correctly describe variables and names in Python? Select all that apply.

  1. A

    A name is bound to a value or object.

  2. B

    A name can later be bound to a value of another type.

  3. C

    total, Total, and TOTAL are different identifiers.

  4. D

    A variable receives a permanent type declaration when it is first assigned.

07
True or false
1 point

True or false: In Python, a comment beginning with # continues to the end of the physical line and is normally ignored during execution.

  1. A

    True

  2. B

    False

08
Written response
1 point

What category of error occurs when a program runs successfully but produces an incorrect result because its algorithm or expression is wrong?

09
Fill in the blank
1 point

Before executing valid code blocks, the interpreter the source code.

10
Choose all
1 point

Which statements correctly describe expressions and statements in Python? Select all that apply.

  1. A

    An expression can compute or produce a value.

  2. B

    A statement can perform an action or control which code runs.

  3. C

    A comparison expression produces a Boolean value.

  4. D

    An if, for, or while compound statement introduces a block of indented statements.

11
Choose one
1 point

A syntactically valid Python program attempts to divide a number by zero while it is running. What kind of error is this?

  1. A

    Syntax error

  2. B

    Logic error

  3. C

    Runtime error

  4. D

    Name error caused by comments

12
Open ended
1 point

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.

13
Choose one
1 point

A Python program contains the statement print("Hello" with no closing parenthesis. What kind of error occurs first?

  1. A

    A runtime error caused while the statement runs

  2. B

    A syntax error detected before execution

  3. C

    A logic error that produces an incorrect value

  4. D

    No error because Python adds the missing parenthesis

14
Choose one
1 point

What value is displayed by this code?

x = 10
print(x == 10)

  1. A

    It assigns False to x

  2. B

    It produces the number 10

  3. C

    It evaluates to True

  4. D

    It causes a syntax error

15
Choose one
1 point

A program executes quantity = int(input()), and the user enters three. What is the most likely result?

  1. A

    A runtime exception during integer conversion

  2. B

    A syntax error before the program starts

  3. C

    The integer 3

  4. D

    The string three stored as an integer

16
Choose one
1 point

What happens when this code runs?

print(total)
total = 12

  1. A

    The program prints 0

  2. B

    The program waits for input to define total

  3. C

    The program produces a syntax error because print() cannot use variables

  4. D

    The program raises a NameError when total is referenced

17
Choose one
1 point

A programmer writes DAYS_PER_WEEK = 7. Which statement best describes this name in Python?

  1. A

    Python prevents any later assignment to an uppercase name

  2. B

    An uppercase name is automatically given the constant data type

  3. C

    Uppercase naming communicates intent but does not prevent reassignment

  4. D

    Only values defined with a special constant keyword can be used in expressions

18
True or false
1 point

True or false: In Python, a comment beginning with # is normally ignored during program execution.

  1. A

    True

  2. B

    False

19
Written response
1 point

What integer does the Python expression 17 // 5 produce?

20
Written response
1 point

What type does Python’s input() function return before any explicit conversion?