Pre-assessment Flashcards
(41 cards)
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.
When should a programmer develop an algorithm to solve a problem?
Before writing a program to solve the problem
Which text represents an algorithm?
Insert key, turn key, open door.
Which text represents an algorithm? 2
Shake bulb; if it rattles, replace it.
An algorithm should output “OK” if a list’s numbers are all non-zero, else the out- put is “Not OK.”
Which test is a valid test of the algo- rithm?
Input 99, 0, 5. Ensure output is “Not OK
What is the purpose of a use case dia- gram, such as the following diagram?
Describes how a user can interact with a program
Which elements are characteristic of a class diagram?
System’s classes, attributes, and meth- ods and their features, constraints, and relationships
Review the following use case diagram:
Provides an overview of several use cases
Which phase of a waterfall approach would create a sequence diagram that specifies the required order of events be- tween completed program components?
Analysis
Design
Implementation
Testing
Checkmark
Checkmark