,6/3 19:19 CDT,Due date-->9/20/2003 10:00 CDT

What is the value of x after executing?

x=7 y= 10

x=x*27-y+33%2*(-8)

y=x*x-y*0xAB

x=x+ySuppose the following definitions are in effect.

P=false

Q=true

R=false

Check all expressions that evaluate to TRUE.1) not (not P) 2) P and Q 3) P or R 4) P and (Q or R) Consider the following code segment:

if (i<=j) then

print(1)

else

print(2)

end

print(3)

What prints if i is 3 and j is 5?1) 23 2) 13 3) 123 4) 3 Short-circuit evaluation is a programming trick. What does it optimize?

1) space 2) time 3) both 4) neither Assume the following definitions are in effect.

P=true

Q=false

R=false

Check all expressions that "short-circuit" during execution.1) Q and P 2) P or R 3) not P 4) R and (Q or R) Is the following

**for**loop legal?

for x=6,, do print(x) end1)yes 2)no Is the following

**for**loop legal?

for x=6,1 do print(x) end1)yes 2)no If all variables have the integer value 1, what is the value of

**x**after executing x = x*y ?How many times will the following loop execute if x= 13 and y=3?

while (x>=8) do y = y+x end1)0 2)8 3) 13 4)a lot What number does the following program print?

x=1 total=0

repeat

y=x*x total = total+y x=x+1

until (x>8)

print(total)Is the expression ( 11>4) and (4<3)

1) false 2) true Is the expression (9>6) or (1<3)

1) false 2) true Which of the following statements transfers control to the end of a

**for**,**while**?1)return 2)goto 3)continue 4)break How many times is i=i+1 executed?

while (3<5) do i=i+1 end1) 0 2) 1 3) 2 4) lots How many times is i=i+1 executed?

for j=0, 3 do i=i+1 end1) 0 2) 1 3) 3 4) 4 5) lots What prints for the following?

for i=1, 6, 2 do print(i) endWhat prints for the following?

for i=8, 5, -1 do print(i) endWhat prints for the following?

for i=2, 1, 3 do print(i) end1) nothing 2) lots 3) 2 4) 2222 Check all the loop statements that

**break**can be used to exit.1) do 2) while 3) switch 4) if 5) for 6) assignment What prints for the following?

for i=1, 5, 2 do print(i) break end1) nothing 2) lots 3) 1 4) 135 The minimum number of variables to implement a program that counts the number of its inputs that are positive, negative, or zero is

1) 1 2) 3 3) 4 4) 6 The best data type (of those listed) to implement a program that counts is

1) boolean 2) character 3) integer 4) String What is the minimum number of conditional tests necessary to sort any 3 integers into ascending order?

1) 2 2) 3 3) 4 4) 7 Which of the following is the correct syntax for a label?

1) here: 2) ::here:: 3) :here: 4) here:: What prints for the following?

i=2

::startLoop::

if i>5 then goto endLoop end

print(i)

i=i+2

goto startLoop

::endLoop::Typically, every variable should be preceded by which keyword?

1) local 2) static 3) global 4) int