Câu hỏi trắc nghiệm ngôn ngữ lập trình C (tiếp theo)
Code:
int i = 4;
switch (i)
{
default:
;
case 3:
i += 5;
if ( i == 8)
{
i++;
if (i == 9) break;
i *= 2;
}
i -= 4;
break;
case 8:
i += 5;
break;
}
printf("i = %d\n", i);
What will the output of the sample code above be?
Choice 1
i = 5
Choice 2
i = 8
Choice 3
i = 9
Choice 4
i = 10
Choice 5
i = 18
Q62:
Which one of the following C operators is right associative?
Choice 1
=
Choice 2
,
Choice 3
[]
Choice 4
^
Choice 5
->
Q63:
What does the "auto" specifier do?
Choice 1
It automatically initializes a variable to 0;.
Choice 2
It indicates that a variable's memory will automatically be preserved
Choice 3
It automatically increments the variable when used.
Choice 4
It automatically initializes a variable to NULL.
Choice 5
It indicates that a variable's memory space is allocated upon entry into the block.
Q64:
How do you include a system header file called sysheader.h in a C source file?
Choice 1
#include
Choice 2
#incl "sysheader.h"
Choice 3
#includefile
Choice 4
#include sysheader.h
Choice 5
#incl
Q65:
Which one of the following printf() format specifiers indicates to print a double value in decimal notation, left aligned in a 30-character field, to four (4) digits of precision?
Choice 1
%-30.4e
Choice 2
%4.30e
Choice 3
%-4.30f
Choice 4
%-30.4f [Ans] decimal notation
Choice 5
%#30.4f
Q66:
Code:
int x = 0;
for ( ; ; )
{
if (x++ == 4)
break;
continue;
}
printf("x=%d\n", x);
What will be printed when the sample code above is executed?
Choice 1
x=0
Choice 2
x=1
Choice 3
x=4
Choice 4
x=5
Choice 5
x=6
Q67:
According to the Standard C specification, what are the respective minimum sizes (in bytes) of the following three data types: short; int; and long?
Choice 1
1, 2, 2
Choice 2
1, 2, 4
Choice 3
1, 2, 8
Choice 4
2, 2, 4
Choice 5
2, 4, 8
Q68:
Code:
int y[4] = {6, 7, 8, 9};
int *ptr = y + 2;
printf("%d\n", ptr[ 1 ] ); /*ptr+1 == ptr[1]*/
What is printed when the sample code above is executed?
Choice 1
6
Choice 2
7
Choice 3
8
Choice 4
9
Choice 5
The code will not compile.
Q69:
penny = one
nickel = five
dime = ten
quarter = twenty-five
How is enum used to define the values of the American coins listed above?
Choice 1
enum coin {(penny,1), (nickel,5), (dime,10), (quarter,25)};
Choice 2
enum coin ({penny,1}, {nickel,5}, {dime,10}, {quarter,25});
Choice 3
enum coin {penny=1,nickel=5,dime=10,quarter=25};
Choice 4
enum coin (penny=1,nickel=5,dime=10,quarter=25);
Choice 5
enum coin {penny, nickel, dime, quarter} (1, 5, 10, 25);
Q70:
char txt [20] = "Hello world!\0";
How many bytes are allocated by the definition above?
Choice 1
11 bytes
Choice 2
12 bytes
Choice 3
13 bytes
Choice 4
20 bytes
Choice 5
21 bytes
NGUYỄN THỊ BẢO TRANG
» Tin mới nhất:
» Các tin khác: