100 Multiple Choice Questions In C Programming – Part 12
This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
1. What is the name of the #include at the beginning of a code?
A Procedure directives
B Preprocessor directives
C Program directors
D All the answers are true
2. Why do I need a pointer?
A Set the value of a variable
B To access the RAM address of a variable
C Change the RAM address of a variable
D All the answers are true
3. What is the output of the following C program?
#include <stdio.h>
void myFunction(const int *);
int main()
{
const int i = 20;
printf("%d ", i);
myFunction(&i);
printf("%d", i);
}
void myFunction(const int *i)
{
*i = 30;
}
A 20
B 20 30
C Compilation error
D Undefined value
4. What is the output of the following C program?
#include <stdio.h>
int main()
{
const int i = 20;
int *ptr = &i;
*ptr = 30;
printf("%d\n", i);
return 0;
}
A Compilation error
B Display “Warning” and 30
C Will throw an exception
D 20
5. What is the output of the following C program?
#include <stdio.h>
int main()
{
a = 5;
printf("%d\n", a++);
return 0;
}
A 0
B 5
C 6
D Compilation error
6. Does it compile without errors?
#include <stdio.h>
int main()
{
for (int i = 0; i < 5; i++);
return 0;
}
A Depends on the C standard implemented by the compilers
B Yes
C No
D None of the above
7. Does it compile without errors?
#include <stdio.h>
int main()
{
int i;
{
int i;
for (i = 0; i < 5; i++);
}
}
A Depends on the C standard implemented by the compilers
B Yes
C No
D None of the above
8. Which of the following statements is not supported by C?
A float str = 6e3;
B String str;
C char *str;
D Both A and B
9. Which of the following format identifiers cannot be used for the variable ‘var’?
#include <stdio.h>
int main()
{
char *var = "Welcome to StackHowTo!";
}
A %s
B %f
C %d
D %c
10. Which of the following statements is incorrect?
A char[] str = “Hello world!”;
B char *str = “Hello world!”;
C char str[25] = “Hello world!”;
D char str[] = “Hello world!”;


