1) SET t = 23
set a = 18
set b = 5
WHILE a>b
INCREMENT t
INCREMENT b
DECREMENT a
ENDWHILE
PRINT a and t
select one: don't need to explain
a) 13 and 26
b) 11 and 30
c) 12 and 31
d) 12 and 28
2) set t = 0
set a = 0
set b = 5
WHILE a <b
INCREMENT t
INCREMENT a
ENDWHILE
PRINT a and t
select one: dont explain
a) 3 and 5
b) 5 and 5
c) 4 and 2
d) 4 and 4
Answer for first would be - b) 11 and 30
Explaination for question# 1 - Here intial values are t = 23, a = 18, b = 5. While condition is (a>b).
Here for given values while condition would be false when b becomes 12 that time a would be 11.
Here while loop would execute 7 times and in while loop we are doing INCREMENT t, INCREMENT b, and DECREMENT a and printing a and t.
So result would be a=18-7 = 11 and t=23+7=30
**********************************************************************************
Answer for second would be - b) 5 and 5
Explanation for question #2 - Here intial values are t = 0, a = 0 and b = 5. While condition is (a<b).
Here for given values while condition would be false when a becomes 6. And while loop stop executing.
Here while loop will exceute 5 times. and we are incremeting t and a.
So result would be a= 0+5 = 5 and t=0+5=5
Get Answers For Free
Most questions answered within 1 hours.