Arrays - General Questions Online Exam Quiz

Arrays - General Questions GK Quiz. Question and Answers related to Arrays - General Questions. MCQ (Multiple Choice Questions with answers about Arrays - General Questions

What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

Options

A : The element will be set to 0.

B : The compiler would report an error.

C : The program may crash if some important data gets overwritten.

D : The array size would appropriately grow.

View Answer

What does the following declaration mean? int (*ptr)[10];

Options

A : ptr is array of pointers to 10 integers

B : ptr is a pointer to an array of 10 integers

C : ptr is an array of 10 integers

D : ptr is an pointer to array

View Answer

In C, if you pass an array as an argument to a function, what actually gets passed?

Options

A : Value of elements in array

B : First element of the array

C : Base address of the array

D : Address of the last element of array

View Answer

Which of the following statements are correct about the C#.NET code snippet given below?

Options

A : 1, 2

B : 2, 3

C : 2, 5

D : 1, 4

View Answer

Which of the following statements are correct about the C#.NET code snippet given below?

Options

A : 1, 2

B : 2, 3, 4

C : 2, 3, 5

D : 4, 5

View Answer

Which one of the following statements is correct?

Options

A : Array elements can be of integer type only.

B : The rank of an Array is the total number of elements it can contain.

C : The length of an Array is the number of dimensions in the Array.

D : The default value of numeric array elements is zero.

View Answer

If a is an array of 5 integers then which of the following is the correct way to increase its size to 10 elements?

Options

A : int [] a = new int [ 5 ]; int [] a = new int [ 10 ];

B : int [] a = int [ 5 ]; int [] a = int [ 10 ];

C : int [] a = new int [ 5 ]; a.Length = 10 ;

D : int [] a = new int [ 5 ]; a = new int [ 10 ];

View Answer

How will you complete the foreach loop in the C#.NET code snippet given below such that it correctly prints all elements of the array a?

Options

A : foreach (int j = 1; j < a(0).GetUpperBound; j++)

B : foreach (int j = 1; j < a.GetUpperBound (0); j++)

C : foreach (int j in a.Length)

D : foreach (int j in i)

View Answer

Which of the following is the correct output of the C#.NET code snippet given below?

Options

A : 20

B : 4

C : 18

D : 10

View Answer

Which of the following statements are correct about arrays used in C#.NET?

Options

A : 1, 2

B : 1, 3, 5

C : 3, 4

D : 1, 2, 5

View Answer

Arrays - General Questions more Online Exam Quiz

Constructors and Destructors - General Questions

Functions - General Questions

Objects and Classes - General Questions

OOPS Concepts - General Questions

References - General Questions

Complicated Declarations - General Questions

Control Instructions - General Questions