Exam 3: Control Structures
Exam 1: Introduction102 Questions
Exam 2: Data and Expressions71 Questions
Exam 3: Control Structures129 Questions
Exam 4: Lists85 Questions
Exam 5: Functions83 Questions
Exam 6: Objects and Their Use54 Questions
Exam 7: Modular Design62 Questions
Exam 8: Text Files58 Questions
Exam 9: Dictionaries and Sets33 Questions
Exam 10: Object-Oriented Programming81 Questions
Exam 11: Recursion27 Questions
Select questions type
Examine the following lines of code:
Current = 1
Sum = 0
N = 5
While current <= n:
Sum = sum + current
Current = current + 1
What is the value of sum after the loop completes all of its iterations?
(Multiple Choice)
4.7/5
(27)
Give a logically equivalent expression for each of the following:
-num1 > 0 and num2 > 0
(Short Answer)
4.8/5
(36)
Python built-in functions _____ and _____ can be used to convert a string type to a numeric type.
(Short Answer)
4.9/5
(35)
Match the expressions that they are logically equivalent to the Boolean expressions :
-not (x != y)
(Multiple Choice)
4.9/5
(30)
Which form of control does the while statement in Python provide?
(Multiple Choice)
4.8/5
(34)
Match the expressions that they are logically equivalent to the Boolean expressions :
-not (x >= y)
(Multiple Choice)
4.8/5
(41)
Give a logically equivalent expression for each of the following:
-num1 <= 0 or num2 <= 0
(Short Answer)
4.9/5
(43)
Which of the following can the condition of a while statement be based on?
(Multiple Choice)
5.0/5
(46)
What is the term for a statement that determines the control flow of a set of instructions?
(Short Answer)
4.8/5
(29)
Give a logically equivalent expression for each of the following:
-not (num1 == 0 and num2 == 0)
(Short Answer)
4.8/5
(29)
All if statements must include the use of a _____________ expression.
(Short Answer)
4.9/5
(44)
Evaluate the following Python expressions.
-10 not in (10, 20, 30)
(True/False)
4.8/5
(31)
Examine the following statements.
X = 10
X == 10
What will the second line evaluate to?
(Multiple Choice)
4.8/5
(37)
Operator precedence applies to the arithmetic operators and relational operators, but not to the Boolean operators.
(True/False)
4.7/5
(42)
Write a simple Python program by use of a single if statement with elif headers that prompts the user to enter the name of a month ('January', 'February', etc.) and sets each of the variables fall_season, winter_season, spring_season, summer_season to the appropriate Boolean value. For example, if the user enters 'January', variable winter_season should be set to True, and the rest of the variables set to False. (Consider the months January, February and March as winter; April, May and June as spring; etc.
(Essay)
4.7/5
(39)
The if statement in Python provides a means of __________ control.
(Short Answer)
4.8/5
(36)
The order that instructions are executed in a program is called _____________________.
(Short Answer)
4.8/5
(37)
Evaluate the following Python expressions.
-5 < 10 and 8 > 20 or 4 < 2
(True/False)
4.8/5
(39)
Showing 41 - 60 of 129
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)