quiz by joseph lindo

19
Page 1 Quiz by Joseph Lindo

Upload: calvin-holcomb

Post on 30-Dec-2015

23 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Quiz by Joseph Lindo

Page 1

Quizby Joseph Lindo

Page 2: 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: Quiz by Joseph Lindo

Page 3

Question1. What is the output of the program below?

int[] num = new int [5];System.out.println(num.length);

Page 4: Quiz by Joseph Lindo

Page 4

Question2. What is the output of the program below?

int[] num = {3,4,2,7,8,10,30};System.out.println(num.length);

Page 5: Quiz by Joseph Lindo

Page 5

Question3. What is the output of the program below?

int[][] num = new int [5][3];System.out.println(num.length);

a) 3b) 5c) 15d) 0e) null

Page 6: Quiz by Joseph Lindo

Page 6

Question4. What is the output of the program below?

int[] num = {3,4,2,7,8,10,30};System.out.println(num[5]);

Page 7: Quiz by Joseph Lindo

Page 7

Question5. What is the output of the program below?

int[] num = {3,4,2,7,8,10,30};System.out.println(num[7]);

a) 30b) 10c) Error messaged) 0e) null

Page 8: Quiz by Joseph Lindo

Page 8

Question6.

Single Dimension : ListThree Dimension : ___________

Page 9: Quiz by Joseph Lindo

Page 9

Question7. True or falseOnce the size of an array has been specified, it is still can be resize on the later part of the program.

Page 10: Quiz by Joseph Lindo

Page 10

Question8 . What is the output of the program below?

int[] num = {3,4,2,7,8,10,30};System.out.println(‘‘num.length’’);

Page 11: Quiz by Joseph Lindo

Page 11

Question9 . What is the output of the program below?

int[][] num = new int[5][6];int x = num.length;System.out.println(x);

Page 12: Quiz by Joseph Lindo

Page 12

Question10 . What is the output of the program below?

int[][] num = new int[5][6];int x = num[5].length;System.out.println(x);

a.6b.5c.0d.Error message

Page 13: Quiz by Joseph Lindo

Page 13

Question11 – 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: Quiz by Joseph Lindo

Page 14

Question16 . 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: Quiz by Joseph Lindo

Page 15

Question17.

Single Dimension : ListTwo Dimension : ___________

Page 16: Quiz by Joseph Lindo

Page 16

Question18. True or falseArray stores multiple data types.

Page 17: Quiz by Joseph Lindo

Page 17

Question19. True or falseIndex of an array always start from 0 up to array.length.

Page 18: Quiz by Joseph Lindo

Page 18

Question20 . 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].lengthb.num.length*num[4].lengthc.num.length*num[5].lengthd.All of the abovee.None of the abovef. A and B onlyg. A and C only

Page 19: Quiz by Joseph Lindo

Page 19

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