C程序设计英文试题第1页
Section 1: Single Choice(2 mark for each item, total 20 marks)
1. The precedence of operator _____ is the lowest one.
A.? : B.== C.+= D.&
2. _____ is correct if it is used as a character constant.
A.?\? B.'\080' C.'%d' D.0xa
3. According to the declaration: char c1=92,c2=92; the value of expression _____ is 0. A.c1^c2 B.c1&c2 C.~c2 D.c1|c2
4. According to the declaration: int x=11; the value of expression (x++*1/3) is_____.
A.3 B.4 C.0 D.3.667
5. The value of expression sizeof("\num=%d\t") is ______.
A.7 B.8 C.9 D.10
6. In the following assignments or initialization, ______ is wrong.
A.char s[ ]="hello"; B.char s[10]; s="hello";
C.char *p="hello"; D.char *p; p="hello";
7. The following code fragment prints out ______.
#define MA(x, y) (x)*(y)
int i = 2;
i = 3/MA(i, i+2)+5;
printf(“%d\n”, i);
A.5 B.8 C.9 D.11
8. static struct {
int x, y[3];
} a[3] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}, *p;
p = a+1;
The value of expression *((int *)(p+1)+2) is ______.
A.3 B.7 C.10 D.11
9. After running the following code fragment, the value of s is ______.
int i=5, s=0;
《C Programming》TEST PAPER, Jan 22, 2005 2 / 8
do if (i%2) continue; else s+=i; while (--i);
A.15 B.9 C.6 D.5
10. According to the declaration: int (*p)[10], p is a(n) ______.
A.pointer B.array C.function D.element of array
Section 2: Fill in the blanks(2 mark for each item, total 30 marks)
1. The value of expression 1+4/5+15<7+4%5+(8,10) is ______.
2. The value of expression !!10 is _____.
3. The value of expression 3>2>1 is _____.
4. The value of expression ~(-1<<1) is ______.
5. The statement for (i=1; i<=9; i++) printf(“%3d”, ______);prints out the following numbers: 1 4 7 10 13 16 19 22 25.
6. According to the declaration: int a[10], *p=&a[1]+2; the last element of array a is p[__].
7. Write the declaration_____ with typedef, which makes PA a synonym for a character