Trắc Nghiệm Ngôn Ngữ Lập Trình C ( English ) - Bài 53
1-
|
In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr;
ptr p1, p2;
|
|
A -
|
Integer
|
|
B -
|
Integer pointer
|
|
C -
|
Error in declaration
|
|
D -
|
None of above
|
2-
|
In the following code what is 'P'?
typedef char *charp;
const charp P;
|
|
A -
|
P is a constant
|
|
B -
|
P is a character constant
|
|
C -
|
P is character type
|
|
D -
|
None of above
|
3-
|
What is x in the following program?
#include<stdio.h>
int main()
{
typedef char (*(*arrfptr[3])())[10];
arrfptr x;
return 0;
}
|
|
A -
|
x is a pointer
|
|
B -
|
x is an array of three pointer
|
|
C -
|
x is an array of three function pointers
|
|
D -
|
Error in x declaration
|
4-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
enum color{red, green, blue};
typedef enum color mycolor;
mycolor m = red;
printf("%d", m);
return 0;
}
|
|
A -
|
1
|
|
B -
|
0
|
|
C -
|
2
|
|
D -
|
red
|
5-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int arr[5];
arr iarr = {1, 2, 3, 4, 5};
int i;
for(i=0; i<4; i++)
printf("%d,", iarr[i]);
return 0;
}
|
|
A -
|
1, 2, 3, 4
|
|
B -
|
1, 2, 3, 4, 5
|
|
C -
|
No output
|
|
D -
|
Error: Cannot use typedef with an array
|
6-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef int LONG;
LONG a=4;
LONG b=68;
float c=0;
c=b;
b+=a;
printf("%d,", b);
printf("%f\n", c);
return 0;
}
|
|
A -
|
72.000000, 68
|
|
B -
|
68.000000, 72.000000
|
|
C -
|
68, 72.000000
|
|
D -
|
72, 68.000000
|
7-
|
What will be the output of the program?
#include<stdio.h>
int main()
{
typedef float f;
static f *fptr;
float fval = 90;
fptr = &fval;
printf("%f\n", *fptr);
return 0;
}
|
|
A -
|
9
|
|
B -
|
0
|
|
C -
|
90.000000
|
|
D -
|
90
|
8-
|
What will be the output of the program?
#include<stdio.h>
typedef struct error {int warning, err, exception;} ERROR;
int main()
{
ERROR e;
e.err=1;
printf("%d\n", e.err);
return 0;
}
|
|
A -
|
0
|
|
B -
|
1
|
|
C -
|
2
|
|
D -
|
Error
|
9-
|
In the following code snippet can we declare a new typedef named ptr even though struct employee has not been completely declared while using typedef?
typedef struct employee *ptr;
struct employee
{
char name[20];
int age;
ptr next;
}
|
|
A -
|
Yes
|
|
B -
|
No
|
10-
|
Point out the error in the following code?
typedef struct
{
int data;
NODEPTR link;
}*NODEPTR;
|
|
A -
|
Error: in *NODEPTR
|
|
B -
|
Error: typedef cannot be used until it is defined
|
|
C -
|
No error
|
|
D -
|
None of above
|
[Người đăng: Thành Lãm - ST]
|