0% found this document useful (0 votes)
34 views4 pages

MCQ Arrays

Isijs

Uploaded by

jchalikwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views4 pages

MCQ Arrays

Isijs

Uploaded by

jchalikwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SOLUTION – ARRAY BASED

WRITE the correct answer

Question 1

Which of the following is the correct usage while declaring array size?

1. int a[ ]=new int [-40]


2. int a[ ]=new int [40]
3. int a[ ]=new int [0 - 40]
4. None

Question 2

Which element is represented by a[10]?

1. 10th
2. 9th
3. 11th
4. None

Question 3

Cell numbers or index position of a dimensional array are also known as:

1. packets
2. blocks
3. subscripts
4. compartments

Question 4

A dimensional array is also known as:

1. subscripted variable
2. actual variable
3. compound variable
4. none

Question 5

An array element can be accessed through:

1. dots
2. element name
3. index number
4. none

Question 6
Indicate the error message which displays, if the following statement is executed :
int a[5] = {28,32,45,68,12};

1. Insufficient cells
2. Array index out of bounce
3. Elements exceeding cells
4. None

Question 7

The following statement :


int code[ ]= {25,37,38,42};

1. assigns 37 to code[1]
2. assigns 25 to code[1]
3. assigns 38 to code[3]
4. assigns 42 to code[0]

Question 8

The elements of array[50] are numbered:

1. from 1 to 50
2. from 0 to 49
3. from 1 to 51
4. none

Question 9

Which of the following function finds the size of array


char m[] = {'R', 'A', 'J', 'E', 'N', 'D', 'R', 'A' };?

1. m.size of (a)
2. m.elements of (m)
3. m.length
4. None

Question 10

A Single Dimensional array contains N elements. What will be the last subscript?

1. N-1
2. N
3. N+1
4. None
5.

Give the output of the following


Question 1

int m[] = {2,4,6,8};


System.out.println(m[1] + " " + m[2]);

Question 2

int a[] ={2,4,6,8,10};


a[0]=23;
a[3]=a[1];
int c= a[0]+a[1];
System.out.println("Sum = "+c);

Question 3

int a[]=new int [5];


a[0]=4; a[1]=8; a[2]=7; a[3]=12; a[4]=3;
System.out.println(a[2+1]);

Question 4

int a[4]={2,4,6,8};
for(i=0;i<=1;i++)
{
s=a[i]+a[3-i];
System.out.println(s);
}

You might also like