C Language - Arrays

You Are Here :: Home > C Language > Arrays - General Questions

 
1.

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


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




2.

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

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




3.

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

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




4.

Which of the following statements mentioning the name of the array begins DOES NOT yield the base address?

A: When array name is used with the sizeof operator.
B: When array name is operand of the & operator.
C: When array name is passed to scanf() function.
D: When array name is passed to printf() function.

A. A B. A,B
C. B D. B,D




5.

Which of the following statements are correct about 6 used in the program?

int num[6];
num[6]=21;

A. In the first statement 6 specifies a particular element, whereas in the second statement it specifies a type B. In the first statement 6 specifies a array size, whereas in the second statement it specifies a particular element of array
C. In the first statement 6 specifies a particular element, whereas in the second statement it specifies a array size D. In both the statement 6 specifies array size




6.

Which of the following statements are correct about an array?

1: The array int num[26]; can store 26 elements.
2: The expression num[1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num[SIZE] is allowed if SIZE is a macro.

A. 1 B. 1,4
C. 2,3 D. 2,4




1

2

3

4

5

6

7

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on