What value does the Python expression 2 + 3 * 4 produce?
03. Expressions and Boolean Logic Online Quiz Questions
Use this free practice quiz with 20 questions to review 03. Expressions and Boolean Logic, test your knowledge, and prepare for your next test or exam.
In Python, x = 10 asks whether x already equals 10.
- A
True
- B
False
What numeric value does the Python expression 20 / 5 * 2 produce? Enter the numeric value only. No tolerance is allowed.
In the expression 7 % 2, the result is the after division.
What value does the Python expression "-" * 5 produce?
- A
"-5"
- B
"-----"
- C
5
- D
An error because strings cannot use
*
Which three values are false in a Python Boolean context? Select all correct choices.
- A
False - B
"hello" - C
0 - D
"" - E
[1]
Python's and and or operators always return either True or False, never an operand such as a string.
- A
True
- B
False
What numeric value does the Python expression 2 ** 3 ** 2 produce? Enter the numeric value only. No tolerance is allowed.
In number != 0 and 100 / number > 2, the division is skipped when number is zero because of .
Which expression is equivalent to the Python chained comparison 10 <= score <= 20?
- A
10 <= score and score <= 20 - B
10 <= (score <= 20) - C
10 < score < 20only - D
score <= 10 or score >= 20
Which three expressions are valid examples of the string operations described in the material? Select all correct choices.
- A
"a" + "b" - B
"a" + 3 - C
f"Score: {95}" - D
"a" * "b" - E
"cat" in "concatenate"
Explain how the expression number != 0 and 100 / number > 2 prevents a division-by-zero error. Include the evaluation order and the role of short-circuiting.
Which statement about the Python string comparison "A" < "a" is correct?
- A
"apple" < "banana"is false - B
"A" < "a"is true - C
"apple" < "banana"raises an error - D
String comparisons ignore letter case
In Python, what is the result of evaluating bool([])?
- A
True
- B
False
- C
None
- D
It raises a TypeError
Given name = "Ada" and score = 95, what string does f"{name} scored {score}%" produce?
- A
Ada scored {score}% - B
name scored 95% - C
Ada scored 95% - D
Ada scored score%
What is the result of this Python code?
score = 15
10 <= score <= 20
- A
True - B
False - C
15 - D
A syntax error
What happens when number = 0 and Python evaluates number != 0 and 100 / number > 2?
- A
True - B
A division-by-zero error
- C
False - D
0
True or false: In Python, 2 ** 3 ** 2 evaluates to 512.
- A
True
- B
False
What numeric value does the Python expression 20 / 5 * 2 produce?
In Python, what numeric value does the expression 29 // 6 produce?
Related study packs and tools
AP Computer Science A: Integrated Java Problem Solving
A practical review of the integrated Java skills, debugging habits, algorithm reasoning, and free-response strategies needed for AP Computer Science A.
Fault Tolerance and Redundant Systems
A progressive guide to designing, operating, and testing systems that continue useful service despite component faults, overload, data loss, and recovery challenges.
How the Internet Works
A medium-difficulty quiz on how independently operated networks, protocols, addresses, naming systems, transport services, and routing mechanisms work together to form the Internet.
Java ArrayList and Collections: Operations, Traversals, and Algorithms
Learn how to create, modify, traverse, and analyze Java lists with ArrayList, wrapper types, standard algorithms, and the Collections utility class for AP Computer Science A.
Java Boolean Logic and Selection
Build a clear understanding of Java Boolean expressions, logical operators, selection statements, nested branching, equivalent logic, and systematic code tracing for AP Computer Science A.
Java Foundations and Program Design
A practical introduction to Java program structure, data types, operators, input and output, problem-solving strategy, testing, and debugging for AP Computer Science A.
Java Inheritance and Polymorphism
A practical guide to Java inheritance, constructor chaining, method overriding, polymorphism, access control, and object behavior for tracing and writing AP Computer Science A programs.
Java Objects, Classes, and the String API
A focused guide to Java classes, object references, constructors, methods, strings, wrapper classes, and API usage for AP Computer Science A.
Java Primitive Types and Expression Evaluation
A focused guide to Java primitive types, expression evaluation, numeric conversion, floating-point behavior, integer overflow, and common methods in the Math class for AP Computer Science A.
Java Primitive Types and Expressions
A focused review of Java primitive types, expression evaluation, numeric conversion, arithmetic behavior, Math methods, randomness, and tracing techniques for AP Computer Science A.
Packets, Links, and Network Performance
A progressive guide to how packet-switched networks encapsulate data, move it across links, and manage delay, throughput, queues, and congestion.
Parallel and Distributed Computing
A structured guide to designing parallel and distributed systems through decomposition, communication, coordination, state management, scalability, and fault tolerance.