MSBC Lesson 1-5 Flashcards
Assume the following for this question:
a = 1
b = 3
c = 2
d = 1.6
What is the value of:
a * b ** c / a
A. 1
B. 2
C. 3
D. 9
D. 9
What optional named parameter can be provided to the print() function to control what is displayed between its comma-separated items?
A. end
B. sep
C. space
D. comma
B. sep
Assume the following for this question:
a = -10.44
b = 20
c = 30
What is the value of:
min(a, max(b, c))
A.-10.44
B.20
C.30
A.-10.44
Assuming sales is a numeric variable, which is a valid statement:
A.print(round(sales,1))
B.round(print(sales), 1)
C.print(sales, round())
A.
When using the print() function, what named parameter can be used to control what is done after all items are displayed?
A. end
B. delim
C. sep
D. space
A. end
How can strings be concatenated?
A.using the + operator
B.concat() method
C.using the / operator
D.None of these
D. None of these
In a program, a specific value (such as a number or string) is referred to as a:
A.Constant
B.Keyword
C.Statement
D.Comment
A. Constant
What will the following if statement evaluate to?
if ‘This’ < ‘that’:
True
True or False, The result of an if’s logical expression can be a string.
False
True or False: The elif statement can optionally have a logical condition.
False
At the end of an if statement you must use a
A.Period
B.colon
C.semi-colon
D.comma
B. Colon
True or False: The while statement includes a condition whose result is a number.
False
True or False: Similar to while, the for statement uses a logical expression to test if its body will execute.
False
True or False: The range() function can be used together with for, to generate a sequence of float numbers.
False