面向对象程序设计C自学考试课程复习题
(07837)《面向对象程序设计C++》复习题 一、单选题 1.对类成员访问权限的控制,是通过设置成员的访问控制属性实现的,下列不是访问控制属性的是( D ) A. 公有类型 B. 私有类型 C. 保护类型 D. 友元类型 2.下列关于多态性的描述,错误的是( C ) A. C++语言的多态性分为编译时的多态性和运行时的多态性 B. 编译时的多态性可通过函数重载实现 C. 运行时的多态性可通过模板和虚函数实现 D. 实现运行时多态性的机制称为动态绑定 3.在C++语言中,数据封装要解决的问题是( D ) A. 数据的规范化 B. 便于数据转换 C. 避免数据丢失 D. 防止不同模块之间数据的非法访问 4.使用private修饰的成员变量,以下说法正确的是( A ) A. 只能由本类中的函数使用,不能被外面的程序所访问。 B. 可以由本类中的函数使用,也可以被外面的程序所访问。 C. 只能由本类和派生类中的函数使用。 D. 可以在主函数中使用。 5.对类的构造函数和析构函数描述正确的是( A ) A. 构造函数可以重载,析构函数不能重载 B. 构造函数不能重载,析构函数可以重载 C. 构造函数可以重载,析构函数也可以重载 D. 构造函数不能重载,析构函数也不能重载 6.下面对静态数据成员的描述中,正确的是( A ) A. 静态数据成员是类的所有对象共享的数据 B. 类的每个对象都有自己的静态数据成员 C. 类的不同对象有不同的静态数据成员值 D. 静态数据成员不能通过类的对象调用 7.在VC++语言类体系中,不能被派生类继承的有( B ) A. 转换函数 B. 构造函数 C. 虚函数 D. 静态成员函数 8.下面关于句柄正确的说法是( A ) A. 句柄是一个标识Windows资源和设备等对象的变量。 B. 句柄是用户程序自定义的数据类型。 C. 用户程序使用句柄时不需要定义。 D. 句柄仅仅是一个抽象的概念,程序中不能使用句柄。 9.下面关于动态链接库正确的说法是( B ) A. 动态链接库提供的函数,在编译阶段能够连接到应用程序中。 B. 动态链接库提供的函数,在运行阶段能够连接到应用程序中。 C. 动态链接库本身不能单独设计、编译和调试。 D. 动态链接库的使用使得程序缺乏灵活性。 10.下面关于MFC应用程序中InitInstance函数正确的说法是( D ) A. 该函数由用户定义。
面向对象程序设计(答案)
学号:姓名: 第三章面向对象程序设计作业 一、判断题 1、一个Java源程序可有多个类,但只仅有一个public类,而且程序名与public类名相同。对 2、如果类A和类B在同一个包中,则除了私有成员外,类A可以访问类B中所有的成员。对 3、接口中的成员变量全部为常量,方法为抽象方法。对 4、抽象类可以有构造方法,可以直接实例化。错 5、对static方法的调用可以不需要类实例。对 6、包含抽象方法的类一定是抽象类。对 7、方法中的形参可以和方法所属类的属性同名。对 8、接口无构造器,不能有实例,也不能定义常量。错 9、类的实例对象的生命周括实例对象的创建、使用、废弃、垃圾的回收。对 10、Java应用程序的入口main方法只有一种定义法。对 二、选择题 1、下列答案正确的是(A ) A) 在同一个Java源文件中可以包含多个类,只能有一个被声明为public B) 在同一个Java源文件中只能包含一个类,并被声明为public C) 在同一个Java源文件中可以包含多个类,都可以被声明为public D) 在同一个Java源文件中可以包含多个类,只能有一个被声明为default 2、Java实现动态多态性是通过( B )实现的。 A) 重载B) 覆盖 C) 接口D) 抽象类 3、下列哪一个是正确的方法重载描述( A ) A) 重载方法的参数类型必须不同 B) 重载方法的参数名称必须不同 C) 返回值类型必须不同 D) 修饰词必须不同 4、final关键字不可以用来修饰( D ) A) 类B) 成员方法 C) 域D) 接口 5、接口的所有成员方法都具有( B )属性 A) private, final B) public, abstract C) static, protected D) static 6、Java的封装性是通过(A )实现的 A) 访问控制B) 设计内部类 C) 静态域和静态方法D) 包 7、下列接口或类不属于.*包的是( D ) A) Collection B)Vector C) Map D) Integer 8、下述哪一组方法,是一个类中方法重载的正确写法( A ) A) int addValue( int a, int b ){return a+b;}
刘润清《新编语言学教程》笔记和课后习题(认知语言学)【圣才出品】
第10章认知语言学 10.1 复习笔记 本章要点: 1. Cognitive linguistics 认知语言学 2. Categorization and categories 范畴化与范畴 3. Conceptual metaphor and metonymy 概念隐喻与转喻 4. Iconicity and grammaticalization 象似性与语法化 常考考点: 认知语言学定义;范畴化与范畴定义分类等;概念隐喻与转喻的定义,层次分类;象似性的分类以及语法化等。 本章内容索引: I. Definition of cognitive linguistics II. Categorization and categories
1. Definition of categorization 2. The classical theory 3. The prototype theory 4. Levels of categorization III. Conceptual metaphor and metonymy 1. Conceptual metaphor 2. Conceptual metonymy IV. Iconicity 1. Iconicity of order 2. Iconicity of distance 3. Iconicity of complexity V. Grammaticalization I. Definition of cognitive linguistics (认知语言学定义) 【考点:名词解释】 Cognitive linguistics is an approach to the analysis of natural language that focuses on language as an instrument for organizing, processing, and conveying information. 认知语言学是一种研究自然语言的方法,集中研究语言组织,处理与传达信息的作用。 II. Categorization and categories (范畴化与范畴) 1. Definition of categorization and categories (定义)
《C面向对象程序设计》谭浩强版复习总结
第一章C++ 基础 endl 换行并刷新输出流 setw(n) 设置字段位数为n hex,oct,dec 十六进制,八进制,十进制表示 setfill 定义填充字符 setprecision 定义浮点数的精度 left,right 左对齐,右对齐 showpoint 强制显示小数点以及全部尾部0 C++通过给常量命名的方式定义常量: const<数据类型名><常量名>=<表达式> 用const定义的标识符常量时,一定要对其初始化。在说明时进行初始化是对这种常量置值的唯一方法,不能用赋值运算符对这种常量进行赋值。 函数声明的一般形式为 函数类型函数名(参数表) 函数模板的定义 template 函数定义 例子:template T max(T a,T b){ return(a>b)? a:b; } 定义函数模板时可以使用多个类型参数,每个类型参数前面只需加上关键字typename或class,用逗号分隔: template
例子:template T1 max(T1 a,T2 b){ return (a>b) ? a : (T1)b; } 有默认参数的函数:实参与形参的结合是从左至右进行的,因此指定默认值的参数必须放在形参列表中的最右端 引用 定义对变量起另外一个名字(别名alias),这个名字称为该变量的引用。 <类型> &<引用变量名> = <原变量名>; 其中原变量名必须是一个已定义过的变量。如: int max ; int &refmax=max; refmax并没有重新在内存中开辟单元,只是引用max的单元。max与refmax在内存中占用同一地址,即同一地址两个名字。 对引用类型的变量,说明以下几点: 1、引用在定义的时候要初始化 2、对引用的操作就是对被引用的变量的操作。 3、引用类型变量的初始化值不能是一个常数。 4、一旦引用被声明,它就不能再指向其它的变量。 5、对引用的初始化,可以用一个变量名,也可以用另一个引用。 6、引用同变量一样有地址,可以对其地址进行操作,即将其地址赋给一指针。 当&m的前面有类型符时(如int &m),它必然是对引用的声明;如果前面无类型符(如cout<<&m),则是取变量的地址。 7、对常量(用const声明)的引用使用如下方式: int i=5; const int &a=i;
c+面向对象程序设计试题和答案题目
系名___ ___ ___ ___ 班级___ ___ ___ ___姓名___ ___ ___ ___学号___ ___ ___ ___ 密 封 线 内 不 答 题 一、填空题(每空1分,共14分) 1、观看以下程序: class point{ public: void show() {cout<<”point”<面向对象程序设计课后答案(完整版)
第二章2-4 #include using namespace std; Add(int a,int b); int main() { int x,y,sum; cout<<"please input x and y:"; cin>>x>>y; sum = add(x,y); cout < using namespace std; int main() {
int *p,*init; int countp=0; int countn=0; p = new int[20]; init = p; for(int i=0;i<20;i++) { cin>>*p; p++; } p = p-20; for( i=0;i<20;i++) { if(*p>0) countp++; if(*p<0) countn++; cout<<*p<<" "; p++; } cout<<"正数有:"< //#include using namespace std; void checkagescore(string name,int age) { if (name == "exit") throw name; if(age<0||age>50) throw age;
新编语言学教程第2版第4章答案
《新编简明英语语言学教程》第二版第4章练习题参考答案Chapter 4 Syntax 1. What is syntax? Syntax is a branch of linguistics that studies how words are combined to form sentences and the rules that govern the formation of sentences. 2. What is phrase structure rule? The grammatical mechanism that regulates the arrangement of elements (i.e. specifiers, heads, and complements) that make up a phrase is called a phrase structure rule. The phrase structural rule for NP, VP, AP, and PP can be written as follows: NP →(Det) N (PP) ... VP →(Qual) V (NP) ... AP →(Deg) A (PP) ... PP →(Deg) P (NP) ... We can formulate a single general phrasal structural rule in which X stands for the head N, V, A or P. 3. What is category? How to determine a word's category? Category refers to a group of linguistic items which fulfill the same or similar functions in a particular language such as a sentence, a noun phrase or a verb. To determine a word's category, three criteria are usually employed, namely meaning, inflection and distribution. 若详细回答,则要加上: Word categories often bear some relationship with its meaning. The meanings associated with nouns and verbs can be elaborated in various ways. The property or attribute of the entities denoted by nouns can be elaborated by adjectives. For example, when we say that pretty lady, we are attributing the property ‘pretty’ to the lady designated by the noun. Similarly, the properties and attributes of the actions, sensations and states designated by verbs can typically be denoted by adverbs. For example, in Jenny left quietly the adverb quietly indicates the manner of Jenny's leaving. The second criterion to determine a word's category is inflection. Words of different categories take different inflections. Such nouns as boy and desk take the plural affix -s. Verbs such as work and help take past tense affix -ed and progressive affix -ing. And adjectives like quiet and clever take comparative affix -er and superlative affix -est. Although inflection is very helpful in determining a word's category, it does not always suffice. Some words do not take inflections. For example, nouns like moisture, fog, do not usually take plural suffix -s and adjectives like frequent, intelligent do not take comparative and superlative affixes -er and -est.
C面向对象程序设计教程第版陈维兴林小茶课后习题答案及解析
C++面向对象程序设计教程课后题答案 1.1 什么是面向对象程序设计? 面向对象程序设计是一种新的程序设计范型.这种范型的主要特征是: 程序=对象+消息 面向对象程序的基本元素是对象。 主要结构特点是: 第一,程序一般由类的定义和类的使用两部分组成; 第二,程序中的一切操作都是通过向对象发送消息来实现的。 1.2 什么是对象?什么是类?对象与类之间的关系是什么? 对象是描述其属性的数据以及对这些数据施加的一组操作封装在一起构成的统一体。 类就是具有相同的数据和相同的操作的一组对象的集合,也就是说,类是对具有相同数据结构和相同操作的一类对象的描述。 类和对象之间的关系是抽象和具体的关系。类是多个对象进行综合抽象的结果,一个对象是类的一个实例。 1.3 现实世界中的对象有哪些特征?请举例说明。 现实世界中的对象具有以下特征: 1) 每一个对象必须有一个名字以区别于其他对象; 2) 用属性来描述对象的某些特征; 3) 有一组操作,每组操作决定对象的一种行为;
4) 对象的行为可以分为两类:一类是作用于自身的行为,另一类是作用于其他对象的行为。 例如一个教师是一个对象。每个教师对象有自己的名字来和别的教师区别。教师具有编号,姓名,年龄,职称,专业等属性。教师拥有走路,吃饭,授课等行为操作。走路,吃饭是作用于自身的行为,授课是作用于其他对象的行为。 1.4 什么是消息?消息具有什么性质? 一个对象向另一个对象发出的请求成为“消息”。 消息具有以下3个性质: 1) 同一个对象可以接收不同形式的多个消息,做出不同的相应; 2) 相同形式的消息可以传递给不同的对象,所做出的响应可以是不同的; 3) 对消息的响应并不是必须的,对象可以响应消息,也可以不响应。 1.5 什么是抽象和封装?请举例说明。 抽象是将有关事物的共性归纳、集中的过程。 例如:把所有具有大学生学籍的人归为一类,成为“大学生”,这就是一个抽象。 封装是指把数据和实现操作的代码集中起来放在对象内部,并尽可能隐藏对象的内部细节。 例如:每一台洗衣机都有出厂日期、机器编号等属性,也有启动、暂停、选择等操作。人们在使用洗衣机的时候只需要按下对应的按钮,而不用关心具体的内部实现。这就是封装。 1.6 什么是继承?请举例说明。 继承就是允许派生类使用基类的数据和操作,同时,派生类还可以增加新的操作和数据。
面向对象程序设计笔记
undeclared identifier “未声明的标识符” (1) 十进制整数:在一个整型常量后面加一个字母 l 或 L,则认为是 long int 型常量? (2) 八进制整数?在常数的开头加一个数字 0,就表示这是以八进制数形 式表示的常数? (3)十六进制整数?在常数的开头加一个数字0和一个英文字母X(或x), 就表示这是以十六进制数形式表示的常数? 2. 浮点数的表示方法 如果在实数的数字之后加字母 F 或f,表示此数为单精度浮点数,如1234F,-43f,占 4 个字节?如果加字母 L 或 l,表示此数为长双精度数(long double), 在Visual C++ 6.0 中占 8 个字节. (2) 指数形式(即浮点形式):用字母 e 表示其后的数是以 10 为底的幂,如 e12 表示 1012? 1.普通的字符常量:用单撇号括起来的一个字符就是字符型常量如′a′,′ #′,′%′,′D′都是合法的字符常量,在内存中占一个字节?“cout<<′\n′; ”将输出一个换行,其作用与“cout<新编语言学教程刘润清版1,2章复习大纲
CHAPTER 1 INTRODUCTION Definition : linguistics can be defined as the scientific or systematic study of language. It is always guided by the three cannons of science:exhaustiveness, consistency and economy. Linguistics Linguistics versus traditional grammar: Scope Microlinguistics Phonetics Phonology Morphology Syntax Semantics Pragmatics Macrolinguistics Sociolinguistics Psycholinguistics Neurolinguistics Stylistics Discourse analysis Computational linguistics Cognitive linguistics Definition: Ding-Dong Theory: human speech developed from primitive man giving vocal expression to the objects he encountered. Sing-Song Theory: language developed from primitive ritual songs of praise. Pooh-Pooh Theory: language came from interjections, which express he speaker ’s emotions. Origins Yo-He-Ho Theory: language came from the cries uttered, during strain of work. Ta-Ta Theory : language came from the combination of certain gestures and tongues movements. Bow-Wow Theory: language came from imitation of animal cries and other sounds heard in nature. Design features Linguistics describes languages and does not lay down rules of correctness while traditional grammar emphasizes correctness. Linguists regard the spoken language as primary, not the written while traditional grammar emphasizes the priority of written language. Traditional grammar is based on Latin and it tries to impose the Latin categories and structures on other languages. Linguistics describes each language on its language is a system of arbitrary vocal symbols used for human communication. Language is a system---elements in it are not arranged and combined randomly, but according to some rules and principles. Language is arbitrary --- there is no intrinsic connection between the word . pen) and the thing. what we write with).Language is vocal---the primary medium for all languages is sound. Language is used for human communication ---it is human-specific, very different form Arbitrarines s: this refers to the fact that there is no logical or intrinsic connection between a particular sound and the meaning it is associated with. For example, English should use the sounds/d?g/ to refer to the animal dog, but Chinese should use “gou ” to refer to te same animal. A dog may be called a pig if the first man happens to name it as a “pig ”. So, the relationship between the sounds and their meaning is quite accidental. Of course, onomatopoetic words such as “quack-quack ” and “bang ” are exceptions, but words these are relatively few compared withe the total number of words in language. Duality: language operates on two levels of structure. At one level are elements which have no meaning in themselves but which combine to form units at another level which do have meaning. Productivity : productivity or creativity refers to man ’s linguistic ability which enables him to produce and understand an infinitely large number of sentences in our native language, including the sentences which were never heard before. Interchangeability : interchangeability or reciprocity refers to the fact that man can both produce and receive messages, and his roles as a speaker and a hearer can be exchanged at ease. Displacement: displacement is a property of language enabling people to talk about things remote either in space or in time. Specialization : specialization refers to the fact that man does not have a total physical involvement in the act of communication. Cultural transmission : language is culturally transmitted. It cannot be transmitted through heredity. A human being brought up in isolations simply doesn ’t acquire language, as is demonstrated by the studies of children brought up by animals without human contact. Animals transmit their cries simply from parent to child, while human baby doesn ’t speak any language at birth. What language a baby is going to speak