Search Header Logo

arrays

Authored by PUSHPALATHA C2114

Computers

University

Used 1+ times

arrays
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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 

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?