Câu hỏi trắc nghiệm ngôn ngữ lập trình C (tiếp theo)
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;
What number will z in the sample code above contain?
Choice 3 10
Q12:
With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?
Q13:
void *ptr;
myStruct myArray[10];
ptr = myArray;
Which of the following is the correct way to increment the variable "ptr"?
Q14:
char* myFunc (char *ptr)
{
ptr += 3;
return (ptr);
}
int main()
{
char *x, *y;
x = "HELLO";
y = myFunc (x);
printf ("y = %s \n", y);
return 0;
}
What will print when the sample code above is executed?
Q15:Code: int z,x=5,y=-10,a=4,b=2;
z=x++ - --y *b/a;
What number will z in the sample code above contain?
Choice 1
5
Choice 2
6
Choice 3
10
Choice 4
11
Choice 5
12
Q16:
If a program compiles fine, but it produces incorrect result, then the program suffers __________.
A. a compilation error
B. a runtime error
C. a logic error
Q17:
With every use of a memory allocation function, what function should be used to release allocated memory which is no longer needed?
Choice 1
unalloc()
Choice 2
dropmem()
Choice 3
dealloc()
Choice 4
release()
Choice 5
free()
Q18:Code: void *ptr;
mystruct myarray[10];
ptr=myarray;
Which of the following is the correct way to increment the variable "ptr"?
Choice 1
ptr = ptr + sizeof(myStruct);
Choice 2
++(int*)ptr;
Choice 3
ptr = ptr + sizeof(myArray);
Choice 4increment(ptr);
Choice 5ptr = ptr + sizeof(ptr);
Q19:
Code: char* myFunc (char *ptr)
{ ptr += 3; return (ptr);
} int main()
{ char *x, *y; x = "HELLO";
y = myFunc (x);
printf ("y = %s \n", y); return 0;}
What will print when the sample code above is executed?
Choice 1
y = HELLO
Choice 2
y = ELLO
Choice 3
y = LLO
Choice 4
y = LO
Choice 5
x = O
NGUYỄN THỊ BẢO TRANG
» Tin mới nhất:
» Các tin khác: