Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

C PROGRAM QUESTIONS : PART 14

Which of these best describes an array?

A data structure that shows a hierarchical behavior
Container of objects of similar types
Container of objects of mixed types
All of the mentioned
SHOW ANSWER

How do you initialize an array in C?

int arr[3] = (1,2,3);
int arr(3) = {1,2,3};
 int arr[3] = {1,2,3};
 int arr(3) = (1,2,3);
SHOW ANSWER

How do you instantiate an array in Java?

int arr[] = new int(3);
 int arr[];
 int arr[] = new int[3];
int arr() = new int(3);
SHOW ANSWER

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

int[][] arr;
 int arr[][];
 int []arr[];
All of the mentioned
SHOW ANSWER

What is the output of the following piece of code?
void main()
{
    int arr[]={1,2,3,4,5};
    printf("%d",arr[5]);
}

4
 5
ArrayIndexOutOfBoundsException
 InavlidInputException
SHOW ANSWER

When does the ArrayIndexOutOfBoundsException occur?

Compile-time
 Run-time
 Not an error
None of the mentioned
SHOW ANSWER

Which of the following concepts make extensive use of arrays?

Binary trees
Scheduling of processes
Caching
Spatial locality
SHOW ANSWER

What are the advantages of arrays?

Easier to store elements of same data type
Used to implement other data structures like stack and queue
Convenient way to represent matrices as a 2D array
All of the mentioned
SHOW ANSWER

What are the disadvantages of arrays?

We must know before hand how many elements will be there in the array
 There are chances of wastage of memory space if elements inserted in an array are lesser than than the allocated size
 Insertion and deletion becomes tedious
 All of the mentioned
SHOW ANSWER

Assuming int is of 4bytes, what is the size of int arr[15];?

15
 19
11
60
SHOW ANSWER

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

The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
SHOW ANSWER

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

ptr is array of pointers to 10 integers
ptr is a pointer to an array of 10 integers
ptr is an array of 10 integers
ptr is an pointer to array
SHOW ANSWER

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

Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in