Free Practice Quiz Question List

03 — Programming Fundamentals Quiz Online Quiz Questions

Use this free practice quiz with 20 questions to review 03 — Programming Fundamentals, test your knowledge, and prepare for your next test or exam.

20 questions
01
True or false
1 point

True or false: In Python, the statement score = 92 assigns the value 92 to the variable score; it does not test whether score is equal to 92.

  1. A

    True

  2. B

    False

02
Choose one
1 point

What value does input() return before any explicit type conversion?

  1. A

    An integer

  2. B

    A string

  3. C

    A Boolean value

  4. D

    A floating-point value

03
Written response
1 point

How many times does this loop execute? for number in range(2, 6): print(number). Enter the number of iterations as a whole number.

04
Fill in the blank
1 point

Complete the statement with the Python conversion function that converts the text "16" to the integer 16: age = ("16").

05
Choose one
1 point

What is the result of the Python expression 7 // 2?

  1. A

    1

  2. B

    2

  3. C

    3

  4. D

    3.5

06
True or false
1 point

True or false: In a single Python if/elif/else chain, once a condition is true and its block runs, a later elif block in that same chain does not run.

  1. A

    True

  2. B

    False

07
Choose all
1 point

Select all correct statements about this Python function: def square(number): return number * number.

  1. A

    def begins a function definition.

  2. B

    return repeats the function call automatically.

  3. C

    A return statement sends a result back to the caller.

  4. D

    A parameter must always have a default value.

08
Written response
1 point

What value is returned by rectangle_area(8, 5) when the function is defined as def rectangle_area(width, height): return width * height? Enter the value as a whole number.

09
Fill in the blank
1 point

Complete the sentence: If a Python function reaches the end without a return statement, it returns .

10
Choose all
1 point

Select all correct statements about Python's break and continue statements.

  1. A

    break exits the nearest enclosing loop.

  2. B

    continue terminates the entire program.

  3. C

    break merely pauses the current iteration and then resumes it.

  4. D

    continue skips the rest of the current iteration and starts the next one.

11
Choose one
1 point

What is the last value printed by this code?

for number in range(1, 11):
if number == 5:
break
print(number)

  1. A

    1

  2. B

    4

  3. C

    5

  4. D

    10

12
Open ended
1 point

Explain how the integrated grade-calculator program separates input, processing, and output. Include what happens for both a valid score and a score outside the allowed range.

13
Choose one
1 point

What exactly does print("A", "B", "C", sep="-") display?

  1. A

    ABC

  2. B

    A B C

  3. C

    A...B...C

  4. D

    A-B-C

14
Choose one
1 point

After this Python code runs, what value is associated with score?

score = 92
score = 97

  1. A

    score is permanently fixed at 92

  2. B

    score is associated with 97

  3. C

    score becomes a string

  4. D

    score is deleted

15
True or false
1 point

True or false: In Python, input() returns the line entered by the user as a string, even if the line contains only digits.

  1. A

    True

  2. B

    False

16
Choose one
1 point

What is the type of age after this code runs?

age_text = "16"
age = int(age_text)

  1. A

    str

  2. B

    float

  3. C

    int

  4. D

    bool

17
Written response
1 point

What numeric value is returned by square(7) in the following function?

def square(number):
return number * number

Enter the numeric result only.

18
Choose one
1 point

Which sequence is printed by this loop?

for number in range(1, 4):
print(number)

  1. A

    1, 2, 3, 4

  2. B

    0, 1, 2, 3

  3. C

    1, 2, 3

  4. D

    2, 3, 4

19
Choose one
1 point

Given score = 76 and the conditional statements below, what value is assigned to grade?

if score >= 90:
grade = "A"
elif score >= 80:
grade = "B"
elif score >= 70:
grade = "C"
else:
grade = "Needs improvement"

  1. A

    A

  2. B

    B

  3. C

    C

  4. D

    Needs improvement

20
Written response
1 point

What numeric value is returned by rectangle_area(8, 5) in the following function?

def rectangle_area(width, height):
return width * height

Enter the numeric result only.