Homework help! In the following pseudocode: start Declarations num count = 0 num
ID: 3801595 • Letter: H
Question
Homework help!
In the following pseudocode:
start
Declarations
num count = 0
num END = 5
num sum = 0
while count < END
sum = sum + count
count = count + 1
endwhile
output "The sum is: ", sum
stop
the variable count is ________________.
the loop control variable
the increment variable
the loop indefinite variable
the undefined variable
When the flow of execution enters a while-loop, the instructions contained in the body of the loop may not execute at all.
True
False
1 start
2 Declarations
3 num count
4 num salary
5 num END = 10
6 for count = 0 to END step 1
7 output "Enter the salary: "
8 input salary
9 sum = sum + salary
10 endfor
11 output "The accumulated salary is: ", salary
12 stop
in the provided space enter the line number (a number between 1-12) identifying the statement that has a syntax error.
The body of a for-loop always executes at least one time.
True
False
Given the following pseudocode:
1 start
2 Declarations
3 num count
4 num END = 10
5 for count = 0 to END step -1
6 output "Hello world!"
7 endfor
8 stop
in the provided space, enter the line number (a number between 1-8) identifying the statement that has a logical error.
the loop control variable
b.the increment variable
c.the loop indefinite variable
d.the undefined variable
Explanation / Answer
Ques) the variable count is ________________.
variable count is the loop control variable.
Ques) When the flow of execution enters a while-loop, the instructions contained in the body of the loop may not execute at all.
False, As the statement is executed beacuse the values of sum and count are initialised from zero and the loop keeps running until the count becomes less that end i.e. 5.
Ques)in the provided space enter the line number (a number between 1-12) identifying the statement that has a syntax error.
Yes the statement asking for a value must be written outside the for loop because when written in for loop, it will ask for values until the condition for the loop gets satisified.
Ques) The body of a for-loop always executes at least one time.
False, The body not necessarily executes but the loop always runs for once to check the conditions provided.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.