100 Multiple Choice Questions In C Programming – Part 13
This collection of 100 Multiple Choice Questions and Answers (MCQs) In C Programming : Quizzes & Practice Tests with Answer focuses on “C Programming”.
1. Which keyword is used to prevent any modification of a variable in a C program?
A volatile
B const
C immutable
D mutable
2. Which of the following is not a declaration of a pointer?
A char *str;
B char a[10];
C char a;
D char a[] = {‘10’, ‘20’, ‘30’, ‘40’};
[st_adsense]
3. What is the output of the following C program?
#include <stdio.h> void main() { int var = 6; float var = 6; printf("%d", var ) }
A 6.0000000
B 6.8
C 6
D Compilation error
4. Which statement is false?
A A variable refers to a position in the memory
B A variable must be declared and defined at the same time
C A single variable cannot be defined with two different types in the same scope
D A variable that has been defined previously can be defined again with a different scope
5. Can a variable declared in a function be used in the main() function?
A False
B True
C True if it is declared static
D True if it is declared static
[st_adsense]
6. The variable name used in one function cannot be used in another function?
A False
B True
C Maybe
D None of the above
7. What is the output of the following C program?
#include <stdio.h> int main() { enum {STRAWBERRY = 6, BANANA, APPLE = 2, AUBERGINE}; printf("AUBERGINE = %d\n", AUBERGINE); }
A AUBERGINE = 3
B AUBERGINE = 2
C AUBERGINE = 6
D AUBERGINE = 7
8. What is the output of the following C program?
#include <stdio.h> int main() { printf("C Programming %s", "Function by\n%s StackHowTo", "WWW"); }
A
C Programming Function by WWW StackHowTo
B
C Programming Function by\n%s StackHowTo
C
C Programming Function by %s StackHowTo
D Compilation error
[st_adsense]
9. The pointer “str” contains a reference to which string ____?
char * str = "Hello\0" "World!";
A Hello
B Hello\0world!
C Helloworld!
D Invalid statement
10. What is the output of the following C program?
#include <stdio.h> #define x 20 int main() { const int x = 7; printf("x = %d\n", x); }
A x = 7
B x = 20
C Compilation error
D Runtime error