
Flashcard on Accumulators and Sentinel Values

Flashcard
•
Hospitality and Catering
•
12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

7 questions
Show all answers
1.
FLASHCARD QUESTION
Front
A(n) _____ value is a special value that cannot be mistaken as a member of the list, and signals that there are no more values to be entered. When the user enters the sentinel value, the loop terminates.
Back
sentinel
2.
FLASHCARD QUESTION
Front
The logic for calculating a sum of numbers generally requires the accumulator variable to be set to _____ otherwise the total may not be correct when the loop finishes.
Back
0
3.
FLASHCARD QUESTION
Front
A sentinel value is always included (summed) in the running total of an app that accumulates.
Back
False
4.
FLASHCARD QUESTION
Front
The best choice for a sentinel used in a program that sums the number of free throws made in an NBA playoff basketball game is 3 (assume Shaq is not playing).
Back
False
5.
FLASHCARD QUESTION
Front
-1 is not an ideal choice for a sentinel used to sum the number of days it is hot in the Sahara desert.
Back
False
6.
FLASHCARD QUESTION
Front
In the following program segment, which variable is the "loop control variable" (also known as the counter variable)? int a, r = 0, g = 0; while (r < 21) { g = r * 2; a += g; r++; } System.out.println("The sum is " + g);
Back
r
7.
FLASHCARD QUESTION
Front
In the following program segment, which is a VALID Java accumulator? int a, r, h = 1; g = 0; while (r < 21) { a = r * 2; g += a + h; r--; } System.out.println("The sum is " + g);
Back
g
Similar Resources on Wayground
8 questions
Beginning sounds

Flashcard
•
KG
9 questions
Loops - code.org

Flashcard
•
12th Grade
2 questions
Environmental Vocabulary Flashcard

Flashcard
•
11th Grade
5 questions
Mini game group 5

Flashcard
•
University
10 questions
Homeostasis

Flashcard
•
11th Grade
10 questions
CMP128 Java Ch. 04 Loops Pt. 1

Flashcard
•
University
5 questions
Untitled Flashcards

Flashcard
•
KG
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade