Java Chapter 6

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

To construct a loop that works correctly, you should initialize a loop control _______

Variable

What is the output of the following code? e = 1; while(e < 4); System.out.print(e + " ");

d. nothing

A loop that never ends is a(n) __________.

infinite

A structure that allows repeated execution of a block of statements is a

loop

What does the following statement output? for(b = 1; b > 3; ++b) System.out.print(b + " ");

nothing

What does the following statement output? for(a = 0; a < 5; ++a) System.out.print(a + " ");

0 1 2 3 4

If j=5 and k=6, then the value of j++ == k is _______________

false

What does the following statement output? for(f = 1, g = 4; f < g; ++f, --g) System.out.print(f + " " + g + " ");

1 4 2 3

What does the following program segment output? for(f = 0; f < 3; ++f) for(g = 0; g < 2; ++g) System.out.print(f + " " + g + " ");

a. 0 0 0 1 1 0 1 1 2 0 2 1

What does the following program segment output? for(m = 0; m < 4; ++m); for(n = 0; n < 2; ++n); System.out.print(m + " " + n + " ");

a. 0 0 0 1 1 0 1 1 2 0 2 1 3 0 3 1

The prefix ++ is a ___________________ operator

a. unary

What does the following program segment output? d = 0; do { System.out.print(d + " "); d++; } while (d < 2);

b) 0 1 NOT 012 because 2<2= false!

What is the output of the following code? b = 1; while(b < 4) { System.out.print(b + " "); b = b + 1; }

b. 1 2 3

The loop that performs its conditional check at the bottom of the loop is a _______________ loop

b. do...while

If total=100 and amt=200,the n after the statement total+=amt, .

b. total is equal to 300

If m=9, then after n = m++, the value of m is ________

c. 10

If m=9, then after n = m++, the value of n is ____________

c. 10

If g=5, then after h = ++g, the value of h is ________________

c. 6

What is the output of the following code? b=1; While (b<4) System.out.print(b + " ");

d. 1 1 1 1 1 1...

You must always include___________ in a for loop's parentheses.

2 semicolons


संबंधित स्टडी सेट्स

A&P 1: Chapter #10 - Muscle Tissue

View Set

APUSH: The beginning through War of 1812

View Set

Romeo & Juliet (Acts 3, 4, & 5)- quiz fridat

View Set

SAT Writing and Language Test Strategies and Rules

View Set

Medical Terminology (Chapter 6) Assignment

View Set