资源预览内容
第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
亲,该文档总共4页全部预览完了,如果喜欢就下载吧!
资源描述
2009-2010 学年1 学期 C语言程序设计(C)课程考试试题拟题学院(系):信息科学与技术学院 拟题人:适用专业:信息08级,通信08级校对人:(答案写在答题纸上,写在试题纸上无效)I Choose the right answer (30 marks).1. Determine the output of the following statement:printf(n%dn, M N);A) M NB)M-NB) 3D) 12. Which of following is an illegal user-define symbol?A) scanfB) _123C)C$D)var3. 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(H%d %dn, +x, y+);A) 7,8B)9,7C) 8,8D) 8,96. Choose the wrong definition for the character strings.A) char str4= “QUST ” ; B) char str= “QUST ” ;C)char*str= “QUST ” ;D)charstr= QJ ,U ,S ,T , 0 ;7. Determine the output of the following program.void main()int i, j, m = 0;fbr(i=l ; i=15 ; i+=5)fbr(j=3 ; j 5)n-;printf( M%dM, n);A) 876B) 765C) 8765D) 765415. What is the functionality of lunction rewind ”?A) open the file again;B) return the length of the fileC) push the pointer to the end of the fileD) push the pointer to the beginning of the filen. 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 void main()int num;printf(Enter a letter:);scanf(H%dM, num);num = num *num; printf(*The result of num + num is %du, &num);b. Modify the program so it will display the proper result(12 marks)HL Write the programs. (40 marks)1. Given an array a9, 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 iunction min(). (5 marks)(b) Include the iunction in a working program Make sure your tunction 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 singledimensional arrays named num,. The numbers to be stored in num are 45, 86, 12, 37, 28, 1 13. Sum odds and evens separately Finally, give the results that will be displayed on the screen. (10 marks)4. Given a function:xx 10y 2x 10 x 10, x 203x 100 x 20Write a program to accept the user input for x, and display the value of y.
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号