100 Multiple Choice Questions In C Programming – Part 4
This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
1. What does != ?
A equals
B different
C less
D complement
2. What is the problem when declaring the following variable?
float 4Room-Hall-Kitchen?;
A The variable name starts with an integer
B The special character “-”
C The special character “?”
D All the answers are true
3. What is the output of the following C program?
#include <stdio.h> int main() { int thisvariablename = 23; int ThisVariableName = 26; printf("%d", ThisVariableName); return 0; }
A The program displays 23
B The program displays 26
C The program displays a runtime error
D The program will cause a compilation error due to the re-declaration
4. After these operations, what will “res” be equal to?
int A = 4; Res = 5 + A++; Res += 2 + A; Res -= 4 + (--A) Res = Res + A++;
A 9
B 10
C 12
D 14
5. Which of these expressions should not be declared as a variable name?
A volatile
B export
C friend
D true
6. What is the output of the following C program?
#include <stdio.h> int main() { int a[4] = {1, 2, 3, 4}; int i; for (i = 0; i < 4; i++) if ((char)a[i] == '4') printf("%d\n", a[i]); else printf("FAIL\n"); }
A Compiler reports an error
B The program compiles and displays 4
C The program compiles and displays the ASCII value of 4
D The program compiles and displays FAIL 4 times
7. If the variable A = 0, what is the value of the variable B when the following code is executed?
if(A != 0) B=3; else B=0;
A B = 0
B B = 3
C Compilation error
D Will throw an exception
8. How to make the variable A be a true boolean if B contains at least 1?
A A = B > 1
B A = B !=1
C A = B > 0
D A = B >= 0
9. How many times do we get through the following loop?
int c = 10; do{ c++; printf("Hello World\n"); } while(c < 10);
A 0
B 1
C 9
D 10
10. The identifier ‘%i’ is also used for _____?
A char
B int
C float
D double