Computer Science Homework Help
Los Angeles Pierce College Pseudocode and Computer Science Questions
1. Consider the following pseudocode.
i = 0
sum = 0
REPEAT UNTIL i = 4
i = 1
sum++
DISPLAY sum
What is the output?
Nothing – infinite loop.
The number 4 is displayed.
The number 0 is displayed.
The number 1 is displayed.
2. To have a set of command execute multiple times in a program, you would want to use a loop. What types of loops are available in programming?
Do while
Repeat
For next
While
3. Consider the following code:
sum = 0
j = 0
DO WHILE j < 3
DISPLAY (“Enter any number between 1 and 100”)
INPUT num
IF(num >= 1 AND <= 100)
sum = sum + num
ENDIF
END DO WHILE
avg = sum / j