Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 72
1-
|
Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
|
|
A -
|
#include<conio.h>
|
|
B -
|
#include<math.h>
|
|
C -
|
#include<stdlib.h>
|
|
D -
|
#include<dos.h>
|
2-
|
What will be the output of the program?
#include<stdio.h>
#define PRINT(i) printf("%d,",i)
int main()
{
int x=2, y=3, z=4;
PRINT(x);
PRINT(y);
PRINT(z);
return 0;
}
|
|
A -
|
2, 3, 4,
|
|
B -
|
2, 2, 2,
|
|
C -
|
3, 3, 3,
|
|
D -
|
4, 4, 4,
|
3-
|
What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes?
#include<stdio.h>
int main()
{
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
return 0;
}
|
|
A -
|
448, 4, 4
|
|
B -
|
520, 2, 2
|
|
C -
|
1006, 2, 2
|
|
D -
|
Error
|
4-
|
Which of the following statements correct about k used in the below statement?
char ****k;
|
|
A -
|
k is a pointer to a pointer to a pointer to a char
|
|
B -
|
k is a pointer to a pointer to a pointer to a pointer to a char
|
|
C -
|
k is a pointer to a char pointer
|
|
D -
|
k is a pointer to a pointer to a char
|
5-
|
What does the following declaration mean?
int (*ptr)[10];
|
|
A -
|
ptr is a pointer to an array of 10 integers
|
|
B -
|
ptr is array of pointers to 10 integers
|
|
C -
|
ptr is an array of 10 integers
|
|
D -
|
ptr is an pointer to array
|
6-
|
What will be the output of the program in Turbo-C ?
#include<stdio.h>
int main()
{
int arr[5], i=-1, z;
while(i<5)
arr[i]=++i;
for(i=0; i<5; i++)
printf("%d, ", arr[i]);
return 0;
}
|
|
A -
|
1, 2, 3, 4, 5,
|
|
B -
|
-1, 0, 1, 2, 3, 4
|
|
C -
|
0, 1, 2, 3, 4,
|
|
D -
|
0, -1, -2, -3, -4,
|
7-
|
What will be the output of the program in 16-bit platform (Turbo C under DOS) ?
#include<stdio.h>
int main()
{
printf("%d, %d, %d", sizeof(3.0f), sizeof('3'), sizeof(3.0));
return 0;
}
|
|
A -
|
8, 1, 4
|
|
B -
|
4, 2, 8
|
|
C -
|
4, 2, 4
|
|
D -
|
10, 3, 4
|
8-
|
Point out the error in the program?
#include<stdio.h>
int main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0; i<=9; i++)
scanf("%s %f", e[i].name, &e[i].sal);
return 0;
}
|
|
A -
|
Error: invalid structure member
|
|
B -
|
Error: Floating point formats not linked
|
|
C -
|
No error
|
|
D -
|
None of above
|
9-
|
A structure can contain similar or dissimilar elements
|
|
A -
|
True
|
|
B -
|
False
|
10-
|
A pointer union CANNOT be created
|
|
A -
|
Yes
|
|
B -
|
No
|
[Người đăng: Thành Lãm - ST]
|