
Arrays
Quiz
•
Computers
•
1st Grade
•
Medium
Jose Diaz
Used 4+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
for(String[] row : table){
System.out.print(row[row.length]);
}
int i = 0;
for(String[] col : table){
i++;
if(i==col.length){
System.out.print(table[col.length][i]);
}
}
for(var row : table){
System.out.print(row[row.length-1]);
}
for(int i=0; i<table.length-1; i++){
int j = table[i].length-1;
System.out.print(table[i][j]);
}
2.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
The code will print i = 1 iArr[0] = 1
The code will print i = 1 iArr[0] = 2
The code will print i = 2 iArr[0] = 1
The code will print i = 2 iArr[0] = 2
The code will not compile.
3.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
111
222
It will not compile as bA[0] is uninitialized.
It will throw an exception at runtime.
None of the above.
4.
MULTIPLE SELECT QUESTION
3 mins • 1 pt
Which of the following is/are valid instantiations and initializations of a multi dimensional array?. Please select 2 options.
var array2D = { { 0, 1, 2, 4}, {5, 6}}
int[][][] array3D = {{0, 1}, {2, 3}, {4, 5}};
int[] array2D[] = new int [2] [2];
array2D[0] [0] = 1;
array2D[0] [1] = 2;
array2D[1] [0] = 3;
int[][] array2D = new int[][]{0, 1};
int[] arr = {1, 2};
int[][] arr2 = {arr, {1, 2}, arr};
int[][][] arr3 = {arr2};
5.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
It will throw an ArrayIndexOutOfBoundsException at Runtime.
It will throw a NullPointerException at Runtime.
It will compile and run without throwing any exceptions
It will compile and throw a NullPointerException at runtime if var ia[][] = { {1, 2}, null }; is replaced with var ia = new int[][]{ {1, 2}, null };.
It will compile and throw a NullPointerException at runtime if var ia[][] = { {1, 2}, null }; is replaced with var ia[][] = new int[][]{ {1, 2}, null };.
6.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
It will throw NullPointerBoundsException.
It will throw ArrayIndexOutOfBoundsException.
It will print null.
It will run without any error but will print nothing.
None of the above.
7.
MULTIPLE CHOICE QUESTION
3 mins • 1 pt
Please select 1 option.
The program will fail to compile, because of uninitialized variable 'bool'.
The program will throw a java.lang.NullPointerException when run.
The program will print "0 null false".
The program will print "0 null true".
The program will print null and false but will print junk value for ia[0].
8.
MULTIPLE SELECT QUESTION
3 mins • 1 pt
Which of the following option(s) correctly declare(s) a variable that can directly reference an array of 10 ints?. Please select 2 options.
int[ ] iA
int[10] iA
int iA[ ]
Object[ ] iA
Object[10] iA
9.
MULTIPLE SELECT QUESTION
3 mins • 1 pt
Which of these array declarations and instantiations are legal? . Please select 4 options.
int[ ] a[ ] = new int [5][4] ;
int a[ ][ ] = new int [5][4] ;
int a[ ][ ] = new int [ ][4] ;
int[ ] a[ ] = new int[4][ ] ;
int[ ][ ] a = new int[5][4] ;
Similar Resources on Wayground
14 questions
Statistics For Data Science
Quiz
•
1st - 3rd Grade
10 questions
Competitive Programming
Quiz
•
1st Grade
10 questions
6 сынып PYTHON тілінде программалау
Quiz
•
1st Grade
10 questions
Introduction to Python - Input, Output and Math
Quiz
•
1st - 6th Grade
7 questions
Repaso conceptual y práctico
Quiz
•
1st - 12th Grade
10 questions
6 класс тест повторение 3 четверти
Quiz
•
1st Grade
5 questions
ADT insert Graph
Quiz
•
1st Grade
10 questions
Q3 ADT ArrayList
Quiz
•
1st Grade
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
ELA Advisory Review
Quiz
•
7th Grade
15 questions
Subtracting Integers
Quiz
•
7th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
Discover more resources for Computers
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
18 questions
D189 1st Grade OG 1c Concept 37-38
Quiz
•
1st Grade
20 questions
addition
Quiz
•
1st - 3rd Grade
20 questions
Subject and predicate in sentences
Quiz
•
1st - 3rd Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
10 questions
Exploring Force and Motion Concepts
Interactive video
•
1st - 5th Grade
10 questions
Exploring Properties of Matter
Interactive video
•
1st - 5th Grade
5 questions
Sense and Response
Quiz
•
1st Grade