收藏 分销(赏)

C语言英文试题.doc

上传人:w****g 文档编号:6172987 上传时间:2024-11-29 格式:DOC 页数:3 大小:54.05KB 下载积分:5 金币
下载 相关 举报
C语言英文试题.doc_第1页
第1页 / 共3页
C语言英文试题.doc_第2页
第2页 / 共3页


点击查看更多>>
资源描述
课程考试试题 学期 学年 2009-2010 1 C语言程序设计(C) 拟题人: 校对人: 拟题学院(系): 适 用 专 业: 信息科学与技术学院 信息08级,通信08级 (答案写在答题纸上,写在试题纸上无效) Ⅰ.Choose the right answer (30 marks).  1. Determine the output of the following statement: printf("%d", 'M' - 'N'); A) 'M' - 'N' B) M - N B) 3 D) 1 2. Which of following is an illegal user-define symbol? A) scanf B) _123 C)C$ D)var 3. Which statement is not a C statement? C) {int a; a++;} B) z = 20, a += c; C) ; D) { ; } 4. Which operator can only be applied to integers?   A) %= B) /   C) = D) <= 5. Determine the output of the following program. void main() { int y=8,x=7;   printf("%d %d\n", ++x, y++);  }  A) 7,8 B) 9,7 C) 8,8 D) 8,9 6. Choose the wrong definition for the character strings.   A) char str[4]= “QUST”;  B) char str[]= “QUST”; C) char *str= “QUST”;  D) char str[]={‘Q’, ‘U’, ‘S’, ‘T’, ‘\0’}; 7. Determine the output of the following program. void main()   {    int i, j, m = 0;    for(i=1;i<=15;i+=5) for(j=3;j<=19;j+=3) m++; } printf("%d\n",m);   A) 12  B) 15  C) 18  D) 25 8. For the 2-dimensional array int b[][3]={{1,0,-1},{10,12},{8,3,9},{0}}; the value for the b[2][1] is______. A) 8 B) 5 C)3 D) 12 9. In the statement while(x), choose the equivalent expression for the x. A)x==0   B)x==1   C)x!=1   D)x!=0 10. For the following codes: int z=5, *p=&z; the value of the *p is_______. A)the address of c  B)unknown value   C)the address of p   D)5 11. In order to assign 45 to variant a and assign 64 to variant b with the statement scanf(“%d%d”, &a, &b), which input format is correct? A) 45 64  B) 45, 64 C) 45;64 D) 4564 12. What is the byte length of the string “\t\\abcd”. A) 6 B) 7 C) 8 D) 9 13. Determine the output of the value of b. Int a[4][2] = {1,2,3,4,5,6,7,8}; b = *(*(a + 2) + 1);   A) 3   B) 4   C) 5   D) 6 14. Determine the output of the following program: main() { int n = 8; while (n > 5) { n--; printf(“%d”, n); } } A) 876   B) 765   C) 8765 D) 7654 15. What is the functionality of function “rewind”? A) open the file again; B) return the length of the file C) push the pointer to the end of the file D) push the pointer to the beginning of the file II. Short answer questions.(30 marks) 1. a. Enumerate workflow control methods in C programming language. (5 marks) b. Give a simple C program to show the basic parts of a C program.(5 marks) 2. a. The following program takes user input number and display the multiplication result of (num + num) in the next line on the screen, but it alway displays the wrong result. Determine where the errors are and why the program can never give the correct result. (8 marks) #include <stdio.h> void main() { int num; printf("Enter a letter: "); scanf("%d", num); num = num * num; printf("The result of num + num is %d", &num); } b. Modify the program so it will display the proper result. (12 marks) III. Write the programs. (40 marks) 1. Given an array a[9], fill a with random values, then write a sorting method to sort the data in a and display the result.. (10 marks) 2. (a) Write a function named min( ) that accepts 5 integers as input , which calculates and returns the maximum value among them. The 5 integer numbers should be arrange into an integer array, and passed to the function min( ). (5 marks) (b) Include the function in a working program. Make sure your function is called from main() and correctly returns a value to main(). Display the value returned by min() in main(). (5 marks) 3. Write a program that declares a single-dimensional arrays named num,. The numbers to be stored in num are 45, 86, 12, 37, 28, 113. Sum odds and evens separately. Finally, give the results that will be displayed on the screen. (10 marks) 4. Given a function: Write a program to accept the user input for x, and display the value of y. 3
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服