Question: NIT2112 Object Oriented Programming Tutorial 5 1. Assume the following initialisations are made in a program: final int LIMIT = 7 ; int count

NIT2112 Object Oriented Programming Tutorial 5 1. Assume the following initialisations aremade in a program: final int LIMIT = 7 ; int count

NIT2112 Object Oriented Programming Tutorial 5 1. Assume the following initialisations are made in a program: final int LIMIT = 7 ; int count 1 ; What is output to the screen (if any) of the following statements? a) while (count < LIMIT) { System.out.println ("count is " + count); count++; } b) while (count < LIMIT ) { count++; = 11 System.out.println ("count is + count); } c) while (count < LIMIT) { System.out.println ("count is " + count); } d) while (count < LIMIT ) { count = 3; System.out.println ("count is " + count); } e) while (count < LIMIT) { count = 11; } // System.out.println ("count is } f) while (count < LIMIT) { count += 2; "I System.out.println ("count is + count); + count); 2. Assume that the following initialisations are made in a program: final int LIMIT = 7; int count = 1 ; What is output to the screen (if any) of the following statements? a) do { b) do { "I System.out.println ("count is count++; } while (count < LIMIT ) ; count++; System.out.println ("count is "I } } while (count < LIMIT ) ; c) do { System.out.println ("count is + count); "1 } while (count < LIMIT); + count); d) do { System.out.println ("count is " + count); count *= 2; } while (count < LIMIT); + count); 3. What output is produced by the following code fragment? int num = 1, max = 20; while (num < max) { num++; if (num % 2 == 0) System.out.println(num); final int LIMIT = 7; 4. Assume the following initialisations are made in a program: What is output to the screen (if any) of the following statements? a) for (int count = 1; count < LIMIT; count++) { System.out.println ("count is " + count); } 5. 6. b) for (int count = 0; count < LIMIT; count++ ) { System.out.println ("count is " + count); } c) for (int count { System.out.println ("count is " + count); } = 0; count

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!