Consider the following code segment. result = 1; while workingVal > 1 % result =
ID: 3836202 • Letter: C
Question
Consider the following code segment. result = 1; while workingVal > 1 % result = result + workingVal; workingVal = workingVal = 1; % end If workingVal starts by holding the value 5, select from the following the value of workingVal when this loop stops iterating. Circle the letter to the left of the selection to indicate your answer. a. 0 b. 5 c. 60 d. 120 e. All of these selections are correct f. None of these selections are correct If workingVal starts by holding the value -5, select from the following the value of workingVal when this loop stops iterating. Circle the letter to the left of the selection to indicate your answer. a. 0 b. 5 c. 60 d. 120 e. All of these selections are correct f. None of these selections are correct If result starts by holding the value 0, and workingVal starts with the value 5, select from the following the value of workingVal when this loop stops iterating. Circle the letter to the left of the selection to indicate your answer. a. 0 b. 5 c. 60 d. 120 e. All of these selections are correct f. None of these selections are correctExplanation / Answer
10) f) None of these selections are correct, If it started from 5 , the when loop ends , last checked while condition will be 1> 1 which becomes false and loop stops
11) f) None of these selections are correct, In first iteration in while loop it checks condition -5 > 1 which is false , so while loop stops there itself. So value of workingVal at end of loop is -5
12)f) None of these selections are correct , as in while condition we are checking only wokingVal value and comparing it with 1, So at the end of loop it will be 1 as per Part 10.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.