Multiple Choice
Identify the choice that best completes the statement or answers the question.
1. Which loop will count 16,
12, 8, 4, 0
a. for decreasing number :
16..0 by -4
b. for decreasing by 4 number : 16..0
c. for decreasing number : 16..1 by 4
d. for decreasing number : 16..0 by 4
2. Which statement has an
error?
a. a := 77 + 33 c. x := maxx
b. name = “Ralph” d. b := a
3. What will this code
segment display?
var count :
int := 2
var total : int := 0
loop
total := total +
count
exit when total >
9
count := count +
1
end loop
put count
a. 3 c. 6
b. 4 d. 5
, 4. Which choice will
complete this code
segment to tests
whether response
is an “A” or “a’”?
var responseStatus :
string
var response :
string
// lines omitted
responseStatus :
= "Account Type"
end if
a. if (response = "A" or
response = "Z") then
b. if (response = "A" or response = "a") then
c. if (response >= "A" or response <= "a") then
d. if (response = "A" and response = "a") then
5. If the letter ‘A’ is ASCII
code 65, then what
statements
prints 65
a. put chr(65) c. put
code(‘A’)
b. put ord(‘A’) d. get chr(‘A’)
6. How many choices are
possible when using a
single if-then-else
state ment?