Explore topic-wise MCQs in C Interview.

This section includes 278 Mcqs, each offering curated multiple-choice questions to sharpen your C Interview knowledge and support exam preparation. Choose a topic below to get started.

101.

What is the output of this C code? #include void main() { char a = 'a'; int x = (a % 10)++; printf("%d\n", x); }

A. 6
B. Junk value
C. Compile time error
D. 7
Answer» D. 7
102.

What is the output of this C code? #include void main() { int k = 8; int x = 0 == 1 && k++; printf("%d%d\n", x, k); }

A. 0 9
B. 0 8
C. 1 8
D. 1 9
Answer» C. 1 8
103.

What is the output of this C code? #include void main() { int x = 0; if (x = 0) printf("Its zero\n"); else printf("Its not zero\n"); }

A. Its not zero
B. Its zero
C. Run time error
D. None
Answer» B. Its zero
104.

What is the output of this C code? #include int main() { int a = 10; double b = 5.6; int c; c = a + b; printf("%d", c); }

A. 15
B. 16
C. 15.6
D. 10
Answer» B. 16
105.

What is the output of this C code? #include int main() { int a = 10, b = 5, c = 5; int d; d = a == (b + c); printf("%d", d); }

A. Syntax error
B. 1
C. 10
D. 5
Answer» C. 10
106.

What is the output of this C code?#include int main() { signed char chr; chr = 128; printf(

A. 128
B. -128
C. Depends on the compiler
D. None of the mentioned
Answer» C. Depends on the compiler
107.

The format identifier ‘%i’ is also used for _____ data type?

A. double
B. char
C. int
D. float
Answer» D. float
108.

Which among the following are the fundamental arithmetic operators, ie, performing the desired operation can be done using that operator only?

A. +, –
B. +, -, %
C. +, -, *, /
D. +, -, *, /, %
Answer» B. +, -, %
109.

Which of the following data type will throw an error on modulus operation(%)?

A. char
B. short
C. int
D. float
Answer» E.
110.

Which of the following is not an arithmetic operation?

A. a *= 10;
B. a /= 10;
C. a != 10;
D. a %= 10;
Answer» D. a %= 10;
111.

The precedence of arithmetic operators is (from highest to lowest)

A. %, *, /, +, –
B. %, +, /, *, –
C. +, -, %, *, /
D. %, +, -, *, /
Answer» B. %, +, /, *, –
112.

What is the output of this C code? #include void main() { int a = 3; int b = ++a + a++ + --a; printf("Value of b is %d", b); }

A. Value of x is 12
B. Value of x is 13
C. Value of x is 10
D. Undefined behaviour
Answer» E.
113.

What is the output of this C code? #include void main() { int y = 3; int x = 5 % 2 * 3 / 2; printf("Value of x is %d", x); }

A. Value of x is 1
B. Value of x is 2
C. Value of x is 3
D. Compile time error
Answer» B. Value of x is 2
114.

What is the output of this C code? #include void main() { int x = 5.3 % 2; printf("Value of x is %d", x); }

A. Value of x is 2.3
B. Value of x is 1
C. Value of x is 0.3
D. Compile time error
Answer» E.
115.

What is the output of this C code? #include int main() { int i = 5; i = i / 3; printf("%d\n", i); return 0; }

A. Implementation defined
B. 1
C. 3
D. Compile time error
Answer» C. 3
116.

What is the output of this C code? #include int main() { int i = -3; int k = i % 2; printf("%d\n", k); }

A. Compile time error
B. -1
C. 1
D. Implementation defined
Answer» C. 1
117.

What is the value of x in this C code? #include void main() { int x = 5 * 9 / 3 + 9; }

A. 3.75
B. Depends on compiler
C. 24
D. 3
Answer» D. 3
118.

What is the output of this C code? #include int main() { int i = 3; int l = i / -2; int k = i % -2; printf("%d %d\n", l, k); return 0; }

A. Compile time error
B. -1 1
C. 1 -1
D. Implementation defined
Answer» C. 1 -1
119.

What is the output of this C code? #include int main() { int i = -5; i = i / 3; printf("%d ", i); return 0; }

A. Implementation defined
B. -3
C. -1
D. Compile time error
Answer» D. Compile time error
120.

Range of unsigned int is?

A. 0 to 65,535 or 0 to 4,294,967,295
B. 0 to 65,535
C. 0 to 4,294,967,296
D. None
Answer» B. 0 to 65,535
121.

Data type qualifiers can be classified into?

A. 4
B. 5
C. 2
D. 8
Answer» D. 8
122.

Character literals in C syntax are?

A. A
B. ‘A’
C. “4”
D. None
Answer» C. “4”
123.

The C language defines ________ fundamental data types

A. 3
B. 4
C. 5
D. 6
Answer» C. 5
124.

What is Enum datatype syntax?

A. Enum[data type]{const1, const2, const3....}
B. Enum{const1, const2,....}
C. Enum[int datatype]
D. None
Answer» B. Enum{const1, const2,....}
125.

Sort int in C language is?

A. Basic Datatype of C
B. Qualifier
C. All of the mentioned
D. short is the qualifier and int is the basic datatype
Answer» E.
126.

The Format Identifier %u is used for?

A. Integer
B. Float
C. Decimal
D. Unsigned decimal
Answer» E.
127.

Size of an int data type is ________ ?

A. 4 Bytes
B. 8 Bytes
C. Depends on Compiler/System
D. Cannot be determined
Answer» D. Cannot be determined
128.

Which of the following is not a derived data type in c?

A. Function
B. Pointer
C. Enumeration
D. Array
Answer» D. Array
129.

Predict the output of following C program #include int main() { char a = '12'; printf("%d", a); return 0; }

A. Compiler Error
B. 12
C. 10
D. Empty
Answer» D. Empty
130.

Integral data type is _________?

A. Void
B. Char
C. Float
D. Double
Answer» C. Float
131.

Predict the output #include int main() { float c = 5.0; printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32); return 0; }

A. Temperature in Fahrenheit is 41.00
B. Temperature in Fahrenheit is 37.00
C. Temperature in Fahrenheit is 0.00
D. Compiler Error
Answer» C. Temperature in Fahrenheit is 0.00
132.

What will be the output of the following C code? #include int main() { float x = 'a'; printf("%f", x); return 0; }

A. a
B. run time error
C. a.0000000
D. 97.000000
Answer» E.
133.

Which of the following is not a valid declaration in C?

A. short int x;
B. signed short x;
C. short x;
D. All of the above
Answer» E.
134.

Which of the data types has the size that is variable?

A. int
B. struct
C. float
D. double
Answer» C. float
135.

What will be printed after execution of the following code?void main(){ int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]); }

A. Garbage Value
B. 5
C. 6
D. 0
Answer» E.
136.

What will be the output of the following C code? #include int main() { float f1 = 0.1; if (f1 == 0.1) printf("equal\n"); else printf("not equal\n"); }

A. equal
B. not equal
C. output depends on the compiler
D. none of the mentioned
Answer» C. output depends on the compiler
137.

What will be the output of the following C code on a 32-bit machine? #include int main() { int x = 10000; double y = 56; int *p = &x; double *q = &y; printf("p and q are %d and %d", sizeof(p), sizeof(q)); return 0; }

A. p and q are 4 and 4
B. p and q are 4 and 8
C. compiler error
D. p and q are 2 and 8
Answer» B. p and q are 4 and 8
138.

What will be the output of the following C code? #include int main() { float f1 = 0.1; if (f1 == 0.1f) printf("equal\n"); else printf("not equal\n"); }

A. equal
B. not equal
C. output depends on compiler
D. none of the mentioned
Answer» B. not equal
139.

What will be the output of the program ? #include int main() { int a[5] = {51, 1, 5, 20, 25}; int x, y, z; x = ++a[1]; y = a[1]++; z = a[x++]; printf("%d, %d, %d", x, y, z); return 0; }

A. 2, 3, 20
B. 2, 1, 5
C. 1, 2, 5
D. 3, 2, 5
Answer» E.
140.

What will be the output of the program ? #include int main() { printf(2+"C Programming MCQ on Study 2 Online\n"); return 0; }

A. C Programming MCQ on Study 2 Online
B. Programming MCQ on Study 2 Online
C. C Programming MCQ
D. MCQ on Study 2 Online
Answer» C. C Programming MCQ
141.

In C Programming, If we need to store word "INDIA" then syntax is as below –

A. char name[6] = {'I','N','D','I','A'};
B. char name[6] = {'I','N','D','I','A','\0'}
C. char name[6] = {"I","N","D","I","A"}
D. name = "INDIA"
Answer» C. char name[6] = {"I","N","D","I","A"}
142.

What will be the output of the program ? #include #include int main() { char str[] = "Study 2 Online\0 C Language MCQ\0"; printf("%s\n", str); return 0; }

A. Study 2 Online
B. Study 2 Online C Language MCQ
C. Study 2 Online\0 C Language
D. C Language MCQ
Answer» B. Study 2 Online C Language MCQ
143.

What will be the output of the program ? #include int main() { printf("Study 2 Online", " C Language MCQ\n"); return 0; }

A. Error
B. Study 2 Online
C. Study 2 Online C Language MCQ
D. C Language MCQ
Answer» C. Study 2 Online C Language MCQ
144.

For which of the following situation should the register storage class be used?

A. For local variable in a function
B. For loop counter
C. For collecting values returned from a function
D. For variables used in a recursive function
Answer» C. For collecting values returned from a function
145.

What will be the output of the program ? #include int main() { int i; char a[] = "\0"; if(printf("%s", a)) printf("empty string\n"); else printf("not empty string \n"); return 0; }

A. empty string
B. not empty string
C. No output
D. 0
Answer» C. No output
146.

What will be the output of the following code? #include< stdio.h> int main() { extern int a; static char j = ‘E’; printf(“%c %d”, ++j, ++a); return 0; }

A. E 2
B. F 1
C. F Garbage
D. F 0
Answer» C. F Garbage
147.

Where will the space be allocated for an automatic storage class variable?

A. In CPU register
B. In memory as well as in CPU register
C. In memory
D. On disk
Answer» D. On disk
148.

What will be the output of the following program? #include< stdio.h> int main() { register int I = 2; static char ch = ‘A’; auto float j; int k; k = ++ch && I; k = ++ch; j = i-- + ++k * 2; printf(“%d %f”, k , j); return 0; }

A. B 3
B. 65 138.000000
C. 68 138.000000
D. A 138
Answer» D. A 138
149.

In case of a conflict between the names of a local and global variable what happens?

A. The global variable is given a priority.
B. The local variable is given a priority.
C. Which one will get a priority depends upon which one is defined first
D. The compiler reports an error.
Answer» C. Which one will get a priority depends upon which one is defined first
150.

Which is not a storage class?

A. Auto
B. Struct
C. Typedef
D. Static
Answer» C. Typedef