Title: Competency 4 Practice Quiz
Course: Programming Fundamentals I > Section: Practice Quizzes

Q: What would the following code display?

if 'z' < 'a';

print ('z is less than a.')

else:

print('z is not less than a.')
Feedback: z is not less than a

Q: Write an if statement that displays the message “The number is valid” if the value referenced by the variable speed is within the range 0 - 200.
Feedback: if speed >= 0 and speed <= 200: print( ' The number is valid' )

Q: Assume the variables a = 2, b = 4, and c = 6. Indicate whether its value is true or false.

a == 4 or b > 2

6 <= c and a > 3

1 ! = b and c ! = 3
Feedback: T F T

Q: What would the following code display?

s1 = ' New York'

s2 = ' Boston‘

if s1 > s2:

print( s2 )

print( s1)

else:

print( s1)

print( s2 )
Feedback: Boston New York

Q: A ___________ _________ is a logical design that controls the order in which a set of statements execute
A: Control structure

Q: A ________ ________ is a program structure that can execute a set of statements under certain conditions
A: Decision structure

Q: A _________ expression is an expression that can be evaluated as true or false
A: boolean

Q: __________   _________ can be used to create complex Boolean expressions
A: Logical operators

Q: Deciding the value of a compound Boolean expression after evaluating only one sub expression is known as ________ ________  __________
A: short cirquit evaluation

Q: The if statement causes one or more statements to execute only when a Boolean expression is  ____________
A: true