Here are some MCQs on C-Programming
1. Which of the following is not a valid data type in C?
a) Double
b) Real
c) Float
d) Char
2. In C, what is the size of the character data type?
a) 2 bytes
b) 4 bytes
c) 8 bytes
d) 1 byte
3. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
printf(“%d”, sizeof(int));
return 0;
}
a) 4
b) 2
c) 8
d) 1
4. Which of the following is the correct syntax to declare a variable in C?
a) variableName variableType;
b) variableType variableName;
c) variableType = variableName;
d) variableName = variableType;
5. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int x = 5;
int y = 3;
printf(“%d”, x++ + –y);
return 0;
}
a) 6
b) 8
c) 7
d) 5