Download presentation
Presentation is loading. Please wait.
Published byDenis Pierce Modified over 9 years ago
1
Page 1 Quiz by Joseph Lindo
2
Page 2 Program Analysis by providing the output of a program snippet Some are true or false Some have choices
3
Page 3 Question 1. What is the output of the program below? int[] num = new int [5]; System.out.println(num.length);
4
Page 4 Question 2. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num.length);
5
Page 5 Question 3. What is the output of the program below? int[][] num = new int [5][3]; System.out.println(num.length); a) 3 b) 5 c) 15 d) 0 e) null
6
Page 6 Question 4. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[5]);
7
Page 7 Question 5. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[7]); a) 30 b) 10 c) Error message d) 0 e) null
8
Page 8 Question 6. Single Dimension : List Three Dimension : ___________
9
Page 9 Question 7. True or false Once the size of an array has been specified, it is still can be resize on the later part of the program.
10
Page 10 Question 8. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(‘‘num.length’’);
11
Page 11 Question 9. What is the output of the program below? int[][] num = new int[5][6]; int x = num.length; System.out.println(x);
12
Page 12 Question 10. What is the output of the program below? int[][] num = new int[5][6]; int x = num[5].length; System.out.println(x); a.6 b.5 c.0 d.Error message
13
Page 13 Question 11 – 15. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; for(int i=num.length-1; i>1;i--){ System.out.println(num[i]); }
14
Page 14 Question 16. What is the index combination of the colored cell? a) arr[3][4] b) arr[arr.length-1][2] c) arr[4][2] d) arr[4][3]
15
Page 15 Question 17. Single Dimension : List Two Dimension : ___________
16
Page 16 Question 18. True or false Array stores multiple data types.
17
Page 17 Question 19. True or false Index of an array always start from 0 up to array.length.
18
Page 18 Question 20. What is the equation to be used to display the full size of the array? int[][] num = new int[5][6]; int x = ?? System.out.println(x); a.num.length*num[0].length b.num.length*num[4].length c.num.length*num[5].length d.All of the above e.None of the above f. A and B only g. A and C only
19
Page 19 Question 21-25. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; for(int i=num.length-3; i>=1;i--){ System.out.println(num[i-1]); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.