Question
1
The
following pseudocode is an example of a(n) ____ structure:
get firstNumber get secondNumber add firstNumber and
secondNumber print result
Answer
sequence
|
||
decision
|
||
loop
|
||
nested
|
Question
2
The
following pseudocode is an example of a(n) ____ structure:
if firstNumber is bigger than secondNumber then print
firstNumber else print secondNumber
sequence
|
||
decision
|
||
loop
|
||
nested
|
Question
3
Fill in
the blank in the following pseudocode:if
someCondition is true then do oneProcess____ do
theOtherProcess
then
|
||
while
|
||
do
|
||
else
|
||
Question
4
The
following pseudocode is an example of a(n) ____ structure:
get number while number is positive add to
sum get number
sequence
|
||
decision
|
||
loop
|
||
nested
|
Question
5
The
statement that best describes the following pseudocode is: ____.if
conditionA is true then do stepEelse do stepB if conditionF
is true then while conditionI is
true do stepJ endwhile
else do stepG endif do stepDendif
Answer
A decision is nested in a sequence
|
||
A decision is nested in a loop
|
||
A loop is nested in a decision
that is nested in another decision
|
||
A sequence is nested inside a
decision nested in another decision
|
Question
6
The
following pseudocode reads a number from the user, multiplies it by 2 and
prints the result. The ____ program statement should replace the ? to make this
program functional and structured. get
inputNumber while not eof
calculatedAnswer = inputNumber * 2 print
calculatedAnswer ? endwhile
no statement is needed
|
||
if done then exit
|
||
get inputNumber
|
||
print inputNumber
|
Question
7
Years ago,
programmers could avoid using structure by inserting a “____” statement into
their pseudocode.
loop
|
||
go next
|
||
next
|
||
go to
|
Question
8
Structured
programs can be easily broken down into routines or ____ that can be assigned
to any number of programmers.
segments
|
||
modules
|
||
units
|
||
sequences
|
Question
9
The
following pseudocode might be rewritten using a(n) ____ structure:if
class = "Freshman" then tuitionFee = 75else if class =
"Sophomore" then tuitionFee = 50
else if class = "Junior"
then tuitionFee = 30
else tuitionFee = 10
endif endifendif
if-then-else
|
||
case
|
||
while
|
||
do while
|
Question
10
____ is
the process of paying attention to important properties while ignoring
nonessential details.
Answer
Abstraction
|
||
Modularization
|
||
Reusability
|
||
Direction
|
Question
11
____ is
the feature of programs that assures you a module has been tested and proven to
function correctly.
Modularization
|
||
Abstraction
|
||
Reliability
|
||
Reusability
|
Question
12
In a
flowchart, you draw each module separately with its own sentinel symbols. The
symbol that is the equivalent of the start symbol in a program contains the
____.
id of the module
|
||
name of the module
|
||
description of the module
|
||
name of the program
|
Question
13
When a
program or module uses another module, you can refer to the main program as the
____ program.
director
|
||
calling
|
||
called
|
||
parent
|
Question
14
The
computer keeps track of the correct memory address to which it should return
after executing a module by recording the memory address in a location known as
the ____.
flowchart
|
||
pointer
|
||
stack
|
||
set
|
Question
15
A variable
that is used known to the entire program is a ____ variable.
local
|
||
shared
|
||
non-modular
|
||
global
|
Question
16
When
declaring a variable in languages such as Visual Basic, C++, Java and C#, the
____ must be identified.
variable name only
|
||
variable data type only
|
||
variable name and data type
|
||
variable name, data type, and
purpose
|
Question
17
The
structure that is used in a binary selection is ____.
if-then
|
||
if-then-else
|
||
while
|
||
do-while
|
Question
18
The
statement that best describes the following pseudocode is ____.if
hoursWorked > 40 then grossPay = 40 * rate + (hoursWorked
- 40) * 1.5 * rateelse grossPay = hoursWorked * rateendif
Answer
dual-alternative selection
|
||
unary selection
|
||
case structure
|
||
if-then structure
|
Question
19
Boolean
expressions are named after ____.
Answer
Harold Boolean
|
||
Henry Boole
|
||
George Boole
|
||
Gerhardt Boolean
|
Question
20
The
decision structure that is logically equivalent to the following is ___.if
customerCode not equal to 1 then discount =
0.25else discount = 0.50endif
Answer
if customerCode > 1 then discount =
0.50else discount = 0.25 endif
|
||
if customerCode < 1 then discount =
0.50else discount = 0.25
endif
|
||
if customerCode = 1 then discount =
0.50else discount = 0.25 endif
|
||
if customerCode = 1 then discount =
0.20else discount = 0.50 endif
|
Question
21
Assume
that out of 1,000 salespeople, 900 sell more than three items in a pay period,
and only 500 sell items valued at $1000 or more. How many total questions must
be asked in the following pseudocode to evaluate bonuses for 1000 salespeople?if
itemsSold > 3 then if valueSold >= 1000
then bonusGiven =
BONUS endifendif
100
|
||
900
|
||
1000
|
||
1900
|
Question
22
For
maximum efficiency, a good rule of thumb in an OR decision is to ____.
first ask the question that is
more likely to be true
|
||
first ask the question that is
more likely to be false
|
||
rewrite as an and decision and ask
the question more likely to be true
|
||
rewrite as an and decision and ask
the question more likely to be false
|
Question
23
The symbol
that represents a logical OR in Perl, Java, C++, and C# is ____.
%
|
||
$
|
||
||
|
||
^
|
Question
24
The
logical AND
operator can be compared to ____ in terms of precedence.
addition
|
||
subtraction
|
||
multiplication
|
||
division
|
Question
25
The
logical OR
operator can be compared to ____ in terms of precedence.
addition
|
||
subtraction
|
||
multiplication
|
||
division
|
Question
26
The piece
of pseudocode that represents incrementing the loop control variable is ____.
rep = 1
|
||
rep = rep + 1
|
||
while (rep < 5)
|
||
print “warning”
|
Question
27
In the
following pseudocode fragment, the while loop will terminate when ____.
counter = 10while response = ‘Y’
print counter counter = counter - 1
print “Do you want to see the next counter? Y or N”
get response
endwhile
counter = 10while response = ‘Y’
print counter counter = counter - 1
print “Do you want to see the next counter? Y or N”
get response
endwhile
counter = 0
|
||
the while loop will not terminate.
|
||
response = ‘Y’
|
||
response = ‘N’
|
Question
28
In the
following pseudocode, the statement print
questionCounter will be executed ____ times.num
PARTS = 5
num QUESTIONS = 3
partCounter = 1
while partCounter <= PARTS
questionCounter = 1
while questionCounter <= QUESTIONS
print questionCounter
questionCounter = questionCounter + 1
endwhile partCounter = partCounter + 1endwhile
num QUESTIONS = 3
partCounter = 1
while partCounter <= PARTS
questionCounter = 1
while questionCounter <= QUESTIONS
print questionCounter
questionCounter = questionCounter + 1
endwhile partCounter = partCounter + 1endwhile
0
|
||
3
|
||
5
|
||
15
|
Question
29
What is
wrong with the following? rep = 10 while (rep
< 20) print “error” endwhile
loop control variable is not
initialized
|
||
loop control variable is not altered
|
||
loop control variable is not
declared
|
||
loop body is missing
|
Question
30
In a for
loop, a(n) ____ value is used to control how the loop control variable is incremented.
step
|
||
group
|
||
id
|
||
sentinel
|
Question
31
The
statement that is true of a structured loop is that ____.
the loop can exit from any point
|
||
the loop body must execute at
least once
|
||
the loop condition represents the
only exit from the loop
|
||
the loop can repeat an infinite
number of times
|
Question
32
An array
is a(n) ____ of variables in memory.
list
|
||
accumulation
|
||
set
|
||
record
|
Question
33
The number
of elements in an array is called the ____ of the array.
width
|
||
size
|
||
height
|
||
depth
|
Question
34
All of the
elements in an array have the same ____.
subscript
|
||
name
|
||
memory location
|
||
value
|
Question
35
An array
can be used to replace ____.
records
|
||
methods
|
||
nested decisions
|
||
loops
|
Question
36
Another
name for a two dimensional array is a(n) ____.
vector
|
||
table
|
||
collection
|
||
set
|
Question
37
The
array that follows is an array ofdouble[]
grades = new double[3];
grades
|
||
doubles
|
||
objects
|
||
arrays
|
Question
38
Which
of the following is an invalid list of elements in an array?
"Joe", "Doug",
"Anne"
|
||
"Joe", 3, 25.5
|
||
3, 17, 12
|
||
12.3, 32.6, 21.7
|
Question
39
What
numbers does the code that follows print to the console?int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9};for (int i = 0; i <
9; i++){ System.out.println(numbers[i]);}
0-9
|
||
1-9
|
||
1-8
|
||
0-8
|
||
0-9
|
Question
40
The
length of the array that follows isint[]
grades = new int[4];
0
|
||
3
|
||
4
|
||
5
|
Question
41
What
is the value of names[4] in the following array?String[] names = {"Jeff", "Dan",
"Sally", "Jill", "Allie"};
Sally
|
||
Jill
|
||
Allie
|
||
name[4] doesn’t exist
|
Question
42
What
is the value of times[2][1] in the array that follows?double[][] times = { {23.0, 3.5}, {22.4, 3.6}, {21.3, 3.7} };
3.7
|
||
22.4
|
||
3.5
|
||
21.3
|
||
3.6
|
Question
43
How
many rows are in the array that follows?Rental[][]
transactions = new Rental[7][3];
7
|
||
6
|
||
3
|
||
2
|
Question
44
What
is the value of nums[2] after the following statements are executed?int[] values = {2, 3, 5, 7, 9};int[] nums = values;values[2] = 1;
3
|
||
1
|
||
5
|
||
0
|
Question
45
Consider
the following condition. It will be true when(!(endProgram.equalsIgnoreCase("n")))
the value of
endProgram equals “n”
|
||
the value of end
Program equals “n” or “N”
|
||
the value of
endProgram doesn’t equal “n”
|
||
the value of
endProgram doesn’t equal “n” or “N”
|
Question
46
Which
of the following statements do you use to jump to the top of an outer loop from
an inner loop?
continue
|
||
labeled continue
|
||
break
|
||
labeled break
|
Question
47
How
many lines are printed on the console when the following for loop is executed?for (int i = 2; i < 10; i++){
System.out.println(i);}
8
|
||
9
|
||
10
|
||
7
|
Question
48
How
many lines are printed on the console when the following for loop is executed?for (int j = 10; j < 40; j *= 2) {
System.out.println(j);}
1
|
||
2
|
||
3
|
||
4
|
Question
49
How
many lines are printed on the console when the following for loops are
executed?for (int i = 1; i <
5; i += 2){ for (int j = 0; j < i; j++)
{ System.out.println(j);
}}
2
|
||
4
|
||
5
|
||
20
|
Question
50
Assume
that the variable named entry has a starting value of 9 and number has a value
of 3. What is the value of entry after the following statements are executed?if ((entry > 9) || (entry/number == 3))
entry--;else if (entry == 9) entry++;else
entry = 3;
3
|
||
8
|
||
9
|
||
10
|
-------------------------------------------------------------
Answers:
- Question 1
The following pseudocode is an
example of a(n) ____ structure:
get firstNumber get secondNumber add firstNumber and secondNumber print result |
|||||
|
- Question 2
The following pseudocode is an
example of a(n) ____ structure:
if firstNumber is bigger than secondNumber then print firstNumber else print secondNumber |
|||||
|
- Question 3
Fill in the blank in the following
pseudocode:
if someCondition is true then do oneProcess ____ do theOtherProcess
Answer
|
|||||
|
- Question 4
The following pseudocode is an
example of a(n) ____ structure:
get number while number is positive add to sum get number
Answer
|
|||||
|
- Question 5
The statement that best describes
the following pseudocode is: ____.
if conditionA is true then do stepE else do stepB if conditionF is true then while conditionI is true do stepJ endwhile else do stepG endif do stepD endif |
|||||
|
- Question 6
2 out of 2
points
The following pseudocode reads a
number from the user, multiplies it by 2 and prints the result. The ____
program statement should replace the ? to make this program functional and
structured.
get inputNumber while not eof calculatedAnswer = inputNumber * 2 print calculatedAnswer ? endwhile
Answer
|
|||||
|
- Question 7
Years ago, programmers could avoid
using structure by inserting a “____” statement into their pseudocode.
Answer
|
|||||
|
- Question 8
Structured programs can be easily
broken down into routines or ____ that can be assigned to any number of
programmers.
|
||||
Answer: modules |
- Question 9
The following pseudocode might be
rewritten using a(n) ____ structure:
if class = "Freshman" then tuitionFee = 75 else if class = "Sophomore" then tuitionFee = 50 else if class = "Junior" then tuitionFee = 30 else tuitionFee = 10 endif endif endif
Answer
|
|||||
|
- Question 10
____ is the process of paying
attention to important properties while ignoring nonessential details.
Answer
|
|||||
|
- Question 11
____ is the feature of programs
that assures you a module has been tested and proven to function correctly.
Answer
|
|||||
|
- Question 12
In a flowchart, you draw each
module separately with its own sentinel symbols. The symbol that is the
equivalent of the start symbol in a program contains the ____.
Answer
|
|||||
|
- Question 13
When a program or module uses
another module, you can refer to the main program as the ____ program.
Answer
|
|||||
|
- Question 14
The computer keeps track of the
correct memory address to which it should return after executing a module by
recording the memory address in a location known as the ____.
Answer
|
|||||
|
A variable that is used known to
the entire program is a ____ variable.
Answer
|
|||||
|
- Question 16
When declaring a variable in
languages such as Visual Basic, C++, Java and C#, the ____ must be
identified.
Answer
|
|||||
|
- Question 17
The structure that is used in a
binary selection is ____.
Answer
|
|||||
|
- Question 18
The statement that best describes
the following pseudocode is ____.
if hoursWorked > 40 then grossPay = 40 * rate + (hoursWorked - 40) * 1.5 * rate else grossPay = hoursWorked * rate endif
Answer
|
|||||
|
- Question 19
2 out of 2
points
Boolean expressions are named
after ____.
Answer
|
|||||
|
- Question 20
The decision structure that is
logically equivalent to the following is ___.
if customerCode not equal to 1 then discount = 0.25 else discount = 0.50 endif
Answer
|
|||||
|
- Question 21
Assume that out of 1,000
salespeople, 900 sell more than three items in a pay period, and only 500
sell items valued at $1000 or more. How many total questions must be asked in
the following pseudocode to evaluate bonuses for 1000 salespeople?
if itemsSold > 3 then if valueSold >= 1000 then bonusGiven = BONUS endif endif
Answer
|
|||||
|
- Question 22
For maximum efficiency, a good
rule of thumb in an OR
decision is to ____.
|
|||||
|
- Question 23
The symbol that represents a
logical OR
in Perl, Java, C++, and C# is ____.
Answer
|
|||||
|
- Question 24
The logical AND operator can be compared to ____
in terms of precedence.
|
|||||
|
- Question 25
The logical OR operator can be compared to ____
in terms of precedence.
|
|||||
|
- Question 26
2 out of 2
points
The piece of pseudocode that
represents incrementing the loop control variable is ____.
|
|||||
|
- Question 27
In the following pseudocode
fragment, the while loop will terminate when ____.
counter = 10 while response = ‘Y’ print counter counter = counter - 1 print “Do you want to see the next counter? Y or N” get response endwhile |
|||||
|
- Question 28
In the following pseudocode, the
statement print questionCounter will be executed ____ times.
num PARTS = 5 num QUESTIONS = 3 partCounter = 1 while partCounter <= PARTS questionCounter = 1 while questionCounter <= QUESTIONS print questionCounter questionCounter = questionCounter + 1 endwhile partCounter = partCounter + 1 endwhile |
|||||
|
- Question 29
What is wrong with the following?
rep = 10 while (rep < 20) print “error” endwhile |
|||||
|
- Question 30
In a for loop, a(n) ____ value is
used to control how the loop control variable is incremented.
|
|||||
|
- Question 31
The statement that is true of a
structured loop is that ____.
|
|||||
|
- Question 32
An array is a(n) ____ of variables
in memory.
Answer
|
|||||
|
- Question 33
2 out of 2
points
The number of elements in an array
is called the ____ of the array.
|
|||||
|
- Question 34
All of the elements in an array
have the same ____.
|
|||||
|
- Question 35
An array can be used to replace
____.
|
|||||
|
- Question 36
Another name for a two dimensional
array is a(n) ____.
|
|||||
|
- Question 37
The array that follows
is an array of
double[] grades = new double[3]; |
|||||
|
- Question 38
Which of the following
is an invalid list of elements in an array?
|
|||||
|
- Question 39
What numbers does the
code that follows print to the console?
int[] numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9}; for (int i = 0; i < 9; i++) { System.out.println(numbers[i]); } |
|||||
|
- Question 40
The length of the
array that follows is
int[] grades = new int[4]; |
|||||
|
- Question 41
What is the value of
names[4] in the following array?
String[] names = {"Jeff", "Dan", "Sally", "Jill", "Allie"}; |
|||||
|
- Question 42
What is the value of
times[2][1] in the array that follows?
double[][] times = { {23.0, 3.5}, {22.4, 3.6}, {21.3, 3.7} }; |
|||||
|
- Question 43
How many rows are in
the array that follows?
Rental[][] transactions = new Rental[7][3]; |
|||||
|
- Question 44
What is the value of
nums[2] after the following statements are executed?
int[] values = {2, 3, 5, 7, 9}; int[] nums = values; values[2] = 1; |
|||||
|
- Question 45
Consider the following
condition. It will be true when
(!(endProgram.equalsIgnoreCase("n"))) |
|||||
|
- Question 46
Which of the following
statements do you use to jump to the top of an outer loop from an inner loop?
|
|||||
|
- Question 47
How many lines are
printed on the console when the following for loop is executed?
for (int i = 2; i < 10; i++) { System.out.println(i); } |
|||||
|
- Question 48
How many lines are
printed on the console when the following for loop is executed?
for (int j = 10; j < 40; j *= 2) { System.out.println(j); } |
|||||
|
- Question 49
|
- Question 50
Assume that the
variable named entry has a starting value of 9 and number has a value of 3.
What is the value of entry after the following statements are executed?
if ((entry > 9) || (entry/number == 3)) entry--; else if (entry == 9) entry++; else entry = 3; |
|||||
|
No comments:
Post a Comment