Pre-assessment Flashcards
Which operator should be used to determine if a number is evenly divisible by 5?
%
A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20?
Division
A variable should hold a person’s height in meters. Which data type should the variable be?
Float
A variable should hold the names of all past U.S. presidents. Which data type should the variable be?
String
A program uses the number of seconds in a minute in various calculations. How should the item that holds the number of seconds in a minute be declared?
Constant integer secondsPerMinute
A program determines if a user’s age is high enough to run for U.S. president. The minimum age requirement is 35. How should the item that holds the min- imum age be declared?
Constant integer minAge
What kind of operator is the == in the expression i == 20?
Equality
Which data type is used for items that are measured in length?
Float
Which data type should be used to keep track of how many planes are in a hangar?
Integer
What is put to output by the following pseudocode?
x= 3
do
Put x to output
Put “ “ to output
x = x -1
while x > 0
3 2 1
A programmer has developed the follow- ing code:
count = 0
while count is less than 5: print ‘Hello’
What is the result of implementing this code?
‘Hello’ will print indefinitely.
What is the loop expression in the follow- ing pseudocode?
i = 0
while i < 20 Put i to output i= i+ 1
i < 20
What is the loop variable initialization in the following pseudocode?
y= 0
s = 100.0
while y < 10
s = s + (s * 5.0) y= y+ 1
y= 0
Order the steps needed to output the minimum of x and y from first (1) to last (4).
Select your answer from the pull down list.
Declare variable
min min = x
If y < min, set min = y
Put min to output
What does the following algorithm deter- mine?
if x == y
z= 1
else
z =0
Whether x and y are the same
What does an output of 1 indicate for the following algorithm running on a five-el- ement list of integers?
i= 0
x= 0
while i < 5
if list[i] < 0
x= 1
i= i+ 1
Put x to output
At least one integer is negative.