Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

Chapter 4: Loops || A+ Guaranteed.

Rating
-
Sold
-
Pages
9
Grade
A+
Uploaded on
04-04-2025
Written in
2024/2025

For the given pseudocode, which XXX and YYY will output the sum of the input integers (stopping when -1 is input)? Choices are in the form XXX / YYY. val = Get next input XXX While val is not -1 YYY val = Get next input Put sum to output sum = val / sum = val sum = val / sum = sum + val sum = 0 / sum = sum + val sum = 0 / sum = val correct answers sum = 0 / sum = sum + val For the given pseudocode, which XXX and YYY will output the number of times that 10 is input (stopping when 0 is input)? Choices are in the form XXX / YYY. count = 0 val = Get next input While val is not 0 If val == 10 XXX Else YYY val = Get next input Put count to output count = count + 1 / count = 0 count = count + 1 / (nothing) count = count + val / (nothing) count = count + val / count = 0 correct answers count = count + 1 / (nothing) For the given pseudocode, which XXX and YYY will output the smallest non-negative input (stopping when a negative value is input)? Choices are in the form XXX / YYY. min = 0 val = Get next input min = val While val is not negative If XXX YYY val = Get next input Put min to output val 0 / min = val min val / val = min

Show more Read less
Institution
Chapter 4: Loops
Course
Chapter 4: Loops

Content preview

Chapter 4: Loops || A+ Guaranteed.
For the given pseudocode, which XXX and YYY will output the sum of the input integers
(stopping when -1 is input)? Choices are in the form XXX / YYY.
val = Get next input
XXX
While val is not -1
YYY
val = Get next input
Put sum to output

sum = val / sum = val
sum = val / sum = sum + val
sum = 0 / sum = sum + val
sum = 0 / sum = val correct answers sum = 0 / sum = sum + val

For the given pseudocode, which XXX and YYY will output the number of times that 10 is input
(stopping when 0 is input)? Choices are in the form XXX / YYY.
count = 0
val = Get next input
While val is not 0
If val == 10
XXX
Else
YYY
val = Get next input
Put count to output

count = count + 1 / count = 0
count = count + 1 / (nothing)
count = count + val / (nothing)
count = count + val / count = 0 correct answers count = count + 1 / (nothing)

For the given pseudocode, which XXX and YYY will output the smallest non-negative input
(stopping when a negative value is input)? Choices are in the form XXX / YYY.
min = 0
val = Get next input
min = val
While val is not negative
If XXX
YYY
val = Get next input
Put min to output

val > 0 / min = val
min < val / val = min

, val > min / val = min
val < min / min = val correct answers val < min / min = val

Which input value causes "Goodbye" to be output next?
int x;
x = scnr.nextInt();
while (x >= 0) {
// Do something
x = scnr.nextInt();
}
System.out.println("Goodbye");

-1
0
1
No such value correct answers -1

Which input for char c causes "Done" to be output next?
c = 'y';
while (c = 'y') {
// Do something
System.out.println("Enter y to continue, n to quit: ");
// Get c from input}
System.out.println("Done");

'y' only
'n' only
Any value other than 'y'
No such value (error comparing c and 'y') correct answers No such value (error comparing c and
'y')

What is the output, if the input is 3 2 1 0?
x = scnr.nextInt();
while (x > 0) {System.out.print(2 * x + " ");
}

6
642
6420
6 6 6 6 6 ... (infinite loop) correct answers 6 6 6 6 6 ... (infinite loop)

Which XXX and YYY will loop as long as the input is an integer less than 100? Choices are in
the form XXX / YYY.
w = scnr.nextInt();
while (XXX) {
// Do something

Written for

Institution
Chapter 4: Loops
Course
Chapter 4: Loops

Document information

Uploaded on
April 4, 2025
Number of pages
9
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$11.79
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
SirAnton NURSING, ECONOMICS, MATHEMATICS, BIOLOGY, AND HISTORY MATERIALS BEST TUTORING, HOMEWORK HELP, EXAMS, TESTS, AND STUDY GUIDE MATERIALS WITH GUARANTEED A+ I am a dedicated medical practitioner with diverse knowledge in matters
View profile
Follow You need to be logged in order to follow users or courses
Sold
760
Member since
3 year
Number of followers
439
Documents
38001
Last sold
1 day ago
Reign Supreme Scholarly || Enlightened.

Get your revised study materials available here and elevate your educational outcomes. I have numerous verified learning materials (Research, Exams Questions and answers, Assignments, notes etc) for different courses guaranteed to boost your academic results. I am dedicated to offering you the best and unique learning content. You are encouraged to inquire further assistance from this end whenever need be. Kindly remember to leave your review, understanding your satisfaction is essential . We highly appreciate clients who always come back for more of the study content we offer, you are extremely valued. All the best.

Read more Read less
3.7

114 reviews

5
49
4
20
3
22
2
8
1
15

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions