Which of the following is not a valid expression? Assume x and y are integer variables.
A. x / (y * 7)
B. y / x * 2
C. 2x + 3y
D. (x - 3 * y)
Give this one a try later!
C. 2x + 3y
,Which statement is equivalent to the following?
if x == 1:
t = 'minute'
else:
t = 'minutes'
A. t='minute'+('s'ifx=1else")
B. t='minute'ifx!=1else'minutes'
C. t='minutes'ifx==1else'minute'
D. t='minute'ifx==1else'minutes'
Give this one a try later!
D. t='minute'ifx==1else'minutes'
For the given pseudocode, which XXX and YYY will output the sum of the input
integers (stopping when -1 is input)? Choices are in the form XXX / YYY.
val = Get next input
XXX
while val is not -1
YYY
val = Get next input
Put sum to output
A. sum=val/sum=val
B. sum=0/sum=sum+val
C. sum=0/sum=val
D. sum=val/sum=sum+val
Give this one a try later!
, B. sum=0/sum=sum+val
A programmer must write a 500 line program. Which is most likely the best approach?
A. Write 1 line, run and debug, write 1 more line, run and debug, repeat
B. Write 10-20 lines, run and debug, write 10-20 more lines, run and debug, repeat
C. Write 250 lines, run and debug, write 250 lines, run and debug
D. Write 500 lines, run and debug
Give this one a try later!
B. Write 10-20 lines, run and debug, write 10-20 more lines, run and debug,
repeat
What is output?
def calc(num1, num2):
return 1 + num1 + num2
print(calc(4, 5), calc(1, 2))
A. 145 112
B. 9 3
C. 4, 5, 1, 2
D. 10 4
Give this one a try later!
D. 10 4
, Given x = 1, y = 2, and z = 3, how is the expression evaluated? In the choices, items in
parentheses are evaluated first.
(x == 5) or (y == 2) and (z == 5)
A. False OR (True AND False) --> False OR False --> False
B. False OR (True AND False) --> False OR True --> True
C. (False OR True) AND False --> True AND False --> False
D. (False OR True) AND False --> True AND False --> True
Give this one a try later!
a. False OR (True AND False) --> False OR False --> False
Assume a and b are variables that hold the base and height of a right triangle. The
length of the long side (hypotenuse) is calculate as the square root of a^2 + b^2.
Which expression calculates the length of the hypotenuse?
A. math.square_root(aa+bb)
B. math.sqrt(math.pow(aa),math.pow(bb))
C. math.sqrt(math.pow(a,2)+math.pow(b,2))
D. math.pow(math.sqrt(a),2)+math.pow(math.sqrt(b),2)
Give this one a try later!
C. math.sqrt(math.pow(a,2)+math.pow(b,2))
What values are in result_set after the following code is run?
my_set = {1, 2, 3, 4, 5, 6}
other_set = {2, 4, 6}
result_set = my_set.union(other_set)
A. x / (y * 7)
B. y / x * 2
C. 2x + 3y
D. (x - 3 * y)
Give this one a try later!
C. 2x + 3y
,Which statement is equivalent to the following?
if x == 1:
t = 'minute'
else:
t = 'minutes'
A. t='minute'+('s'ifx=1else")
B. t='minute'ifx!=1else'minutes'
C. t='minutes'ifx==1else'minute'
D. t='minute'ifx==1else'minutes'
Give this one a try later!
D. t='minute'ifx==1else'minutes'
For the given pseudocode, which XXX and YYY will output the sum of the input
integers (stopping when -1 is input)? Choices are in the form XXX / YYY.
val = Get next input
XXX
while val is not -1
YYY
val = Get next input
Put sum to output
A. sum=val/sum=val
B. sum=0/sum=sum+val
C. sum=0/sum=val
D. sum=val/sum=sum+val
Give this one a try later!
, B. sum=0/sum=sum+val
A programmer must write a 500 line program. Which is most likely the best approach?
A. Write 1 line, run and debug, write 1 more line, run and debug, repeat
B. Write 10-20 lines, run and debug, write 10-20 more lines, run and debug, repeat
C. Write 250 lines, run and debug, write 250 lines, run and debug
D. Write 500 lines, run and debug
Give this one a try later!
B. Write 10-20 lines, run and debug, write 10-20 more lines, run and debug,
repeat
What is output?
def calc(num1, num2):
return 1 + num1 + num2
print(calc(4, 5), calc(1, 2))
A. 145 112
B. 9 3
C. 4, 5, 1, 2
D. 10 4
Give this one a try later!
D. 10 4
, Given x = 1, y = 2, and z = 3, how is the expression evaluated? In the choices, items in
parentheses are evaluated first.
(x == 5) or (y == 2) and (z == 5)
A. False OR (True AND False) --> False OR False --> False
B. False OR (True AND False) --> False OR True --> True
C. (False OR True) AND False --> True AND False --> False
D. (False OR True) AND False --> True AND False --> True
Give this one a try later!
a. False OR (True AND False) --> False OR False --> False
Assume a and b are variables that hold the base and height of a right triangle. The
length of the long side (hypotenuse) is calculate as the square root of a^2 + b^2.
Which expression calculates the length of the hypotenuse?
A. math.square_root(aa+bb)
B. math.sqrt(math.pow(aa),math.pow(bb))
C. math.sqrt(math.pow(a,2)+math.pow(b,2))
D. math.pow(math.sqrt(a),2)+math.pow(math.sqrt(b),2)
Give this one a try later!
C. math.sqrt(math.pow(a,2)+math.pow(b,2))
What values are in result_set after the following code is run?
my_set = {1, 2, 3, 4, 5, 6}
other_set = {2, 4, 6}
result_set = my_set.union(other_set)