By OnlineInterviewQuestions.
com
C Programming MCQ
Take C Programming MCQ Test to Test Your Knowledge
Practice here the most popular C Programming MCQ Questions, that checks your basic knowledge of C
Programming. This C Programming Quiz contains 25+ Multiple Choice Questions. Select the right answer to
check your final preparation for your exam or interviews.
Q1. Can we declare function inside structure of c programming?
A. Yes
B. No
Q2. Which of the following cannot be a structure member?
A. Array
B. Function
C. Another structure
D. None of the Above
Q3. ............. is the father of C language
A. James Gosling
B. Dennis Ritchie
C. Rasmus Lerdorf
D. None of the Above
Q4. Which of the following is not a valid variable name in C Programming?
A. float rate;
B. int $main;
C. int number;
D. None of the Above
Q5. Which of the following declaration is not supported by C language?
A. char *str;
B. float str = 3e2;
C. String str;
D. None of the Above
Q6. ............... keyword is used to prevent any changes in the variable within a C program.
A. const
B. volatile
C. mutable
D. immutable
Q7. What is the output of the following C code?
#include <stdio.h>
int const print()
{
printf("Conaxweb.com");
return 0;
}
void main()
{
print();
}
A. Conaxweb.com is printed infinite times
B. No Output
C. Conaxweb.com
D. Error because function name cannot be preceded by const
Q8. What is the output of the following C function?
#include <stdio.h>
void reverse(int i);
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
return ;
printf("%d ", i);
return reverse((i++, i));
A. Compilation error
B. 1 2 3 4 5
C. Segmentation fault
D. None of the Above
Q9. scanf() is a predefined function in stdio. h header file.
A. True
B. False
Q10. The C-preprocessors are specified with ...............
A. ” ”
B. &
C. $
D. #
Q11. What is the output of following C Code?
#include <stdio.h>
int main()
{
int i = 0;
do
{
i++;
if (i == 2)
continue;
printf("In while loop ");
} while (i < 2);
printf("%d\n", i);
}
A. Infinite loop
B. In while loop 3
C. In while loop 2
D. In while loop in while loop 3
Q12. Which of the following is an array initialized in C language?
A. int a = {1, 2, 3};
B. int a[3] = {1, 2, 3};
C. int a[ ] = new int [3]
D. None of the Above
Q13. What is the return type of the fopen() function in C?
A. An integer
B. Pointer to an integer
C. Pointer to a FILE Object
D. None of the above
Q14. How to find the length of an array in C?
A. sizeof(a)
B. sizeof(a[0])
C. sizeof(a) * sizeof(a[0])
D. sizeof(a) / sizeof(a[0])
Q15. What will be the output of the following code snippet?
#include <stdio.h>
union School {
int age, rollNo;
double marks;
};
void solve() {
union School sc;
sc.age = 19;
sc.rollNo = 82;
sc.marks = 19.04;
printf("%d", (int)sizeof(sc));
}
int main() {
solve();
return 0;
}
A. 4
B. 8
C. 12
D. 16
Q16. Directives are translated by the ....................
A. Linker
B. Editor
C. Compiler
D. Pre-processor
Q17. ........... can be used with vectors.
A. Forward iterator
B. Random access iterator
C. Bi-directional iterator
D. All of the Above
Q18. Which of the following is valid expression in c language?
A. int my num = 1000;
B. int my num == 10000;
C. int my_num = 100,000;
D. int my_num = 100000;
Q19. Which of the following is the first operating system designed using C programming
language?
A. Mac
B. DOS
C. Windows
D. Unix
Q20. Which of the following is not a correct variable type?
A. float
B. int
C. real
D. double
Q21. Select the wrong option about structs in C.
A. No data hinding
B. Constructors are not allowed inside structs.
C. Functions are not allowed inside structs.
D. None of the above
Q22. Which of the following data structure is used to handle recursion in C?
A. Trees
B. Stack
C. Deque
D. Queue
Q23. .................. is not a storage class specifier in C?
A. static
B. extern
C. volatile
D. None of the above
Q24. Function overloading is not possible in which programming language?
A. C
B. Java
C. Python
D. C#
Q25. Choose the correct syntax for double pointer in C?
A. int **val
B. int *val
C. int *&val
D. None of the above
Q26. Select the proper syntax for declaring macros in C.
A. #define II
B. #define long long
C. #define II long long
D. None of the above
Please Visit OnlineInterviewquestions.com to download more pdfs