版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Assessment Name: Multiple-Choice Quiz 1 1. Which of the following Visual C+ objects are contained within a Project? I.Files II.Visual C+ Solutions III.Flow charts (b) I, II and III (c) I only (d) II and III only Correct answer is (c) 2. Integrated programming environments make it difficult to mix an
2、d match tools from different sources. This is (a) good, because tools from different sources cannot be made to interact with each other (b) good, because it ensures compilation is not done incrementally by accident (c) bad, because all the tools will then have the same user interface (d) bad, becaus
3、e no single vendor is likely to be the source of all the best tools Correct answer is (d) 3. When debugging using Visual C+, which of the following are possible through the Watch window? I.The programs execution can be stopped. II.The value of an arbitrary C expression can be calculated. III.The val
4、ue of a program variable can be set. (a) II only (b) II and III only (c) III only (d) I, II, and III. Correct answer is (b) 4. When using a debugger to find the cause of a programs incorrect behavior, (a) it is often necessary to start the program multiple times under the debugger (b) the program is
5、 usually executed to the point at which the behavior occurs and then executed backwards to find the cause (c) it is fastest to start by stopping the debugger long before the behavior appears (d) the faulty code fragment must first be identified Correct answer is (a) 5. Consider the following program
6、. int i;int * jp = &i;int main(int i, char * argv) printf(%d %dn, (int) &i, (int) jp);Which of the following describes what it prints? (a) nothing: it will not compile because it is ambiguous (b) two integers that are exactly the same (c) two very different integers (d) two values, one 4 greater tha
7、n the other Correct answer is (c) 6. What is printed as a result of execution of the following program? #include void callee(int * count) (*count)+;int main (int argc, char *argv) int count = 4; callee(&count); printf(%d, count); return 0; (a) 4 (b) It cannot be determined from the information given
8、. (c) 8 (d) 5 Correct answer is (d) 7. (注意与6的区别) What does the following program print? void callee(int * count) (*count)+;int main (int argc, char *argv) int count = 4; callee(count); printf(%d, count); return 0; (a) 5 (b) nothing: it will not compile successfully (c) 8 (d) 4 Correct answer is (b)
9、8. Consider the following program. int i;int j = 1;int callee(int number) int plusone; plusone = number + 1; return plusone;int main (int argc, char *argv) if (j = 1) return callee(i); return j;Which of the following are allocated in the activation record immediately after the function callee() is i
10、nvoked? (a) plusone and number only. (b) i only. (c) plusone only. (d) i, j and number only. Correct answer is (a) 9. The Visual C+ Memory window displays (a) the contents of memory, interpreted as 32-bit integers, without the associated variable names (b) the names and values of variables in memory
11、, interpreted as 32-bit integers no matter what the variables types (c) the contents of memory, interpreted in one of several ways, without the associated variable names (d) the names and values of variables in memory, interpreted in one of several ways Correct answer is (c) 10. In a computer in whi
12、ch both addresses and integers are 32 bits wide, how many bytes of memory will the compiler allocate for following code fragment? int a;int * b = &a; (a) 32 (b) 4 (c) 0 (d) 8 Correct answer is (d) 11. Which of the following are true of the effect that optimizations have on the machine code generated
13、 by compilers? I.The resulting code will be faster and/or smaller. II.The resulting code will be clearer. III.The resulting code will be harder to debug. (a) I and II only (b) I only (c) I, II, and III (d) I and III only Correct answer is (d) 12. Which of the following computations may be performed
14、by exactly one CPU instruction? I.a = 5; II.a = b + c * 5; III.for (i = 0; i msg x y;cout x + y;Which of the following is (are) true regarding execution of the segment? I.The input statement will always take the same amount of time to execute. II.The output statement will always be executed immediat
15、ely after the input statement. III.If x and y are both positive, an integer greater than both will be printed. (a) I and II only (b) none (c) II and III only (d) II only Correct answer is (b) 27.When using a debugger to find the cause of a programs incorrect behavior, (a) the program is usually exec
16、uted to the point at which the behavior occurs and then executed backwards to find the cause (b) the faulty code fragment must first be identified (c) it is fastest to start by stopping the debugger long before the behavior appears (d) it is often necessary to start the program multiple times under
17、the debugger Correct answer is (d) 28.Consider the following program. int square(int * arg) int n = * arg; return n * n;int main (int argc, char * argv) int arg = strtol(argv1, NULL, 0); return square(arg);When it is executed with the argument 5, the variable n is allocated to (a) many addresses cho
18、sen by the compiler. (b) exactly one address chosen by the compiler. (c) exactly one address not known to the compiler. (d) many addresses neither of which are known to the compiler. Correct answer is (c) 29. Consider the following code fragment. int a;int b;int main(int argc, char *argv) int c; int
19、 d; . /* some code */Which of the following must be true? (a) The value of *d is closer to the value of *c than to the value of *a. (b) The values of *a and *b are closer to each other than the values of *c and *d. (c) The value of &d is closer to the value of &c than to the value of &a. (d) The val
20、ues of &a and &b are closer to each other than the values of &c and &d. Correct answer is (c) 30. Which of the following is a good reason (are good reasons) to equip the CPU with small amounts of fast memory? I.To make the design of the compiler simpler II.To make some CPU instructions smaller III.T
21、o make some CPU instructions faster (a) III only (b) I, II, and III (c) II only (d) II and III only Correct answer is (d) 31.Immediately after the CPU executes an instruction that is neither a branch nor a jump instruction, the program counter (a) has a value that cannot be determined without furthe
22、r information (b) is incremented to point to the following instruction (c) remains unchanged (d) is incremented by one Correct answer is (b) 32.A branch instruction (a) sets the program counter to one of two possible values (b) sets the program counter to one of many possible values (c) increases th
23、e program counter by a fixed amount (d) unconditionally sets the program counter to its operand Correct answer is (a) 33.Compared to a sequence of machine code instructions, a fragment of C code (a) may describe the same algorithm (b) describes the actions of the computer, not just of the CPU (c) is
24、 the native way to program most computers (d) does not engage any transistors during its execution Correct answer is (a)35.When executing a function callee(), which of the following are true regarding the value of the frame pointer? I.It marks the top of the stack frame of the function that invoked
25、callee(). II.It marks the bottom of the stack frame of callee() III.It is the top of the stack. (a) I and II only (b) III only (c) II only (d) I only Correct answer is (a) 36.At which of the following times is an activation record created? I.When a program starts executing. II.Every time a function
26、is invoked. III.When a variable is declared. (a) III only (b) I and II only (c) II and III only (d) II only Correct answer is (b) 37.In one computer, the bytes with addresses A, A+1, A+2 and A+3 contain the integer 256, and the variable declared with int * a; has the value A. In a different computer
27、, the bytes with addresses B, B+1, B+2 and B+3 also contain the integer 256, and the variable declared with int * b has the value B. Which of the following are necessarily true? I.The contents of A+1 are equal to the contents of B+1. II.The contents of A+1 are equal to the contents of B+2. III.*a =
28、*b (a) II and III only (b) I and III only (c) I only (d) III only Correct answer is (d)38.The program counter contains (a) the address of the CPU instruction that is about to be executed (b) the number of CPU instructions a program has executed so far (c) the amount of memory a program is currently
29、using (d) the number of times a program has been executed Correct answer is (a) 39.Within Visual C+, which of the following will reveal the value of a variable when the program is stopped at a breakpoint? I.Placing the mouse pointer over the variable name in the source file window. II.Inserting a pr
30、intf() in the program. III.Typing the variable name on the Watch window. (a) III only (b) I and III only (c) I, II, and III (d) II and III only Correct answer is (b) 40.A CPU register is a word of CPU memory that (a) is explicitly loaded and unloaded from normal memory by compiler-generated instruct
31、ions (b) records the results of periodic CPU diagnostics (c) houses a critical variable for the duration of the execution of a program (d) is automatically loaded when a CPU instruction refers to a word of normal memory Correct answer is (a) 40. Compared to a sequence of machine code instructions, a
32、 fragment of C code (a) does not engage any transistors during its execution(b) may describe the same algorithm(c) describes the actions of the computer, not just of the CPU(d) is the native way to program most computersCorrect answer is (b)41. Which of the following must be true if a program is sto
33、pped at a specific line within the Visual C+ debugger? I. There is at least one breakpoint enabled. II. There is a breakpoint enabled on that line. III. There is a breakpoint enabled on the line preceding that line.(a) I only(b) I and II only(c) I and III only(d) noneCorrect answer is (d)42. A jump
34、instruction (a) increases the program counter(b) changes the program counter only if its operand is equal to zero(c) unconditionally sets the program counter to its operand(d) changes a pointer to point to the next element of an arrayCorrect answer is (c)43. Which of the following is able to describ
35、e a computation at the highest level of abstraction? (a) logic Gates(b) machine code(c) C+ code(d) C codeCorrect answer is (c)44. How many return addresses does a C function have as a program executes? (a) one(b) as many as the number of times it is invoked(c) as many as the number of return stateme
36、nts within the function(d) two, one for each branchCorrect answer is (b)42. Which of the following statements properly allocates an array of 100 integers? (a) int A = new int100;(b) int *A = new (int) 100;(c) int *A = new int100;(d) int &A = new int100;Correct answer is (c)43. Valid comments in C+ i
37、nclude which of the following? 1. /* comment */ 2. / comment 3. / comment(a) I and III only(b) I and II only(c) II and III only(d) I, II, and IIICorrect answer is (a)44. Each of the following is a basic C+ type except (a) bool(b) char(c) unsigned int(d) byteCorrect answer is (d)45. Which of the foll
38、owing statements might be produced by the decomposition of a problem into objects and relationships? 1. A is a type of B 2. A B contains a C(a) I and II(b) None(c) II only(d) I onlyCorrect answer is (a)46. Suppose inf is an available ifstream and c is an available character. Consider the following c
39、ode fragment. do c = inf.get(); while (!inf.eof() & isspace(c);Which of the following accurately describes the effect of executing this fragment?(a) Characters are read until the end of the file is reached.(b) Characters are read until a non-white-space character is read or until the end of the file
40、 is reached.(c) The number of non-white-space characters is counted.(d) Characters are read until a white space is read.Correct answer is (b)47. In C+, the standard input stream is accessible using the object _, and the standard output stream is accessible using the object _.(a) stdin, stdout(b) keyboard, screen(c) input, output(d) cin, coutCorrect answer is (d)48. Consider the following C+ program segment. #include #include using namespace std; int main(int argc, char* argv) return EXIT_SUCCESS; The first two lines of this program segment typica
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 苏教版五年级上册数学《解决问题的策略》常考易错题专项汇编(含详细解析)
- 重庆市铜梁区教育事业单位应届毕业公费师范生招聘考试真题2025
- 2025年温州市乐清市教育局招聘高中教师真题
- 2025年滁州市来安县人民法院招聘政府购买服务人员真题
- 初中语文作文讲义 第9讲 如何使文章更有文采(含答案)
- 数据采集与监控系统安全管理制度
- 术前皮肤准备护理技术操作常见并发症的预防和处理规范
- 教学事故认定与处理流程
- 关于加强交通运输应急救援体系建设的指导意见
- 槟榔精深加工建设项目环评报告表
- 淤血肝超声诊断规范
- DZ/T 0275.4-2015岩矿鉴定技术规范第4部分:岩石薄片鉴定
- 《陆上风电场工程概算定额》NBT 31010-2019
- 超短波在智能制造的应用
- BS EN ISO 15848-1-2015 工业阀-逸散性排放的测量、试验和鉴定程序(中文)
- 首饰失蜡铸造工艺流程
- 新人教版七年级上册英语预备篇测试题附答案
- SB/T 11091-2014冷库节能运行技术规范
- GB/T 5185-2005焊接及相关工艺方法代号
- GB/T 34910.2-2017海洋可再生能源资源调查与评估指南第2部分:潮汐能
- 信用风险缓释工具课件
评论
0/150
提交评论