Question
Choose one per question. Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions. a. sequential b. logical c. compound
Choose one per question.
Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions.
a. sequential
b. logical
c. compound
d. mathematical
9. When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.
a. or
b. and
c. not
d. maybe
10. Which logical operators perform short-circuit evaluation?
a. or, not
b. not, and
c. or, and
d. and, or, not
11. Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive?
a. if 10 < y or y > 50:
b. if 10 > y and y < 50:
c. if y >= 10 and y <= 50:
d. if y >= 10 or y <= 50:
12. In Python, the variable in the for clause is referred to as the __________ because it is the target of an assignment at the beginning of each loop iteration.
a. target variable
b. loop variable
c. for variable
d. count variable
13. Which of the following represents an example to calculate the sum of numbers (that is, an accumulator), given that the number is stored in the variable number and the total is stored in the variable total?
a. total + number = total
b. number += number
c. total += number
d. total = number
14. What type of loop structure repeats the code based on the value of Boolean expression?
a. condition-controlled loop
b. number-controlled loop
c. count-controlled loop
d. Boolean-controlled loop
15. What are the values that the variable num contains through the iterations of the following for loop?
for num in range(2, 9, 2):
a. 2, 3, 4, 5, 6, 7, 8, 9
b. 2, 5, 8
c. 2, 4, 6, 8
d. 1, 3, 5, 7, 9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started