Exam 6: Loops

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What is the output of the code fragment given below? Int i = 0; Int j = 0; While (i < 125) { I = i + 2; J++; } System.out.println(j);

(Multiple Choice)
4.8/5
(32)

What is the output of the code below? for (int val = 0; val < 4; val ++) { System.out.print ("+"); For (int num = 0; num < val; num++) { System.out.print ("0"); } }

(Multiple Choice)
4.9/5
(37)

Which loop does not check a condition at the beginning of the loop? I. The do loop II. The while loop III. The for loop

(Multiple Choice)
4.7/5
(39)

How many times does the following code snippet display "Loop Execution"? for (int i = 0; i < 10; i++); { System.out.println("Loop Execution"); }

(Multiple Choice)
4.9/5
(40)

What does the following code do? Int sum = 0; Final double count = 1000; Random generator = new Random(); For (int i = 1; i <= count; i++) { Sum = sum + generator.nextInt(101); } System.out.println(sum / count);

(Multiple Choice)
4.9/5
(41)

Which of the loop(s) test the condition after the loop body executes? I. for loop II. while loop III. do loop

(Multiple Choice)
4.9/5
(39)

Which of the following loops executes exactly 10 times?

(Multiple Choice)
4.8/5
(31)

Assume the following variable has been declared and given a value as shown: Random rand = new Random(); Int number = rand.nextInt (27) * 2 + 3; What are the smallest and largest values number may be assigned?

(Multiple Choice)
4.9/5
(37)
Showing 121 - 128 of 128
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)