




已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Section 1: Put True (T) or False (F) in the brackets.1. In C program, upper case and lower case letters are distinct.t2. All variables must not be declared before use.f3. The first character of variables name must be a letter.f4.0equals “0”.f5. “#define MAX 100”is a statement.f6. In computer terminology, a program error is called a bug.t7. In C, functions may be nested.t8. Inputting data or a literal is a constant.f9. =+ is a valid C operator.fSection 2: Single Choice.1. An identifier DA. must begin with a letter or digit and can contain letters, digits, or underscoresB. must begin with a digit and can contain letters, digits , or underscoresC. must begin with a letter, digit, or underscore and can contain letters, digits, or underscoresD. must begin with a letter or underscore and can contain letters, digits, or underscores2. The function printf BA. sends data to the printer B. sends data to the screenC. receives data from the keyboard D. receives data from any input3. The basic data types of C are CA. integer, real, imaginary, double B. integer, real, double, characterC. integer, double, float, character D. character, double, real, float4. The value of 10/9 is DA. 1.1 B. 1.111C. 1.1111 D. 15. All variables must have DA. A data type and a name B. An expression and a specifierC. Syntax and logic D. Memory location and status flag6. Expressions containing operators with the same precedence are evaluated according to their CA. order B. associativity C. hierarchy D. position7. Any expression that is terminated by a semicolon is BA. a constant B. a statementC. evaluated from left to right D. illegal unless an equal sign is preceding8. Assuming x = 10, the expression: x += 15*6 changes the value of x to BA. 150 B. 100C. 900 D. 909. Assuming x is 10, what is the output: printf(“%d”,+x); DA. 8 B. 9C. 10 D. 1110. When using a scanf function to input multiple values, the user must separate the input with BA. commas B. spacesC. semicolons D. forward slashes11. Assume a = 5, b = 2, c = 4, d = 6, and e = 5. What is the value of e % b * c 5 | c % d * e 7 is BA. 0 B. 1C. 2 D. 312. In a switch statement, the keyword break BA. is accessed if none of the other case values match the expressionB. causes the program to exit the switch statement completelyC. causes the program to move the default caseD. causes the program to terminate13. What is the output from the following loop:i = 10;while (i=10) printf (“%dn”, i); BA. No outputB. The number 10 will be output infinitelyC. The number 10 will be output exactly one timeD. The number 0 through 10 will be output14. When placed in a while loop, the continue statement CA. Causes the loop to terminate B. Causes the program to terminateC. Skips to the next iteration of the loop D. Does nothing in a while loop15. The components of a function header include DA. call, return value, prototype B. argument list, parameter list, callC. function body, function call, argument listD. return type, name, parameter listSection 3: Expression calculation and fillong blanks.1. The items enclosed within the parentheses in a function call statement are called _formal parameters_.2. The statement for (i= 1; I=10&2 5 ) b = 7;else if ( a 0 ) if ( n 0 ) if ( a b ) z = a; if ( a b ) else z = a; z = b; else z = b;Please describe the difference between structure(A) and (B). 3. What a while loop that is equivalent to the for loop given below. For (k = 0; k 10; k + ) sum = sum + k; 4. Please write the output of the following statements .viod main() int s=1,t=1,a,n;scanf(“%d%d”, &a, &n); for (int i=1;in;i+) t=t*10+1; s=s+t; s*=a;printf(“SUM=%dn”,s);Input data: 2 4Answer: _2468_.5. Please write the output of the following func (int a, int b) static int m = 0, i = 2; i += m + 1; m = i + a + b; return (m);main() int k = 4, m = 1, p1, p2; p1 = func(k, m); p2 = func(k, m); printf(“%d, %dn”, p1, p2);Answer:_8, 17_6. Please write the output of the following k, s;for(k = 1, s = 0; k 10; k+) if(k % 2 = 0) continue; s += k;Printf(“k = %d s = %d”, k, s);Answer:_k=10 s=25_ 7. Please write the output of the following program.#includevoid main() int k, x, s, t; x = 3; s = 0;t = x;for( k = 1; k = 3; k+) t = t * 10 + x; s = s + t; printf(“%d#”, s); Answer:_. Section 5: Programming1. Write an interactive program that asks the user to enter a month number( between 1 and 12).Program need to check user input:(1). If the input is invaid, display error message and prompt user reenter number.(2). If the input is valid, the program should dispay the month name of input number.(e.g. Input is “1”, then output is”January”). 2. Find numbers: these numbers which are satisfied with the following four conditions:(1).
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年湖南郴州市招聘17名大学生乡村医生考试模拟试题及答案解析
- 2025江苏南通高新区(近海镇)公办幼儿园秋季编外教职工招聘8人备考考试试题及答案解析
- 互联网金融产品设计与开发服务协议
- 2026TP-LINK秋季校园招聘考试参考题库及答案解析
- 2025年不锈钢冷拔钢管行业研究报告及未来行业发展趋势预测
- 合同协议标准审批签署管理流程
- 2025年发泡餐盒行业研究报告及未来行业发展趋势预测
- 文化产业公司员工薪资及版权收益分配协议
- 项目管理法律法规与习题集制作及咨询培训服务合同
- 黄石铁山区文化创意产业合作开发合同
- 重庆市南开中学高2026届高三第一次质量检测+化学答案
- 教育培训课程开发与实施指南模板
- 2025保密协议范本:物流行业货物信息保密
- 2025卫星互联网承载网技术白皮书-未来网络发展大会
- 2024年中国人寿集团公司招聘笔试参考题库含答案解析
- GB/T 9798-2005金属覆盖层镍电沉积层
- GB/T 17669.3-1999建筑石膏力学性能的测定
- 压 实 度 试 验 记 录 表
- GA/T 1069-2013法庭科学电子物证手机检验技术规范
- 新版药品管理法培训培训课件
- 单位线法推求流域出口洪水过程工程水文学课件
评论
0/150
提交评论