C++复习资料1(101页).doc





《C++复习资料1(101页).doc》由会员分享,可在线阅读,更多相关《C++复习资料1(101页).doc(106页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、-1.1 Fill in the blanks in each of the following:a. The company that popularized personal computing was _ Apple._b. The computer that made personal computing legitimate in business andindustry was the _IBM Personal Computerc. Computers process data under the control of sets of instructions calledcom
2、puter _programs_.d. The six key logical units of the computer are the _input unit_, _output unit,_memory unit_, _arithmetic and logic unit_, _central processing unit_ and the _secondary storage unit_e. The three classes of languages discussed in the chapter are _machine languages_,_assembly language
3、s_, and _high-level languages_.f. The programs that translate high-level language programs into machinelanguage are called _compilers_.g. C is widely known as the development language of the _UNIX_ operatingsystem.h. The _Pascal_ language was developed by Wirth for teaching structuredprogramming.i.
4、The Department of Defense developed the Ada language with a capabilitycalled _multitasking._, which allows programmers to specify that many activities canproceed in parallel.1.2 Fill in the blanks in each of the following sentences about the C+ environment.a. C+ programs are normally typed into a co
5、mputer using a(n) _editor._program.b. In a C+ system, a(n) _preprocessor_ program executes before the compilerstranslation phase begins.c. The _linker_ program combines the output of the compiler with variouslibrary functions to produce an executable image.d. The _loader._ program transfers the exec
6、utable image of a C+ program fromdisk to memory.1.3 Fill in the blanks in each of the following statements a. Objects have the property of _information hiding _ although objects may know how tocommunicate with one another across well-defined interfaces, they normallyare not allowed to know how other
7、 objects are implemented.b. C+ programmers concentrate on creating _classes_, which contain datamembers and the member functions that manipulate those data members andprovide services to clients.c. Classes can have relationships with other classes. These relationships are called_associations_.d. The
8、 process of analyzing and designing a system from an object-oriented pointof view is called _object-oriented analysis and design (OOAD)._.e. OOD also takes advantage of _inheritance_ relationships, where new classes ofobjects are derived by absorbing characteristics of existing classes, then addingu
9、nique characteristics of their own.f. _The Unified Modeling Language (UML)_ is a graphical language that allows people who design softwaresystems to use an industry-standard notation to represent them.g. The size, shape, color and weight of an object are considered _attributes_ of theobject.1.7 Why
10、is so much attention today focused on object-oriented programming in general and C+ in particular?ANS1:Object-oriented programming enables the programmer to build reusablesoftwarecomponents that model items in the real world. Building software quickly, correctly,andeconomically has been an elusive g
11、oal in the software industry. The modular, object-orienteddesign and implementation approach has been found to increase productivity while reducingdevelopment time, errors, and cost.ANS2: In object-oriented programming, the source code is organized in classes and objects, whichis easy to be mapping
12、into the items in physical world. It is easy to design, reuse and maintainsuch kind of software in large scale software development, which is favored by the softwareindustry.【参考教材的答案】面向对象的编程让编程者可以建立可重用的软件组件,这些组件是现实世界事物的抽象模型。软件工业的目标是快速、正确、有效率的开发软件。面向对象的设计和实现方法模型已经被事实证明是可以提高生产效率和减少开发时间、错误和代价。【参考讲义的答案】
13、面向对象的编程方法中,以类和对象来组织源代码,可以方便的实现与现实物理世界事物的映射。采用这种方法,易于在大型软件开发中进行软件的设计、重用和维护,因此受到软件行业的支持和采用。1.10 You are probably wearing on your wrist one of the worlds most common types of objectsa watch. Discuss how each of the following terms and concepts applies to the notion of a watch: object, attributes, behav
14、iors, class, inheritance (consider, forexample, an alarm clock), abstraction, modeling, messages, encapsulation, interface,information hiding, data members and member functions.1.10 可能现在你的手腕上就戴着世界上最普遍的对象类型之一手表。论述以下这些术语和概念如何应用于手表这个概念上:对象、属性、行为、类、继承(例如,考虑闹钟)、封装、接口、信息隐藏、数据成员和成员函数。ANS:The entire watch i
15、s an object that is composed of many other objects (such as the moving parts, the band, the face, etc.)Watch attributes are time, color, band, style (digital or analog), etc. The behaviors of the watch include setting the time and getting the time, A watch can be considered a specific type of clock(
16、as can an alarm clock), With that in mind, it is possible that a class called Clock could exist from which other classes such as watch and alarm clock can inherit the basic features in the clock. The watch is an abstraction of the mechanics needed to keep track of the time. The user of the watch doe
17、s not need to know the mechanics of the watch in order to use it; the user only needs to know that the watch keeps the proper time. In this sense,the mechanics of the watch are encapsulated(hidden)inside the watch. The interface to the watch(its face and controls for setting the time) allows the use
18、r to set and get the time. The user is not allowed to directly touch the internal mechanics of the watch. All interaction with the internal mechanics is controlled by the interface to the watch. The data members stored in the watch are hidden inside the watch and the member functions(looking at the
19、face to get the time and setting the time) provide the interface to the data.2.1 Fill in the blanks in each of the following.a. Every C+ program begins execution at the function _main_.b. The _left brace ()_ begins the body of every function and the _ right brace ()_ ends the body of every function.
20、c. Every C+ statement ends with a(n) _ semicolon_.d. The escape sequence n represents the _ newline._ character, which causes the cursor to position to the beginning of the next line on the screen.e. The _ if._ statement is used to make decisions.2.2 State whether each of the following is true or fa
21、lse. If false, explain why. Assume the statement using std:cout; is used.a. Comments cause the computer to print the text after the / on the screen when theprogram is executed.b. The escape sequence n, when output with cout and the stream insertion operator,causes the cursor to position to the begin
22、ning of the next line on the screen.c. All variables must be declared before they are used.d. All variables must be given a type when they are declared.e. C+ considers the variables number and NuMbEr to be identical.f. Declarations can appear almost anywhere in the body of a C+ function.g. The modul
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 复习资料 101

限制150内