Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 82
1-
Which of the following cannot be checked in a switch-case statement?
A -
Character
B -
Integer
C -
Float
D -
enum
2-
Point out the error, if any in the program.
#include<stdio.h>
int main()
{
int a = 10, b;
a >=5 ? b=100: b=200;
printf("%d\n", b);
return 0;
}
A -
100
B -
200
C -
Error: L value required for b
D -
Garbage value
3-
Which of the following statements are correct about the program?
#include<stdio.h>
int main()
{
int x = 30, y = 40;
if(x == y)
printf("x is equal to y\n");
else if(x > y)
printf("x is greater than y\n");
else if(x < y)
printf("x is less than y\n")
return 0;
}
A -
Error: Statement missing
B -
Error: Expression syntax
C -
Error: Lvalue required
D -
Error: Rvalue required
4-
What will be the output of the program?
#include<stdio.h>
int main()
{
int i=4, j=-1, k=0, w, x, y, z;
w = i || j || k;
x = i && j && k;
y = i || j &&k;
z = i && j || k;
printf("%d, %d, %d, %d\n", w, x, y, z);
return 0;
}
A -
1, 1, 1, 1
B -
1, 1, 0, 1
C -
1, 0, 0, 1
D -
1, 0, 1, 1
5-
Are the following two statement same?
1. a <= 20 ? (b = 30): (c = 30);
2. (a <=20) ? b : (c = 30);