190 likes | 330 Views
Quiz by Joseph Lindo. Program Analysis by providing the output of a program snippet. Some are true or false. Some have choices. Question. 1. What is the output of the program below?. int[] num = new int [5]; System.out.println(num.length);. Question.
E N D
Quiz by Joseph Lindo
Program Analysis by providing the output of a program snippet Some are true or false Some have choices
Question 1. What is the output of the program below? int[] num = new int [5]; System.out.println(num.length);
Question 2. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num.length);
Question 3. What is the output of the program below? int[][] num = new int [5][3]; System.out.println(num.length); • 3 • 5 • 15 • 0 • null
Question 4. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[5]);
Question 5. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[7]); • 30 • 10 • Error message • 0 • null
Question 6. Single Dimension : List Three Dimension : ___________
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.
Question 8 . What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(‘‘num.length’’);
Question 9 . What is the output of the program below? int[][] num = new int[5][6]; int x = num.length; System.out.println(x);
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
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]); }
Question 16 . What is the index combination of the colored cell? • arr[3][4] • arr[arr.length-1][2] • arr[4][2] • arr[4][3]
Question 17. Single Dimension : List Two Dimension : ___________
Question 18. True or false Array stores multiple data types.
Question 19. True or false Index of an array always start from 0 up to array.length.
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
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]); }