100 Multiple Choice Questions In C Programming – Part 6
This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
1. In which case the return statement is not mandatory?
A When the function takes no input parameters
B When the function return void
C When the function must return 0
D None of the above
2. What are the parameters of a function?
A Hints on the name of the function
B Details of the value it should return
C Variables that are sent to it and used in its processing
D None of the above
[st_adsense]
3. Which of the following statements is false?
A A function does not have to return a value
B A function can return a value of any type
C A function can return multiple values
D None of the above
4. What is the output of the following C program?
#include <stdio.h> int main() { int x = 20000; double y = 26; int *p = &x; double *q = &y; printf("The size of p = %d and q = %d", sizeof(p), sizeof(q)); return 0; }
A The size of p = 4 and q = 4
B The size of p = 4 and q = 8
C erreur de compilation
D The size of p = 8 and q = 8
4. Which conversion is correct regarding the size of the data types?
A char > int > float
B int > char > float
C char < int < double
D double > char > int
[st_adsense]
5. What is a global variable?
A A variable that accessible everywhere
B A variable that can accept any type (int, float, char…)
C A variable declared in the main function
D None of the above
6. What is the output of the following C program (on a 64-bit machine)?
#include <stdio.h> union S { int a; char b; }; int main() { union S s; printf("%d", sizeof(s)); return 0; }
A 8
B 5
C 9
D 4
7. What is the output of the following C program?
#include <stdio.h> int main() { float y = 'a'; printf("%f", y); return 0; }
A a
B runtime error
C a.0000000
D 97.000000
[st_adsense]
8. Which of these data types has a variable size?
A int
B struct
C float
D double
9. How to include a standard library?
A #include <windows.h>
B #include "windows.h"
C #include [windows.h]
D #include {windows.h}
10. What is the output of the following C program?
#include <stdio.h> void main() { float a = 0.2; if (a == 0.2) printf("OK"); else printf("KO"); }
A KO
B OK
C Runtime error
D Compilation error
[st_adsense]