![暨南大学C语言样题_第1页](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d1.gif)
![暨南大学C语言样题_第2页](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d2.gif)
![暨南大学C语言样题_第3页](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d3.gif)
![暨南大学C语言样题_第4页](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d4.gif)
![暨南大学C语言样题_第5页](http://file2.renrendoc.com/fileroot_temp3/2021-10/29/e276cae7-00e2-403c-8571-dd5c3b00163d/e276cae7-00e2-403c-8571-dd5c3b00163d5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、I.True/False第1 页共6 页1. ( 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.
2、 (F)Static 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 operand
3、s side-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 no
4、t cause 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 u sing the assignment operator” =” in place of the relationaloperator ”=” results in ainvalid C expressionII. C
5、hoice11. (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 dec
6、laration, 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 =1
7、0 ; ; i-) sum += i ;15. (B)The result of the following program ismain() int a = -2, bdo b = +a;if (!b) printf( “#”);else printf( “* ”);while(a<1)A#*#B *#*C)#D) *16. (D)Which one of the following functions is valid ?A) double fun ( int x , int y ) z = x + y ; return z ;B) fun ( int x , y ) int z ;
8、return z ;C) fun ( x , y ) int x ,y ; double z ;z = x + y ; return z ;D) double fun ( int x , int y ) double z ;z = x + y ; return z ;17. (D)In a source codes file of C language, if a variable can only be used by all functions with the file itself, the storage class of the variable is A) externB) re
9、gisterC) autoD) static18. (B)The C programming language the symbol “= = ” isA) rational operatorB) logical operatorC) conditional operatorD) assignment operator19. (D)For the definition statement: double s = 123.5; , which one is the correct output statement?A) printf( “s=%d ”,s);B) printf(“s=%ld ”,
10、 s);C) printf( “s=%f ”, s);D) printf(“s=%lf ”,s);20. ( C)Which of the following expressions will result in 0?A) 3%5B) 3/5.0C) 3>5D) 3<5III. Fill in the blanks in each program to implement the purpose according to the descriptionDescription#1: The following program can accept elements of an arr
11、ay from the keyboard, andfind the maximum element and corresponding index in the array. mai n() int x10, *p1, *p2, k;for(k = 0; k < 10; k+) scanf("%d", x+k); for(p1 = x, p2 = x; p1-x < 10; p1+ )if(*p1 > * p2) p2 =【21 】prin tf("MAX = %d, INDEX = %dn", *p2,21. A) pl22. A)
12、p1 -xB) p2p1B) p1C) xp2C) p2 -x【22】);D) x -p1D) x -p2Description#2: For each x, the program will calculate a corresponding y according to thexy2 < x <= 10x(x+2)-1 < x <= 22xx <= -1x - 1relati on ship of x and y illustrated in the followi ng table.mai n() int x, y;scanf(%d”,&x);if(
13、 【23 】)y = x * (x + 2); else if(【24 】)y = 2 * x;else if(x <= -1) y = x - 1;else 【25】;if(y != -1) pri ntf("%d", y); else prin tf("error");23. A) x > 2 | x <= 10C) x < 2 && x <= 1024. A) x < -1 | x >= 2C) x > -1 && x <= 225. A) y = -1B) y
14、= 0B) x > 2 && x <= 10D) x < 2 | x >= 10B) x > -1 | x <= 2D) x > -1 A A x <= 2C) x = 0 D) x = -1IV. (1)What is the purpose of the followi ng program?#in clude<stdio.h>#define N 10main ()int t, i, j, aN+1;printf('please in put 10 in tegers:”);for (i=1; i<=
15、N; i+)scanf(%d", &ai);第7页共6页printf(“n ”);for (i=1; i<=N-1; i+) for (j=1; j<=N-i; j+)if (aj<aj+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 <stdio.h>int k = 1;char a = int
16、fuc();IBM computer ”, b =C program ”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);int fuc(int m)int k = 0;while (putchar(bk) k+; printf("k=%dn", k);k +=m; m *=k;printf(&quo
17、t;%d, %dn", m, k);return (m+k);OUTPUT:BM computer k=12,C program k=936, 123, 48Irogram computerV. Check Error in the program according to the following description and correct them, write the whole corrected program on the an swer sheetA programmer wants to write a program to simulate a roll of
18、 the dice. The programmer decides to have the program choose two pseudo-ra ndom nu mbers from 1 to 6 and output the two nu mbers. If two values are the same, the program should also output the stri ng "That's a pair!" after printing the two values.The programmer writes the followi ng c
19、ode:#in clude <stdio.h>#in clude <stdlib.h>#in clude <time.h> int mai n(void) int dice2;sran d(time(NULL);for (x = 0; x <= 2; x+);dice x = ran d() % 6;printf ("You rolled a %d and a %d.n", dice0, dice1); if (dice0 = dice1)prin tf("That's a pair!n");return
20、 0;The above code has 5 errors in it! What are they?没有定义x/*超纟冈*/for (x = 0; x <= 2; x+);应改为 for (x = 0; x <= 2; x+) dicex = rand() % 6; 应改为(dicex = rand() % 7) +1for (x = 0; x <= 2; x+);应改为 x < 2if (dice0 = dice1)应改为=VI. Writing a programWrite a complete program that allows the user to e
21、nter a string (assumed to be less than 25 characters long). If N is the length of the string, the program should output N rows to standard output. The first row should be the string entered by the user.The second row should be thestring without its last character. The third row should be the string without its last two characters. Etc. The Nth and final row should be only
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电网工程设备材料信息参考价(2024年第四季度)
- 高级餐饮食品安全管理员技能鉴定理论考试题库500题(含答案)
- 2025年河南农业职业学院高职单招职业技能测试近5年常考版参考题库含答案解析
- 2025年池州职业技术学院高职单招职业技能测试近5年常考版参考题库含答案解析
- 2025年江苏农牧科技职业学院高职单招职业技能测试近5年常考版参考题库含答案解析
- 《医疗机构管理培训》课件
- 2025民用航空运输行业未来发展与市场展望
- 10kV配电站房工程设计与施工流程优化
- 压路机租赁合同
- 场地租赁经营合同
- 2025江苏连云港市赣榆城市建设发展集团限公司招聘工作人员15人高频重点提升(共500题)附带答案详解
- 江苏省扬州市蒋王小学2023~2024年五年级上学期英语期末试卷(含答案无听力原文无音频)
- 数学-湖南省新高考教学教研联盟(长郡二十校联盟)2024-2025学年2025届高三上学期第一次预热演练试题和答案
- 决胜中层:中层管理者的九项修炼-记录
- 铸石防磨施工工艺
- 临时用电安全培训(汇编)
- 玻璃钢烟囱方案
- 中小学教师师德师风法律法规培训
- 医疗器械质量管理体系文件模板
- 在马克思墓前的讲话说课稿公开课一等奖市赛课获奖课件
- 送养收养合同协议书
评论
0/150
提交评论