C MCQ 1
C MCQ 1
sl no question option1
1 Which of the following is not a valid C variable name? a) int number;
2 Which is valid C expression? a) int my_num =
a) volatile
3 Which of the following cannot be a variable name in C?
4 Which of following is not accepted in C? a) static a = 10;
5 What is #include <stdio.h>? a) Preprocessor
a) #
#include <stdio.h>
int main()
{
int y = 10000; a) Compile
int y = 34; time error
printf("Hello World! %d\n", y);
return 0;
8 }
#include <stdio.h>
int main()
{ a) It will cause
int main = 3; a compile-time
printf("%d", main); error
return 0;
}
9
#include <stdio.h>
int main()
{
signed char chr;
chr = 128; a) 128
printf("%d\n", chr);
return 0;
10 }
#include <stdio.h>
void main()
{
float x;
int y;
printf("enter two numbers \n", x); a) 7.000000, 7
scanf("%f %f", &x, &y);
printf("%f, %d", x, y);
11 }
#include <stdio.h>
void main()
{ a) returns 1
1 < 2 ? return 1: return 2;
12 }
#include <stdio.h>
int main() {
int a = 3, b = 5;
int t = a;
a = b;
b = t;
printf("%d %d", a, b);
return 0;
13 } 35
14 4
A)
/*printf("Hello
C..");
printf("How
are you.");
A) C++ Style
Comment
A) int myage =
10;
int my_age =
21 Choose a right statement. 10;
int main()
{
int a=0;
a =20;
printf("%d",intmain());
return 0;
22 } a)20
return 0;
23 } a. 4 0
a) 0 to 256
25 a) \a
a) Single
26 quotes
27 a) ‘’
28 a) 8
29 a) 1 byte
The size of a String variable is
30 a) 1 byte
c question
option2 option3 option4 ans focus
b) float rate; c) int variable_count; d) int $main; d basic
b) int my_num = 100000; c) int my num = 1000; d) int $my_num = 10000; b basic
b) $ c) ” ” d) & a basic
b) Hello World! 34 c) Hello World! 1000 d) Hello World! followed bya basic
c) Depends on the
b) -128 compiler d) None of the mentioned b basic
b) Run time error c) 7.000000, junk d) Varies c basic
33 55 53 53 basic
8 2 1 4 basic
}
is a mandatory
function to be included
B) <stdio.h> is a header file with predin every C Program. D) All the above D basic
C) /*printf("Hello C..");
printf("How are D) /printf("Hello C..");/
B) //printf("Hello C..");printf("How aryou.");*/ printf("How are you."); b basic
B) Java Style Comment C) PHP Style Comment D) All the above D basic
b) \b c) \m d) \n a basic
b) 16 c) 32 d) 64 a basic