1. Which of these best describes an array?
a) A data structure that shows a hierarchical behavior
b) Container of objects of similar types
c) Container of objects of mixed types
d) All of the mentioned

2. What is the output of the following piece of code?

public class array
{
	public static void main(String args[])
	{
		int []arr = {1,2,3,4,5};
		System.out.println(arr[5]);
	}
}

a) 4
b) 5
c) ArrayIndexOutOfBoundsException
d) InavlidInputException

3. Assuming int is of 4bytes, what is the size of int arr[15];?
a) 15
b) 19
c) 11
d) 60

4. Which of the following is a correct way to declare a multidimensional array in Java?

A.) int[][] arr;   

B.) int arr[][];   

C.) int []arr[]; 

  D.) All of the mentioned

  • 5. Which of the following is a correct way to declare a multidimensional array in Java?

A.) int[][] arr;  

 B.) int arr[][];  

 C.) int []arr[];   

D.) All of the mentioned

6 – An algorithm is

A – a piece of code to be executed .

B – a loosely written code to make final code.

C – a step by step procedure to solve problem.

D – all of the above.

7. What is the order of a matrix?
a) number of rows X number of columns
b) number of columns X number of rows
c) number of rows X number of rows
d) number of columns X number of columns

8. Select the code snippet which performs matrix multiplication.(a and b are the two given matrices, resultant marix is c)
a)

for (int i = 0; i < n; i++)
{
    for (int j = 0; j < n; j++)
    {
        for (int k = 0; k < n; k++)
        {
            c[i][j] = c[i][j] + a[i][k] * b[k][j];
        }
    }
}

b)

for (int i = 0; i < n; i++)
{
    for (int j = 0; j < n; j++)
    {
        for (int k = 0; k < n; k++)
        {
            c[i][j] = c[i][j] * a[i][k] * b[k][j];
        }
    }
}

c)

for (int i = 0; i < n; i++)
{
    for (int j = 0; j < n; j++)
    {
        for (int k = 0; k < n; k++) 
        {
            c[i][j] = c[i][j] + a[i][k] + b[k][j];
        }
    }
}

d) None of the mentioned