700+ câu trắc nghiệm Ngôn ngữ lập trình C có đáp án - Phần 6
25 câu hỏi
Which is not a proper prototype?
int funct(char x, char y);
double funct(char x)
void funct();
char x();
Chọn đáp án B
What is the return type of the function with prototype: “int func(char x, float v, double t);”
char
int
float
double
Chọn đáp án B
Which of the following is a valid function call (assuming the function exists)?
funct;
funct x, y;
funct();
int funct();
Chọn đáp án C
Which of the following is a complete function?
int funct();
int funct(int x) {return x=x+1;}
void funct(int) {printf( “Hello” );
void funct(x) {printf( “Hello” ); }
Chọn đáp án B
What is required to avoid falling through from one case to the next?
end;
break;
stop;
continue;
Chọn đáp án B
What keyword covers unhandled possibilities?
all
continue
default
other
Chọn đáp án C
What is the result of the following code? void main() { int x = 0; switch(x) { case 1: printf( "One" ); case 0: printf( "Zero" ); case 2: printf( "Hello World" ); } }
One
Zero
Hello World
ZeroHello World
Chọn đáp án A
Which of the following is the proper declaration of a pointer?
int x;
int &x;
ptr x;
int *x;
Chọn đáp án D
Which of the following gives the memory address of integer variable a?
*a;
a;
&a;
address(a);
Chọn đáp án C
Which of the following gives the memory address of a variable pointed to by pointer a?
a;
*a;
&a;
address(a);
Chọn đáp án A
Which of the following gives the value stored at the address pointed to by pointer a?
a;
val(a);
*a;
&a;
Chọn đáp án C
Which of the following is the proper keyword or function to allocate memory in C?
new
malloc
create
value
Chọn đáp án B
Which of the following is the proper keyword or function to deallocate memory in C language?
free
delete
clear
remove
Chọn đáp án B
Which of the following accesses a variable in structure b?
b→var;
b>var;
b-var;
b>var;
Chọn đáp án B
Which of the following accesses a variable in a pointer to a structure, *b?
b→var;
b-var;
b>var;
b>var;
Chọn đáp án A
Which of the following is a properly defined struct?
struct {int a;}
struct a_struct {int a;}
struct a_struct int a;
struct a_struct {int a;};
Chọn đáp án D
Which properly declares a variable of struct foo?
struct foo;
struct foo var;
foo;
int foo;
Chọn đáp án B
Which of the following correctly declares an array?
int arr[10];
int arr;
arr{10};
array arr[10];
Chọn đáp án A
What is the index number of the last element of an array with 29 elements?
29
28
0
Programmer-defined
Chọn đáp án B
Which of the following is a two-dimensional array?
array arr[20][20];
int arr[20][20];
int arr[20, 20];
char arr[20];
Chọn đáp án B
Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?
foo[6];
foo[7];
foo(7);
foo;
Chọn đáp án A
Which of the following gives the memory address of the first element in array arr, an array with 100 elements?
arr[0];
arr;
&arr;
arr[1];
Chọn đáp án B
Which of the following is a string literal?
Static String
“Static String”
‘Static String’
char string[100];
Chọn đáp án B
What character ends all strings?
‘.’
‘ ‘
‘\0’
‘/0’
Chọn đáp án C
Which of the following reads in a string named x with one hundred characters?
fgets(x, 101, stdin);
fgets(x, 100, stdin);
readline(x, 100, ‘\n’);
read(x);
Chọn đáp án B








