




已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- JG/T 346-2011合成树脂装饰瓦
- JG/T 289-2010混凝土结构加固用聚合物砂浆
- JG/T 235-2008建筑反射隔热涂料
- JG/T 200-2007建筑用不锈钢绞线
- JG/T 130-2017建筑门窗五金件单点锁闭器
- JG/T 10-2009钢网架螺栓球节点
- JG 3043-1997维勃稠度仪
- DZ/T 0276.14-2015岩石物理力学性质试验规程第14部分:岩石热导率试验
- DZ/T 0250-2010煤层气钻井作业规范
- DZ/T 0161.2-1995铸铁缠丝滤水管
- 乐曲演奏电路设计-正文
- 中医糖尿病试题及答案
- 医院行政考试试题及答案
- 2025届湖北武汉市华中师大一附中高考英语押题试卷含答案
- 《电子商务物流管理》课件-第8章 农村电子商务与物流管理
- 防范学生自残协议书
- 呼吸科护理进修后回院汇报
- 四年级义工课程
- 职业教育试题库及答案
- 家庭劳动教育讲座
- 某某工业新城弯道反光镜项目立项申请报告(总投资7040万元)
评论
0/150
提交评论