
Java-Day2

Quiz
•
Computers
•
University
•
Hard
Anisha SET
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the following declaration, which expression returns the size of the array,
assuming the array has been initialized?
int[] array;
Select the one correct answer
array[].length()
array.length()
array[].length
array.length
array[].size()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Is it possible to create arrays of length zero?
Select the one correct answer.
Yes, you can create arrays of any type with length zero.
Yes, but only for primitive data types.
Yes, but only for arrays of reference types.
No, you cannot create zero-length arrays, but the main() method may be passed
a zero-length array of Strings when no program arguments are specified.
No, it is not possible to create arrays of length zero in Java
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which one of the following array declaration statements is not legal?
Select the one correct answer
int []a[] = new int [4][4];
int a[][] = new int [4][4];
int a[][] = new int [][4];
int []a[] = new int [4][];
int [][]a = new int [4][4];
4.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Which of these array declaration statements are not legal?
Select the two correct answers.
int[] i[] = { { 1, 2 }, { 1 }, {}, { 1, 2, 3 } };
int i[] = new int[2] {1, 2};
int i[][] = new int[][] { {1, 2, 3}, {4, 5, 6} };
int i[][] = { { 1, 2 }, new int[ 2 ] };
int i[4] = { 1, 2, 3, 4 };
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What would be the result of compiling and running the following program?
The code will not compile, because the array type int[] is incorrect.
The program will compile, but will throw an ArrayIndexOutOfBoundsException
when run.
The program will compile and run without error, but will produce no output.
The program will compile and run without error, and will print the numbers
0 through 19.
The program will compile and run without error, and will print 0 twenty
times
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What would be the result of compiling and running the following program?
The program will fail to compile because of uninitialized variables.
The program will throw a java.lang.NullPointerException when run.
The program will print: 0 false NaN null.
The program will print: 0 false 0 null.
The program will print: null 0 0 null.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be printed when the following program is run?
0
1
2
3
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Zenorix 2023

Quiz
•
University
15 questions
Java Method

Quiz
•
University
10 questions
exception

Quiz
•
University
20 questions
Python Recap

Quiz
•
7th Grade - University
13 questions
C programming-1

Quiz
•
University
12 questions
Quiz 9: Pointer

Quiz
•
University
10 questions
Array in C

Quiz
•
University
20 questions
Templates,Exceptions,Inheritance in C++ Quiz

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University