《暨南大学C语言样题》由会员分享,可在线阅读,更多相关《暨南大学C语言样题(6页珍藏版)》请在金锄头文库上搜索。
1、I. True/False1. ( F)Identifiers consist of letters and digits in any order, but must be in lowercase.2. (T)We create modular programs because they are easier to develop, correct and modify.3. (F)All computers use twice the amount of storage for double precision than floating point data type4. (F)Sta
2、tic variable is not created and destroyed each time the function is called, it is the default storage class used by C. 5. (T)A compound statement may be used anywhere in C program in place of a single statement.6. (F)In C language, all operators are binary operator which connecting tow operands side
3、-by-side.7. (T)The Escape Sequence is a combinations of a backslash () and a character that tells the compiles to escape from the ways these character would be normally interpreted8. (T)Extern storage class is to extend the scope of a global variable beyond its normal boundary-file. it does not caus
4、e the creation of a new variable.9. (F)After defined, the symbolic names can be used in any statement and the program can change the value of the symbolic names.10. (T)The mistake of using the assignment operator”=” in place of the relational operator”= =” results in a invalid C expressionII. Choice
5、 11. (C)For the algebraic expression 3ae/bc, which of the following C expression is invalidA) a/b/c*e*3B) 3*a*e/b/cC) 3*a*e/b*cD) a*e/c/b*312. (D)For the declarations: char w; int x; float y; double z; the data type of the value of w*x+z-y isA) floatB) charC) intD) double13. (B)For following declara
6、tion, which expression will not result in 3 ?int x10 = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, *p1 ;A) x3B) p1 = x +3, *p1+C) p1 = x +2, *( p1+ )D) p1 = x +2, *+p114. (A)Which one is not endless loop?A) for (y = 0, x = 1 ; x +y ; x = i+ ) i = x ;B) for ( ; ; x + = i ) ;C) while (1) x +;D) for ( i =10 ; ; i-)
7、sum += i ;15. (B)The result of the following program ismain() int a = -2, b do b = +a; if (!b) printf(“#”); else printf(“*”); while(a5D) 35III. Fill in the blanks in each program to implement the purpose according to the description Description#1:The following program can accept elements of an array
8、 from the keyboard, and find the maximum element and corresponding index in the array. main() int x10, *p1, *p2, k; for(k = 0; k 10; k+) scanf(%d, x+k); for(p1 = x, p2 = x; p1-x * p2) p2 = 【21】 ; printf(MAX = %d, INDEX = %dn, *p2,【22】);21. A) p1B) p2p1C) xp2D) x p122. A) p1 xB) p1C) p2 x D) x p2Desc
9、ription#2: For each x, the program will calculate a corresponding y according to the relationship of x and y illustrated in the following table.xy2 x = 10x(x+2)-1 x = 22xx = -1x - 1main() int x, y; scanf(“%d”, &x); if(【23】 ) y = x * (x + 2); else if(【24】 ) y = 2 * x; else if(x 2 | | x 2 & x = 10C) x
10、 2 & x = 10D) x = 1024. A) x = 2B) x -1 | | x -1 & x -1 x = 225. A) y = -1B) y = 0C) x = 0D) x = -1IV. (1)What is the purpose of the following program? #include#define N 10 main()int t, i, j, aN+1 ;printf(“please input 10 integers:”);for (i=1; i=N; i+)scanf(“%d”, &ai);printf(“n”);for (i=1; i=N-1; i+
11、) for (j=1; j=N-i; j+)if (ajaj+1)t=aj+1; aj+1=aj; aj=t;for (i=1; i=N; i+) printf(“%d”, ai);printf(“”n);从大到小排列数字。 (2)Read the grogram and guess the result of the program#include int k = 1;char a = “IBM computer”, b = “C program”;int fuc();main()int p = 3;while (putchar(ak) k+; /*k=12*/putchar(n);printf(“k=%d, ”, k);k=fuc(p);printf(“%d, %dn”, p,k);printf(“%c%sn”, a0, &bp);puts(&a3);