
arrays

Quiz
•
Computers
•
University
•
Hard
PUSHPALATHA C2114
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
1. Which of these operators is used to allocate memory to array variable in Java?
a) malloc
b) alloc
c) new
d) new malloc
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
2. Which of these is an incorrect array declaration?
a) int arr[] = new int[5]
b) int [] arr = new int[5]
c) int arr[] = new int[5]
d) int arr[] = int [5] new
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3. Which of these is necessary to specify at time of array initialization?
a) Row
b) Column
c) Both Row and Column
d) None of the mentioned
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
4. Which of these is an incorrect Statement?
a) It is necessary to use new operator to initialize an array
b) Array can be initialized using comma separated expressions surrounded by curly braces
c) Array can be initialized when they are declared
d) None of the mentioned
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
5.What will be the output of the following Java code?
class array_output
{
public static void main(String args[])
{
int array_variable [] = new int[10];
for (int i = 0; i < 10; ++i)
{
array_variable[i] = i;
System.out.print(array_variable[i] + " ");
i++;
}
}
}
a) 0 2 4 6 8
b) 1 3 5 7 9
c) 0 1 2 3 4 5 6 7 8 9
d) 1 2 3 4 5 6 7 8 9 10
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
6.What is the index range for the elements of an array in Java?
a) 0 to length - 1
b) 1 to length
c) -1 to length - 1
d) 0 to length
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
7.What happens if you try to access an array element with an index that is out of bounds?
a) A runtime exception is thrown
b) The program terminates abruptly
c) The element value is set to null
d) The element value is set to 0
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Java Quiz based on array

Quiz
•
University
10 questions
C++ Array

Quiz
•
University
15 questions
Trắc nghiệm kiến thức Java Core - Phần I

Quiz
•
University
15 questions
Data Analytics using Python - Quiz 2

Quiz
•
University
10 questions
DAA Quiz 1

Quiz
•
University
15 questions
module3

Quiz
•
University
10 questions
Core Java

Quiz
•
University
10 questions
Initiation à la programmation 5 : les tableaux

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

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

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

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

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University