已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Test Bank for Problem Solving with C+: The Object of Programming, 6/e Chapter 4 Procedural Abstraction and Functions That Return a ValueTRUE FALSE1. A function may return more than one item ANSWER: False2. function naming rules follow variable naming rules ANSWER: TRUE3. Every include directive must be followed by using namespace std; ANSWER: False4. the types of parameters are optional in the function declaration ANSWER: False5. the parameter names are mandatory in the function header ANSWER: False6. it is possible to have a function that has no parameters ANSWER: TRUE7. the parameters listed in the function declaration are considered global variables ANSWER: False8. variables that are declared outside of any function body or parameter list are considered global. ANSWER: TRUE9. pow(2,3) is the same as pow(3,2). ANSWER: False10. Functions may have multiple return statements. ANSWER: TRUEFill In the Blank1. #include is known as an _.ANSWER: include directive2. The absolute value function abs is located in the _ library.ANSWER: cstdlib3. Converting from one type to another is called _.ANSWER: casting4. What is the value of (pow(2,sqrt(9.0)+ceil(0.99)? _ANSWER: 165. Write the code to convert the value in an integer variable named count to a double. _.ANSWER: static_cast(count)6. In the following function declaration, the variable size is known as a _.int myFunction ( int size);ANSWER: (formal) parameter7. The _ describes how the function will work.ANSWER: function body8. When you want to use a function in your program, you would make a function _.ANSWER: call or invocation9. What is the output produced by the following code fragment? int i = 3;cout The value of i is sqrt(pow(i,4.0) endl;ANSWER: 9.010. The black box analagy demonstrates the concept of _.ANSWER: information hiding or procedural abstraction11. A problem-solving approach that starts with the big problem and breaks it down into smaller pieces is called _.ANSWER: top-down approach12. Algorithms are typically described in _.ANSWER: psuedocode13. Varibles that are declared inside a function are said to be _ to that function.ANSWER: local14. The _ of a variable is where that variable can be used.ANSWER: scope15. Constant variables that might be used in different functions should be _ANSWER: globalMultiple Choice1. What is the value of x after the following code fragment executes?float x = 36.0;x = sqrt(x);a. 36.0b. 6.0c. 3.0d. 2.456ANSWER: B2. What is the output of the following program fragment?cout pow(4,2) endl;a. 4b. 2c. 8d. 16ANSWER: D3. What is the output of the following program fragment?cout static_cast(3)/4 endl;a. 3b. 0.5c. 0d. 0.75ANSWER: D4. using namespace std; tells the compilera. where to get the definitions of certain objects (variables)b. where your program is locatedc. what language to use for input and outputd. nothingANSWER: A5. the fabs(double num) function a. returns the most fabulous numberb. returns the largest whole number = numc. returns the negative value of numd. returns the absolute value of num ANSWER: D6. What is the output of the following program fragment?cout static_cast(3/4) endl;a. 3b. 0.5c. 0.0d. 0.75ANSWER: C7. If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an appropriate function declaration?a. int calculateCost(char name);b. char calculateCost(int count);c. int calculateCost int count;d. int calculateCost(int count);ANSWER: D8. What is the value returned by the following function?int function()int value = 35;return value + 5;value += 10;a. 35b. 40c. 50d. 10ANSWER: B9. When overloading a function, what must be true?a. The names should be different with the same number and/or types of parameters.b. The names should be the same with different number and/or types of parameters.c. The names should be different with different number and/or types of parameters.d. The names should be the same with the same number and/or types of parameters.ANSWER: B10. When parameters are passed between the calling code and the called function, parameters and arguments are matched by:a. their data typesb. their relative positions in the parameter and argument listsc. their namesd. they are not matched up at all.11. If you have the two functions as shown, int someFunction(int value); float someFunction(float value); and a variable x, which is a double, which function is called by the following statement? cout someFunction(x);a. void someFunction(int value);b. void someFunction(float value);c. Nothing, it is a syntax errord. both functions are calledANSWER: C12. Which of the following are valid function calls to the fabs function?a. fabs(3.5);b. cout fabs(3.5);d. fabs(cin x);e. a,b and cf. a and bANSWER: F13. Multiple arguments to a function are separated bya. commentsb. semicolonsc. colonsd. commase. periodsANSWER: D14. The functions pow(), sqrt(), and fabs() are found in which include file?a. cstdlibb. cmathc. iostreamd. regularANSWER: B15. The expression static_cast(3) is called aa. type castb. nultiplierc. doublerd. polymorphismANSWER: A16. If the variable x has the original value of 3.4, what is the value in x after the following?cout static_cast(x);a. 3.4b. 4c. unknownd. 3ANSWER: D17. What is the value of the following?floor(4.999) + ceil(2.0)a. 6.999b. 7.0c. 6.0d. 8.0ANSWER: C18. What is the value of the following?sqrt(sqrt(pow(2,4);a. 1b. 2c. 4d. 16ANSWER: B19. Using functions in a program is known asa. data abstractionb. procedural abstractionc. poor programming styled. calculusANSWER: B20. Which of the following are valid function calls to the pow function?a. pow(int x, int y);b. pow(2);c. pow(1.1,3.0);d. double pow(1.1,3.0);ANSWER: C21. If you have the following variable declaration in your program,const int SIZE=34; then which of the following statements are legal?a. SIZE +;b. x = SIZE-;c. cout SIZE;ANSWER: C22. In the function declaration shown, the mechanism used to call this function is known as:double pow(double base, double exp);a. pass by nameb. pass by valuec. pass by named. call by nameANSWER: B23. What is the value of i after the following function call?/function definitionint doSomething(int value)value = 35;return value;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 区块链平台部署实施方案
- 2025年农业智能农业机械控制系统实施方案
- 2025年智慧农业智能化推进实施方案
- 医药电商平台规划方案
- 企业人力资源管理方案
- 客户关系管理与服务水平提升方案
- 2026-2031中国除草剂市场深度评估与发展机遇研究报告
- 2026-2031中国轨道交通市场分析及投资战略研究预测可行性报告
- 2026-2031中国光发射机行业市场监测与发展前景预测报告
- 2026-2031中国公关行业运营态势研究报告
- 仓库管理员面试题及答案
- 2026品牌营销日历【营销节点】
- 人体七大营养素概述
- 2025宁夏建设投资集团有限公司“集中招聘”524人笔试历年常考点试题专练附带答案详解2套试卷
- 2025-2026学年上海格致中学(五四制)九年级(上)第一次月考语文试题及答案
- 2025广东惠州市博罗县自然资源局招聘编外人员76人考试笔试备考试题及答案解析
- 2025年乌鲁木齐市招聘警务辅助人员(600人)笔试考试备考题库及答案解析
- 2025年大学《管理科学-管理建模与仿真》考试模拟试题及答案解析
- 2025贵州安顺市公安机关第二批招聘警务辅助人员116人笔试考试备考试题及答案解析
- 动漫分镜美术课件
- 业务提成返还协议书
评论
0/150
提交评论