Multiple Choice Questions on C programming with answers

In this post, we have lay outed Top 20 multiple choice questions on c programming with answers. These important questions are taken from different topics. Answers of these questions are bold.

20 MCQ on C programming with answers

  1. #include <stdio.h>

    int  x = 100;
                int x = 200;
                printf(“%d”, x );               
    printf(“%d  ”, x );

The output of this program is:

 a) Will not work. main() is not included

 b) 100  100

 c) 200  100

 d) 100  200

2. Which of the following special symbol allowed in a variable name ?

 a) * (asterisk)

 b) | (pipeline)

 c) – (hyphen)

 d) _ (underscore)

3. Is the statement ” extern int i; ” a declaration or definition ?

 a) Declaration

 b) Definition

 c) Function

 d) Error

4. By default a real number is treated as a ________

 a) Float

 b) Double

 c) Long Double

 d) Far Double

5. What is the output of the program?


int main()


                extern int a;

                printf(“%d\n”, a);

                return 0;


int a=20;

 a) 20

 b) 0

 c) Garbage Value

 d) Error

6. Which of the following is the correct order of evaluation for the below expression?

z = x + y * z / 4 % 2 – 1

a)  * / % + – =

 b) = * / % + –

 c) / * % – + =

 d) * % / – + =

7. Which of the following is the correct usage of conditional operators used in C?

 a) a>b ? c=30 : c=40;

 b) a>b ? c=30;

c) max = a>b ? a>c?a:c:b>c?b:c

 d) return (a>b)?(a:b)

8. The value of EOF symbolic constant  is

 a) -1

 b) 1

 c) error

 d) -1,  but vary according to compiler

9. To scan a and b given below, which of the following scanf() statement will you use?


float a;

double b;

 a) scanf(“%f %lf”, &a, &b);

 b) scanf(“%f %f”, &a, &b);

 c) scanf(“%f %Lf”, &a, &b);

 d) scanf(“%Lf %Lf”, &a, &b);

10. In which order do the following gets evaluated

1. Relational

2. Arithmetic

3. Logical

4. Assignment

 a) 4,3,2,1

 b) 2,1,3,4

 c) 1,2,3,4

 d) 3,2,1,4

11. Which of the following statement is used to take the control to the beginning of loop

 a) exit

 b) break

 c) continue

 d) none of these

12. In a for loop, if the condition is missing, then?

 a) it is assumed to be present and taken to be false

 b) it results in the syntax error

 c) it is assumed to be present and taken to be true

 d) execution will be terminated abruptly  

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

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

15. Any C program

 a) Must contain at least one function

 b) Need not contain any function

 c) Needs input data

 d) None of above

16. Address stored in the pointer variable is of type __________

 a) Character

 b) Array

 c) Integer

 d) Floating

17. “*” is called as ___________

 a) Address Operator

 b) Scope Resolution Operator

 c) Value at Operator

 d) None of these

18. Comment on the following pointer declaration?

int *ptr, p;

 a) ptr is a pointer to integer, p is not.

 b) ptr and p, both are pointers to integer.

 c) ptr is pointer to integer, p may or may not be.

 d) ptr and p both are not pointers to integer.

19. Which of the following are correct syntaxes to send an array as a parameter to function

 a) func(&array);

 b) func(**array);

 c) func(*array);

 d) func(array[size]);

20. Which of the following is not possible in C?

 a) Array of function pointer

 b) Returning a function pointer

 c) Comparison of function pointer

 d) None of the mentioned

Thanks for solving the top 20 multiple choice questions on c programming with answers from our website.

Leave a Comment