1/20
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
6 or 7
1 grade = 71
2 if grade > 90:
3 print("You got an A")
4 elif grade > 80:
5 print("You got a B")
6 elif grade > 70:
7 print("You got a C")
8 elif grade > 60:
9 print("You got a D")
10 elif grade <= 60:
11 print("You got a F")
12 print("We are done!")
For the sample program, when using the interactive debugger with breakpoints set on lines 2,4,6,8, and 10, what is the line number of the breakpoint that the interactive debugger will step into a condition?
2,4,6,8,10,12
1 grade = 71
2 if grade > 90:
3 print("You got an A")
4 elif grade > 80:
5 print("You got a B")
6 elif grade > 70:
7 print("You got a C")
8 elif grade > 60:
9 print("You got a D")
10 elif grade <= 60:
11 print("You got a F")
12 print("We are done!")
In order to debug every possible path in the example code, a breakpoint would need to be set on which line numbers?
Function
A block of code that only runs when it is called is a(n)?
If
Which statement is the simplest form of a conditional statement?
elif
Which conditional statement allows you to check multiple expressions for TRUE?
else
The __________ conditional statement catches anything not caught by the preceding conditions.
FALSE
Using the Boolean operator "and", if A = True and B = False, what would the result be?
FALSE
The Boolean type has two possible values (True or False), which can also be represented numerically with 0 or 1.
The numeric 0 represents which Boolean value?
TRUE
Using the Boolean operator "or", if A = False and B = True, what would the result be?
Where can a nested conditional statement appear within an if-elif chained conditional statement?
Within either the if or elif statement.
Where in an if-elif chained conditional statement is an else statement located to catch any cases that did not satisfy any of its criteria?
At the end
a = 5
b = 15
c = 10
d = 0
if a > b:
d = 4
elif b > c:
d = 5
else:
d = 6
print(d)
5 will be printed
What will happen in a program if there is an error that is not handled by a try/except statement?
The program will terminate and raise an error.
Which statement follows a try statement and is responsible for handling an error?
except
Which statement is used to check for errors in your Python code?
try
12
1 grade = 71
2 if grade > 90:
3 print("You got an A")
4 elif grade > 80:
5 print("You got a B")
6 elif grade > 70:
7 print("You got a C")
8 elif grade > 60:
9 print("You got a D")
10 elif grade <= 60:
11 print("You got a F")
12 print("We are done!")
For the sample program, when using the interactive debugger with breakpoints set on lines 2,4,6,8, and 10, what line number is highlighted when the grade message is displayed as output?
Number is Odd
This Python script checks whether a number is even or odd. Which message would be most appropriate as output for line 5?
1 num=____(input("Enter your age"))
2 if num__==0:
3 print("Number is Even")
4 else:
5 print("____________")
"%2"
This Python script checks whether a number is even or odd. Which operand would be most appropriate for condition in line 2?
1 num=____(input("Enter your age"))
2 if num__==0:
3 print("Number is Even")
4 else:
5 print("____________")
int
This Python script checks whether a number is even or odd. Which casting function would be most appropriate for line 1?
1 num=____(input("Enter your age"))
2 if num__==0:
3 print("Number is Even")
4 else:
5 print("____________")
Swapcase
What is the built-in string method that changes the case of every character in a string?
Typecasting
What is the process used to convert a literal of one type to another called?