已阅读5页,还剩21页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C语言考试资料汇总Quick Quiz 11. The smallest and most basic data item in a computer is a _; it is really a switch that can be either open (0) or closed (1).Answer: bit2. A byte is a grouping of _. A byte can assume 256 distinct patterns.Answer: eight bits3. What is the ALU of a computer?Answer: The Arithmetic and Logic Unit (ALU) of a computer performs all of the computations, such as addition, subtraction, comparisons, and so on, that a computer provides.4. What is the control unit of a computer?Answer: The control unit of a computer directs and monitors the overall operation of the computer.5. A(n) _ allows a computer to read or write any one file or program independent of its position on the storage medium.Answer:direct access storage device (DASD)direct access storage deviceDASD6. What are the two principal parts of the CPU? What is the function of each part?Answer:The two principal parts of the CPU are the Control Unit and the Arithmetic and Logic Unit (ALU). The Control Unit monitors the overall operation of the computer while the ALU performs all the arithmetic and logic functions provided by the system.Quick Quiz 21. What is an assembly language?Answer: Programming languages that use the substitution of word-like symbols, such as ADD, SUB, MUL, for the binary opcodes, and both decimal numbers and labels for memory addresses are referred to as assembly languages.2. The program that translates a high-level source program as a complete unit before any individual statement is executed is called a(n) _.Answer: compiler3. What is a linker?Answer: A linker combines additional machine language code with the object program to create a final executable program.4. When English phrases are used to describe an algorithm (the processing steps), the description is called _.Answer: pseudocodeQuick Quiz 31. What is the software development process?Answer: The technique used by professional software developers for understanding the problem that is being solved and for creating an effective and appropriate software solution is called the software development process.2. When writing a program, a(n) _ structure provides the capability to make a choice between different instructions, depending on the result of some condition.Answer: selection3. The process of developing and writing a program could be called _.Answer: programming4. The program written in a computer language is _.Answer: source program5. When writing a program, a(n) _ structure involves summoning into action specific sections of code as they are needed.Answer: invocation6. What is a repetition structure?Answer: When writing a program, a repetition structure, which is also referred to as looping and iteration, provides the ability for the same operation to be repeated based on the value of a condition. Chapter 2Getting Started in C ProgrammingQuick Quiz 17. What is an identifier?Answer: The names of functions, as well as all of the words permitted in a program that have special meaning to the compiler, are collectively referred to as identifiers.8. What is a function header line?Answer: A function header line, which is always the first line of a function, contains three pieces of information: (1) what type of data, if any, is returned by the function, (2) the name of the function, and (3) what type of data, if any, is sent into the function.9. The function do() is a(n) _ function name.Answer: invalid10. The function int() is a(n) _ function name.Answer: invalida. The two characters and n, when used together, are called a(n) _.Answer: newline escape sequence11. A(n) _ is a word that is predefined by the programming language for a special purpose and can only be used in a specified manner for its intended purpose.Answer:reserved wordkeywordreserved or keywordQuick Quiz 21. What is a data type?Answer: A data type is defined as a set of values and a set of operations that can be applied to these values.2. In numerical theory, the term _ typically refers to numerical accuracy.Answer: precision3. Two backslashes in a row results in _ being displayed.Answer: one backslash4. What is an expression?Answer: An expression is any combination of operators and operands that can be evaluated to yield a value.5. _ is the order in which operators of the same precedence are evaluated.Answer: AssociativityQuick Quiz 31. _ are simply names given by programmers to computer storage locations.Answer: Variables2. What is an assignment statement?Answer: An assignment statement tells the computer to assign a value to (that is, store a value in) a variable.3. What is a definition statement?Answer: Definition statements define or tell the compiler how much memory is needed for data storage.4. When a declaration statement provides an initial value, the variable is said to be _.Answer: initialized5. _ are the two integer data types that are most used in a C program.Answer: Int and char6. A computer will use _statements to let the computer know what types of values it will be using.Answer: variables and declaration Chapter 3 Processing and Interactive InputQuick Quiz 112. In C, the _ symbol is called the assignment operator.Answer: =13. The automatic conversion across an assignment operator is referred to as a(n) _ type conversion.Answer: implicitb. What is a garbage value?Answer: A previously stored number, if it has not been initialized to a specific and known value, is frequently referred to as a garbage value.14. What is the prefix increment operator?Answer: Using the increment operator, +, the expression variable = variable + 1 can be replaced by the either the expression variable+ or +variable. When the + operator appears before a variable, it is called a prefix increment operator.Quick Quiz 21. A(n) _ is a message that tells the person at the screen what should be typed.Answer: prompt2. On most computer systems, characters read by the keyboard are stored in a temporary holding area called a(n) _ immediately after they are pressed.Answer: buffer3. What are robust programs?Answer: Programs that detect and respond effectively to unexpected user input are formally referred to as robust programs and informally as “bullet-proof” programs.4. What is user-input validation? Answer: The basic approach to handling invalid data input is referred to as user-input validation, which means validating the entered data either during or immediately after the data have been entered, and then providing the user with a way of reentering any invalid data.Quick Quiz 31. The format of numbers displayed by printf() can be controlled by _ included as part of each conversion control sequence.Answer: field width specifiers2. What are magic numbers?Answer: Literal values that appear many times in the same program are referred to by programmers as magic numbers.3. #define statements are also called _ statements.Answer: equivalence4. What does the term “literal data” mean?Answer: Literal data refers to any data within a program that explicitly identifies itself. Chapter 4 SelectionQuick Quiz 115. What is “flow of control”?Answer: The term flow of control refers to the order in which a programs statements are executed.16. A(n) _ expression consists of a relational operator that compares two operands.Answer: relational17. Relational expressions are also known as _.Answer: conditions18. How does the NOT (!) operator work?Answer: If an expression has any non-0 value (true), !expression produces a 0 value (false). If an expression is false to begin with (has a 0 value), !expression is true and evaluates to 1.Quick Quiz 21. The simplest C selection statement is the _ if statement.Answer: one-way2. A(n) _ statement is one or more statements contained between braces.Answer: compound3. What is a nested if statement?Answer: Including one or more if-else statements within an if or if-else statement is referred to as a nested if statement.4. Depending on the result of some condition, _ structure provides the capability to make a choice between different instructions.Answer: selection5. Is indentation important in the evaluation of if-else statements?Answer: Indentation used within an if-else is always irrelevant as far as the compiler is concerned. Whether the indentation exists or not, the compiler will, by default, associate an else with the closest previous unpaired if, unless braces are used to alter this default pairing.Quick Quiz 31. What is a switch statement?Answer: A switch statement is a specialized selection statement that can be used in place of an if-else chain where exact equality to one or more integer constants is required.2. Internal to the switch statement, the keyword _ identifies the values that will be compared to the value of the switch expression.Answer: case3. What is the role of the default statement in a switch?Answer: Any number of case labels may be contained within a switch statement, in any order. However, if the value of the expression does not match any of the case values, no statement is executed unless the keyword default is encountered. The word default is optional and operates the same as the last else in an if-else chain. If the value of the expression does not match any of the case values, program execution begins with the statement following the word default.P1474. A(n) _ statement, as its name implies, forces an immediate break, or exit, from switch and for statements only.Answer: break5. Once an entry point has been located by the switch statement, no further case evaluations are done; this means that unless a(n) _ statement is encountered, all statements that follow, until the closing brace of the switch statement, will be executed.Answer: break Chapter 5 RepetitionQuick Quiz 119. What is a loop?Answer: A section of code that is repeated is referred to as a loop, because after the last statement in the code is executed, the program branches, or loops, back to the first statement and starts another repetition through the code.20. In a(n) _ loop, which is also known as a fixed-count loop, the condition is used to keep track of the number of repetitions that have occurred.Answer: counter-controlled21. The repetition statements are the while statement, _, and do-while statement.Answer: for statement22. What is a program loop?Answer: The transfer of control back to the start of a while statement to reevaluate the expression is known as a program loop.23. A(n) _ loop is a condition-controlled loop where one specific value is required to terminate the loop.Answer: sentinel-controlledQuick Quiz 21. In computer programming, data values used to signal either the start or end of a data series are called _.Answer: sentinels2. While statements produce _ loops since the condition is evaluated before the repeating section of code.Answer: entrance-controlled3. On IBM-compatible computers, the EOF mark is generated whenever the _ keys are pressed simultaneously.Answer: Ctrl and Z4. How does a break statement work?Answer: A break statement, as its name implies, forces an immediate break, or exit, from switch, while, for, and do-while statements only.5. What happens if you omit the tested expression in a for loop?Answer: Although the initializing and altering lists can be omitted from a for statement, omitting the tested expression results in an infinite loop.Quick Quiz 31. What is a nested loop?Answer: There are many situations in which it is very convenient to have a loop contained within another loop. Such loops are called nested loops.2. The second loop of a nested loop is called the _ loop.Answer: inner3. A(n) _ statement always creates a posttest loop.Answer: do-while4. A(n)_statement causes an immediate exit from a repetition or selection statement.Answer: break5. What type of application is ideally suited for a posttest loop?Answer: There is one type of application that is ideally suited for a posttest loop, which is the input data validation application. Chapter 61、What is the difference between a called function and a calling function?Answer: A function that is called or summoned into action by its reference in another function is a called function. A function that calls another function is referred to as the calling function.2、The items enclosed within the parentheses in a function call statement are called _ of the function.Answer: argumentsactual argumentsactual parameters3、What is a pass by value?Answer: When a function simply receives copies of the values of each of the arguments and must determine where to store these values before it does anything else, this is known as a pass by value (or a call by value).4、The argument names in the header line of a function are known as _.Answer: parametersformal parametersformal arguments5、A(n) _ is the beginning of a final function that is used as a placeholder for the final function until the function is completed.Answer: stub6、Pass by value is also referred to as _.Answer: call by value7、How can you return a value from a function?Answer: To return a value you use a return statement. For example, return expression; or return (expression);8、How do you write the prototype of a function with an empty parameter list?Answer: The prototype for a function with an empty parameter list requires either writing the keyword void or nothing at all between the parentheses following the functions name.9、What are random numbers?Answer: Random numbers are a series of numbers whose order cannot be predicted.10、What are pseudorandom numbers?Answer: Pseudorandom numbers are numbers which are not really random, but are sufficiently random for the task at hand.11、The method for adjusting the random numbers produced by a random-number generator to reside within a specified range is called _.Answer: scaling12、The standard library consists of _ header files.Answer: 1513、Write a function named findAbs() that accepts a double-precision number passed to it, computes its absolute value, and displays the absolute value. The absolute value of a number is the number itself if the number is positive, and the negative of the number if the number is negative.Answer: void findAbs(double num) double absValue;if(num 0) absValue = -num;else absValue = num;printf(nThe absolute value of %lf is %lf, num, absValue); return; 14、Write a function named squareIt() that computes the square of the value passed to it and displays the result. The function should be capable of squaring numbers with decimal points.Answer: void squareIt(float num) printf ( nThe square of %f is %fn, num, num*num );15、Write a C function that accepts an integer argument, determines whether the passed integer is even or odd, and displays an appropriate message indicating the result of its determination.(Hint: Use the % operator.)Answer: void evenOdd(int num) if(num % 2 = 0)printf(%d is even, num);elseprintf(%d is odd, num); return;16、Write a function named gallonsToLiters() that converts gallons of liquid to liters using the relationship that there are 3.7854 liters to the gallon.Include the function written in a working C program. Make sure your function is called from main() and correctly returns a value to main(). Have main() display the value returned and test the function by passing various data to it and verifying the returned value.Answer: #include int main() float gallonsToLiters(float); /* function prototype */ float gallons, liters; printf(nEnter the number of gallons: ); scanf(%f, &gallons); liters = gallonsToLiters(gallons); printf(The equivalent number of liters is %fn,liters); return 0;float gallonsToLiters(float gals) return gals*3.7854;17、A second-degree polynomial in x is given by the expression ax2+bx+c, where a, b, and c are known numbers and a is not equal to (). Write a C function named polyTwo(a, b, c, x) that computes and returns the value of a second-degree polynomial for any passed values of a, b, c, and x.Include the function written in a working C program. Make sure your function is called from main() and correctly returns a value to main(). Have main() display the value returned. Test the function by passing various data to it.Answer: #include float polyTwo ( float, float, fl
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 暖春观后感合集15篇
- 教师自我鉴定500字左右10篇
- 本科毕业生自我鉴定6篇
- 2024国开电大【安全技术与管专业】《安全原理》形考任务1234答案(陕西)
- 土建监理员个人年终总结
- 17GRC装饰线条制作与施工协议样本(2024年版)一
- 关联词的用法及举例
- 关于广告的英语
- 《基本卫生保健》课件
- 年轻男性瘫痪护理常规
- 动画制作员职业技能大赛考试题库(浓缩500题)
- 房屋租赁合同
- 湖北省十一校2024-2025学年高三上学期第一次联考物理试卷 含解析
- 12《富起来到强起来》第一课时(说课稿)统编版道德与法治五年级下册
- 【初中道法】拥有积极的人生态度(课件)-2024-2025学年七年级道德与法治上册(统编版2024)
- 销售团队员工转正考核方案
- 佣金返还合同范例版
- 2023年民航湖北空管分局招聘考试真题
- 院感相关知识培训内容
- 化疗药物外渗的预防及处理-4
- 初一《皇帝的新装》课本剧剧本
评论
0/150
提交评论