C Programming 4

Lets Crack Online Exam

IT Interview Exam Questions: C Programming 4 (IT Interview Exam Question, IT Campus Placement)

Subject: C Programming 4

Part 4: List for questions and answers of C Language


Q1. int warr[3][2][2]={1,2,3,4,5,6,7,8,9,10,11,12}; What will be the value of warr[2][1][0]?

a) 5

b) 7

c) 9

d) 11


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

a) The compiler would report an error

b) The program may crash if some important data gets overwritten

c) The array size would appropriately grow

d) The element will be set to 0


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

a) ptr is a pointer to an array of 10 integers

b) ptr is array of pointers to 10 integers

c) ptr is an array of 10 integers

d) ptr is an pointer to array


Q4. 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


Q5. What will be the output of the program?


int main()


    int a[5] = {5, 1, 15, 20, 25};

    int i, j, m;

    i = ++a[1];

    j = a[1]++;

    m = a[i++];

    printf(“%d, %d, %d”, i, j, m);

    return 0;


a) 2, 1, 15

b) 1, 2, 5

c) 3, 2, 15

d) 2, 3, 20 


Q6. set of consecutive memory locations is called as ________

a) Function

b) Array

c) Pointer

d) Loop


Q7. Array can be considered as set of elements stored in consecutive memory locations but having __________

a) Same Data Type

b) Different Data Type

c) Same Scope

d) None of these


Q8. Smallest element of an array is called as _______

a) Upper Bound

b) Range

c) Lower Bound

d) Middle Bound


Q9. consider, int arr[6]; then which of the following array element is considered as last array element ?

a) arr[6]

b) arr[4]

c) arr[5]

d) arr[0]


Q10. Array which is having ____ dimensions is called as 2-D array

a) 5

b) 2

c) 4

d) 3


Q11. What is maximum dimension that array can have in c programming ?

a) 3

b) 4

c) Theoretically No Limit but practically limit depends on memory

d) 2 


Q12. Array with last element ‘n’ will always have array size equal to _______

a) n+n

b) n

c) n-1

d) n+1


Q13. Array is ______ data type in C Programming language

a) Primitive Data Type

b) None of these

c) Derived Data Type

d) Custom Data Type


Q14. In order to access any element of an array if the position of element is known , Time complexity will be equal to _________

a) O(n)

b) O(1)

c) O(n-1)

d) O(n2)


Q15. What is the output of the code given below?

#include <stdio.h>

int main()

{ int ary[4] = {1, 2, 3, 4};

int *p = ary + 3; printf(“%d %d\n”, p[-2], ary[*p]);}

a) 2 3

b) Compile time error

c) 2 4

d) 2 somegarbagevalue


Q16. What will be the output of the program if the array begins 1200 in memory?


int main()


    int arr[]={2, 3, 4, 1, 6};

    printf(“%u, %u, %u\n”, arr, &arr[0], &arr);

    return 0;


a) 1200, 1202, 1204

b) 1200, 1200, 1200

c) 1200, 1204, 1208

d) 1200, 1202, 1200


Q17. Which of the following correctly declares an array?

a) int anarray[10];

b) int anarray;

c) anarray{10};

d) array anarray[10]; 


Q18. Which of the following gives the memory address of the first element in array foo, an array with 100 elements?

a) foo[0];

b) foo;

c) &foo;

d) foo[1];


Q19. Disadvantage of array in C is

a) We can easily access each element

b) It is necessary to declare too many variables

c) It can store only one similar type of data

d) None of above


Q20. Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?

a) foo[6];

b) foo[7];

c) foo(7);

d) foo; 


Part 4: List for questions and answers of C Language


Q1. Answer: d


Q2. Answer: b


Q3. Answer: a


Q4. Answer: c


Q5. Answer: a


Q6. Answer: b


Q7. Answer: a


Q8. Answer: c


Q9. Answer: c


Q10. Answer: b


Q11. Answer: c


Q12. Answer: d


Q13. Answer: c


Q14. Answer: b


Q15. Answer: d


Q16. Answer: b


Q17. Answer: a


Q18. Answer: b


Q19. Answer: c


Q20. Answer: a