arrays

arrays

University

10 Qs

quiz-placeholder

Similar activities

OOP - Quiz

OOP - Quiz

University

15 Qs

SLG IPC Week 7

SLG IPC Week 7

University

13 Qs

Array Java

Array Java

University

15 Qs

Array

Array

University

12 Qs

Round 1 (Tech Utsav)

Round 1 (Tech Utsav)

University

15 Qs

IEEE Coding Competition

IEEE Coding Competition

University

13 Qs

Study Club

Study Club

University

10 Qs

Java arrays

Java arrays

University

7 Qs

arrays

arrays

Assessment

Quiz

Computers

University

Hard

Created by

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?

  1. class array_output

  2. {

  3. public static void main(String args[])

  4. {

  5. int array_variable [] = new int[10];

  6. for (int i = 0; i < 10; ++i)

  7. {

  8. array_variable[i] = i;

  9. System.out.print(array_variable[i] + " ");

  10. i++;

  11. }

  12. }

  13. }

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?