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.
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.
What value does input() return before any explicit type conversion?
- A
An integer
- B
A string
- C
A Boolean value
- D
A floating-point value
How many times does this loop execute? for number in range(2, 6): print(number). Enter the number of iterations as a whole number.
Complete the statement with the Python conversion function that converts the text "16" to the integer 16: age = ("16").
What is the result of the Python expression 7 // 2?
- A
1
- B
2
- C
3
- D
3.5
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.
- A
True
- B
False
Select all correct statements about this Python function: def square(number): return number * number.
- A
defbegins a function definition. - B
returnrepeats the function call automatically. - C
A
returnstatement sends a result back to the caller. - D
A parameter must always have a default value.
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.
Complete the sentence: If a Python function reaches the end without a return statement, it returns .
Select all correct statements about Python's break and continue statements.
- A
breakexits the nearest enclosing loop. - B
continueterminates the entire program. - C
breakmerely pauses the current iteration and then resumes it. - D
continueskips the rest of the current iteration and starts the next one.
What is the last value printed by this code?
for number in range(1, 11): if number == 5: break print(number)
- A
1
- B
4
- C
5
- D
10
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.
What exactly does print("A", "B", "C", sep="-") display?
- A
ABC
- B
A B C
- C
A...B...C
- D
A-B-C
After this Python code runs, what value is associated with score?
score = 92
score = 97
- A
score is permanently fixed at 92
- B
score is associated with 97
- C
score becomes a string
- D
score is deleted
True or false: In Python, input() returns the line entered by the user as a string, even if the line contains only digits.
- A
True
- B
False
What is the type of age after this code runs?
age_text = "16"
age = int(age_text)
- A
str
- B
float
- C
int
- D
bool
What numeric value is returned by square(7) in the following function?
def square(number):
return number * number
Enter the numeric result only.
Which sequence is printed by this loop?
for number in range(1, 4):
print(number)
- A
1, 2, 3, 4
- B
0, 1, 2, 3
- C
1, 2, 3
- D
2, 3, 4
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"
- A
A
- B
B
- C
C
- D
Needs improvement
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.
Related study packs and tools
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
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.
6 Trees and Binary Search Trees
A 14-question quiz on trees, binary trees, traversals, recursive algorithms, and binary search trees. The questions progress from foundational concepts to applied reasoning about structure, complexity, and BST operations.
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.
8 Software Documentation
Learn how to choose, structure, document, and maintain software documentation for users, developers, integrators, and operators.
9 Sorting Algorithms
A structured guide to comparison-based sorting algorithms, their complexity, stability, memory use, and practical selection criteria.
Interrupts
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
OS Processes
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
Systemcalls
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.