GoConqr has a new look! Let us know what you think.

Quiz

178

Juan Encarnocion 19 questions

Take the quiz

Questions in this quiz (19)

  1. 11) You can always convert a while loop to a for loop.
    1. AA) true
    2. BB) false
  2. 2Will the following program terminate?int balance = 10;while (true) { if (balance < 9) break; balance = balance - 9;}
    1. AA) Yes
    2. BB) No
  3. 3You can always write a program without using break or continue in a loop.
    1. AA) true
    2. BB) false
  4. 4What is sum after the following loop terminates?int sum = 0;int item =
    0;do { item++; sum += item; if (sum >= 4) continue;}while (item < 5);
    1. AA) 18
    2. BB) 16
    3. CC) 15
    4. DD) 17
  5. 5 Analyze the following code.int count = 0;while (count < 100) {
    // Point // Point
    ASystem.out.println("Welcome to Java!"); B} // Point C
    1. AA) count < 100 is always false at Point C
    2. BB) count < 100 is always false at Point B
    3. CC) count < 100 is always true at Point C
    4. DD) count < 100 is always true at Point A
    5. EE) count < 100 is always true at Point B
  6. 6 Is the following loop correct?for (; ; );
    1. AA) Yes
    2. BB) No
  7. 7What is sum after the following loop terminates?int sum = 0;int item = 0;do { item++; sum += item; if (sum > 4) break;}while (item < 5);
    1. AA) 7
    2. BB) 8
    3. CC) 6
    4. DD) 5
  8. 8How many times will the following code print "Welcome to Java"?int count = 0;do { System.out.println("Welcome to Java");} while (count++ < 10);
    1. AA) 11
    2. BB) 9
    3. CC) 0
    4. DD) 10
    5. EE) 8
  9. 9To add 0.01 + 0.02 + ... + 1.00, what order should you use to add the numbers to get better accuracy?
    1. Aadd 1.00, 0.99, 0.98, ..., 0.02, 0.01 in this order to a sum variable whose initial value is 0.
    2. Badd 0.01, 0.02, ..., 1.00 in this order to a sum variable whose initial
      value is 0.
  10. 10 What is the number of iterations in the following loop: for (int i = 1; i
    <= n; i++) { // iteration }
    1. AA) n + 1
    2. BB) n - 1
    3. CC) 2*n
    4. DD) n

Information

Description
Quiz on 178, created by Juan Encarnocion on 15/02/2016.
Language
English
Views
0
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?