1 / 19

Quiz by Joseph Lindo

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.

Download Presentation

Quiz by Joseph Lindo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quiz by Joseph Lindo

  2. Program Analysis by providing the output of a program snippet Some are true or false Some have choices

  3. Question 1. What is the output of the program below? int[] num = new int [5]; System.out.println(num.length);

  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. 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

  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. 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

  8. Question 6. Single Dimension : List Three Dimension : ___________

  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. 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. 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. 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. 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. 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]

  15. Question 17. Single Dimension : List Two Dimension : ___________

  16. Question 18. True or false Array stores multiple data types.

  17. Question 19. True or false Index of an array always start from 0 up to array.length.

  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. 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]); }

More Related