Thursday, December 4, 2014

Practice Questions

What value is stored in num at the end of this looping?
num = 0 
for x = 1 to 3 do
     num = num + x
next

a. 3
b. 4
c. 5
d. 6


Consider the following snippet and state how many times the phrase “In the loop” is printed.
a = 6
b = 12
while a < b do
     print “In the loop”
     a = a + 2
wend

a. 6
b. 12
c. 2
d. 3


Looking at the following while statement, identify the dummy value.
While Age < > 999 do

a. While
b. 999
c. Age
d. < >


Using the following snippet, state the number of repetitions that will occur.
input num
while num < 6 do
     count = count + 1
wend

a. 1
b. 2
c. 5
d. unknown


Look at the following; identify the loop variable.
for class = 1 to 25 do
   input num
   total = total + num
next

a. num
b. total
c. class
d. not specified

Consider the following array of peripherals and answer the questions.

1  Monitors
2  Keyboards
3  Mouse

Identify the name of the array ___________________
State the size of the array _______________________
State the data type of the array ___________________


Convert the following to a repeat until loop, whereby the loop repeats until the word end is entered:

for students = 1 to 117
   print "ready for the exam?"
   input ans$
   if ans$ = "yes" then
       print "Awesomesauce"
   end if
next

No comments:

Post a Comment