Câu hỏi trắc nghiệm ngôn ngữ lập trình C (tiếp theo)
Which one of the following calls will open the file test.txt for reading by fgetc?
Choice 1
fopen( "test.txt", "r" );
Choice 2
read( "test.txt" )
Choice 3
fileopen( "test.txt", "r" );
Choice 4
fread( "test.txt" )
Choice 5
freopen( "test.txt" )
112:Code:
int m = -14;
int n = 6;
int o;
o = m % ++n;
n += m++ - o;
m <<= (o ^ n) & 3;
Assuming two's-complement arithmetic, which one of the following correctly represents the values of m, n, and o after the execution of the code above?
Choice 1
m = -26, n = -7, o = 0
Choice 2
m = -52, n = -4, o = -2
Choice 3
m = -26, n = -5, o = -2
Choice 4
m = -104, n = -7, o = 0
Choice 5
m = -52, n = -6, o = 0
113:
How do printf()'s format specifiers %e and %f differ in their treatment of floating-point numbers?
Choice 1
%e displays an argument of type double with trailing zeros; %f never displays trailing zeros.
Choice 2
%e displays a double in engineering notation if the number is very small or very large. Otherwise, it behaves like %f and displays the number in decimal notation.
Choice 3
%e always displays an argument of type double in engineering notation; %f always displays an argument of type double in decimal notation. [Ans]
Choice 4
%e expects a corresponding argument of type double; %f expects a corresponding argument of type float.
Choice 5
%e and %f both expect a corresponding argument of type double and format it identically. %e is left over from K&R C; Standard C prefers %f for new code.
114:
$$Except 1 all choices are O.K.$$
c = getchar();
What is the proper declaration for the variable c in the code above?
Choice 1
char *c;
Choice 2
unsigned int c;
Choice 3
int c;
Choice 4
unsigned char c;
Choice 5
char c;[Ans]
115:
Which one of the following will define a function that CANNOT be called from another source file?
Choice 1
void function() { ... }
Choice 2
extern void function() { ... }
Choice 3
const void function() { ... }
Choice 4
private void function() { ... }
Choice 5
static void function() { ... }
116. Which of the following are essential statement types for describing algorithms?
1.sequence
2.selection
3.repetition
What is a condition?
1.A value which is true or false
2.A numerical value
Which of the following are valid C++ identifiers?
1.const
2.y=z
.xyz123
Bill
4.ThisIsALongOne
5.Sue's
6.two-way
7. int
8.so_is_this_one
9. _amount
10.2ndclass
1.cin
2.cout
NGUYỄN THỊ BẢO TRANG
» Tin mới nhất:
» Các tin khác: