Presentation is loading. Please wait.

Presentation is loading. Please wait.

Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.

Similar presentations


Presentation on theme: "Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output."— Presentation transcript:

1 Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output for each question. PreAP Computer Science Output Quiz 05

2 Title the quiz as shown below The quiz starts in ONE minute. Name Period Date Output Quiz 05 1.11. 2.12. 3.13. 4.14. 5.15. 6.16. 7.17. 8.18. 9.19. 10.20. EC.

3 What is the output of this program? public class Question01 { public static void main(String args[]) { for (int k = 1; k <= 10; k++) System.out.print(k + " "); } (a) 0 1 2 3 4 5 6 7 8 9 (b) 0 1 2 3 4 5 6 7 8 9 10 (c) 1 2 3 4 5 6 7 8 9 (d) 1 2 3 4 5 6 7 8 9 10

4 What is the output of this program? public class Question02 { public static void main(String args[]) { for (int k = 1; k < 10; k++) System.out.print(k + " "); } (a) 0 1 2 3 4 5 6 7 8 9 (b) 0 1 2 3 4 5 6 7 8 9 10 (c) 1 2 3 4 5 6 7 8 9 (d) 1 2 3 4 5 6 7 8 9 10

5 What is the output of this program? public class Question03 { public static void main(String args[]) { for (int k = 0; k <= 10; k+=2) System.out.print(k + " "); } (a) 0 1 2 3 4 5 6 7 8 9 (b) 0 1 2 3 4 5 6 7 8 9 10 (c) 0 2 4 6 8 (d) 0 2 4 6 8 10

6 What is the output of this program? public class Question04 { public static void main(String args[]) { for (int k = 1; k <= 10; k+=2) System.out.print(k + " "); } (a) 1 3 5 7 9 (b) 1 3 5 7 9 11 (c) 0 2 4 6 8 (d) 0 2 4 6 8 10

7 What is the output of this program? public class Question05 { public static void main(String args[]) { for (int k = 3; k < 50; k*=2) System.out.print(k + " "); } (a) 1 2 4 8 16 32 (b) 1 2 4 8 16 32 64 (c) 3 6 12 24 48 (d) 3 6 12 24 48 96

8 What is the output of this program? public class Question06 { public static void main(String args[]) { for (int k = 12345; k >= 10; k /= 10) System.out.print(k + " "); } (a) 12345 1234 123 12 (b) 12345 1234 123 12 1 (c) 12345 1234.5 123.45 12.345 (d) 12345 1234.5 123.45 12.345 1.2345

9 What is the output of this program? public class Question07 { public static void main(String args[]) { double x = 3.5; if (x < 5.0) System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

10 What is the output of this program? public class Question08 { public static void main(String args[]) { double x = 7.5; if (x < 5.0) System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

11 What is the output of this program? public class Question09 { public static void main(String args[]) { char c = 'J'; c++; if (c == 'J') System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

12 What is the output of this program? public class Question10 { public static void main(String args[]) { char c = 'K'; c--; if (c == 'J') System.out.println("EXPO"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

13 What is the output of this program? public class Question11 { public static void main(String args[]) { double x = 3.5; if (x < 5.0) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

14 What is the output of this program? public class Question12 { public static void main(String args[]) { double x = 7.5; if (x < 5.0) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

15 What is the output of this program? public class Question13 { public static void main(String args[]) { double x = 2.9; if (x > 2.9) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

16 What is the output of this program? public class Question14 { public static void main(String args[]) { double x = 2.9; if (x >= 2.9) System.out.println("EXPO"); else System.out.println("JAVA"); } (a) EXPO (b) JAVA (c) EXPOJAVA (d) No output

17 What is the output of this program? public class Question15 { public static void main(String args[]) { int x,y; x = y = 10; x++; y += x; x *= 2; System.out.println(x – y); } (a) 43(b) 22(c) 21 (d) 11(e) 1(f) -1

18 What is the output of this program? public class Question16 { public static void main(String args[]) { int x,y; x = y = 10; y++; x += y; y *= 2; System.out.println(y + x); } (a) 43(b) 22(c) 21 (d) 11(e) 1(f) -1

19 What is the output of this program? public class Question17 { public static void main(String args[]) { int x = 5; while (x <= 10) x++; System.out.println(x); } (a) 5 (b) 7(c) 9 (d) 10(e) 11(f) 12

20 What is the LAST output of this program? public class Question18 { public static void main(String args[]) { int x = 5; while (x < 10) { x+=2; System.out.println(x); } (a) 5 (b) 7(c) 9 (d) 10(e) 11(f) 12

21 What is the output of this program? public class Question19 { public static void main(String args[]) { int x = 20; int y = 2; int z = 3; while (x > y + z) { x--; y += z; z += y; } System.out.println(z); } (a) 5(b) 13(c) 18(d) 21

22 What is the flag in this program? public class Question20 { public static void main(String args[]) { int x = 0; while (x >= 0) x = Expo.enterInt(); } (a)0 (b)any positive number (c)any positive number and 0 (d)any negative number

23 public class ExtraCredit { public static void main(String args[]) { int sum = 0; for (int k = 1 ; k <= 10; k++) k = k + k; System.out.println(sum); } (a)0 (b)10 (c)14 (d)16 (e)20 (f)32


Download ppt "Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output."

Similar presentations


Ads by Google