Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 78
1-
What will be the output of the program, if a short int is 2 bytes wide?
#include<stdio.h>
int main()
{
short int i = 0;
for(i<=5 && i>=-1; ++i; i>0)
printf("%u,", i);
return 0;
}
A -
1 ... 65535
B -
Expression syntax error
C -
No output
D -
0, 1, 2, 3, 4, 5
2-
What will be the output of the program?
#include<stdio.h>
int main()
{
float a = 0.7;
if(0.7 > a)
printf("Hi\n");
else
printf("Hello\n");
return 0;
}
A -
Hi Hello
B -
Hi
C -
Hello
D -
None of above
3-
Which of the following statements are correct about an if-else statements in a C-program?
1: Every if-else statement can be replaced by an equivalent statements using ?: operators
2: Nested if-else statements are allowed.
3: Multiple statements in an if block are allowed.
4: Multiple statements in an else block are allowed.
A -
1 and 2
B -
2 and 3
C -
1, 2 and 4
D -
2, 3, 4
4-
Can we use a switch statement to switch on strings?
A -
Yes
B -
No
5-
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
printf("%f\n", sqrt(36.0));
return 0;
}
A -
6.0
B -
6
C -
6.000000
D -
Error: Prototype sqrt() not found.
6-
Is it true that too many recursive calls may result into stack overflow?
A -
Yes
B -
No
7-
A macro must always be defined in capital letters.
A -
True
B -
False
8-
In a macro call the control is passed to the macro.
A -
True
B -
False
9-
A header file contains macros, structure declaration and function prototypes.
A -
True
B -
False
10-
Which of the following function sets first n characters of a string to a given character?