Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Given the following code, the output is __. for (int i=0; i <5; i++) { System.out.print(i + ); } A. 1 2 3

1. Given the following code, the output is __. for (int i=0; i<5; i++) { System.out.print(i + " "); } A. 1 2 3 4 5 B. 1 2 3 4 C. 0 1 2 3 4 D. 0 1 2 3 E. 0 1 2 3 4 5 2. Given the following code, the output is __. for (int i=0; i<5; i+=2) { System.out.print(i + " "); } A. 0 1 2 3 4 B. 0 1 2 3 4 5 C. 1 2 3 4 D. 2 4 E. 0 2 4 3. Given the following code, the output is __. for (int i=25; i>=0; i-=5) { System.out.print(i + " "); } A. 20 15 10 5

B. 20 15 10 5 0 C. 25 20 15 10 5 D. 25 20 15 10 5 0 E. 0 5 10 15 20 25 4. Given the following code, the output is __. int i = 3; while (i<=3) { System.out.print(i + " "); i++; } A. This is an endless loop. B. 3 C. 3 3 D. 3 4 E. 2 3 5. Given the following code, the output is __. int i = 3; while (i<=3) { System.out.print(i + " "); i--; } A. This is an endless loop. B. 3 C. 3 3 D. 3 4 E. 2 3 6. Given the following code, the output is __. int i = 1000; while (true) { System.out.print(i++); } A. This is an endless loop. B. i++ C. 1001 D. 999 E. 1000 7. Given the following code, the output is __. int n = 7; do { n -= 2; } while (n >= -2);

System.out.print(n); A. 7 B. 0 C. -1 D. -3 E. -2 8. Given the following code, the output is __. int n = 7; do { n += 2; } while (n < 27); System.out.print(n); A. 25 B. 26 C. 27 D. 28 E. 29 9. Given the following code, the output is __. int i = 1; while (i<10) { if (i==3 || i==7) { break; } System.out.print(i + " "); i++; } A. 1 2 B. 1 2 3 C. 1 2 4 5 6 8 9 D. 1 2 4 5 6 E. 1 2 3 4 5 6 7 8 9 10. Given the following code, the output is __. for (int i=1; i<10; i++) { if (i==3 || i==7) { continue; } System.out.print(i + " "); } A. 1 2 3 B. 1 2 4 5 6 8 9 C. 1 2 4 5 6 D. 1 2 3 4 5 6 8 9 E. 1 2 3 4 5 6 7 8 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago