Page 1 Quiz by Joseph Lindo
Page 2 Program Analysis by providing the output of a program snippet Some are true or false Some have choices
Page 3 Question 1. What is the output of the program below? int[] num = new int [5]; System.out.println(num.length);
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);
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
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]);
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
Page 8 Question 6. Single Dimension : List Three Dimension : ___________
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.
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’’);
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);
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
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]); }
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]
Page 15 Question 17. Single Dimension : List Two Dimension : ___________
Page 16 Question 18. True or false Array stores multiple data types.
Page 17 Question 19. True or false Index of an array always start from 0 up to array.length.
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
Page 19 Question 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]); }