




已阅读5页,还剩36页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
mChapter I: Principles of Object-Oriented Programming1. Which of the following languages is not a procedure-oriented programming language?a) ALGOL(算法语言)b) COBOL(面向商业通用语言)c) FORTRAN(公式翻译程序语言)d) None of the above2. Which of the following programming approach (程序设计方法)used functions as a key concept to perform action-oriented tasks?(指导任务?)a) Structured(结构化) programmingb) Modular (模块化)programmingc) Procedure-oriented programming(面向对象)d) Object-oriented programming3. Identify the drawback(缺点) of using procedure-oriented programming, if any:a) Data is hidden(隐藏) from external functions(外部函数)b) New functions can be added whenever necessaryc) Does not reflect real world problemsd) All of the above4. Which is not associated(联系) with Object-oriented programming?a) Data abstraction(数据提取)b) Automatic initialization(自动初始化)c) Dynamic binding(动态绑定)d) None5. The term operator overloading (操作符重载)in C+ refers to:a) Inheritance(继承)b) Message passing (信息传递)c) Polymorphism(多态性)d) None6. Which one of the following OOP concepts enables reusability (再利用)of components(成员)?a) Inheritanceb) Encapsulation(数据分装)c) Polymorphismd) All of the above7. The concept of hierarchical classification (层次分类)is related to:a) Abstractionb) Inheritancec) Function overloading(重载)d) None8. Object-based (基于对象)programming languages do not support:i. Inheritanceii. Dynamic bindingiii. Encapsulationiv. All of the abovea) Both i and iib) iii onlyc) iv onlyd) i, ii, and iii9. C+ does not supporti. Genericity(泛型C#)ii. Early bindingiii. Garbage collection(碎片收集)iv. Multiple Inheritance(多重继承)a) i onlyb) ii onlyc) iii onlyd) ii, iii and iv10. Which of the following is an Object-oriented programming language?i. Smalltalkii. Object Pascaliii. Javaiv. All of the abovea) Both ii and iii b) i onlyc) iii onlyd) iv onlyChapter II: Beginning With C+1. Which one of the following options is true on the topic of Simula67?i. It is the first Object-oriented programming languageii. Its a predecessor to C+iii. It was designed for doing simulationsiv. All of the abovea) Both i and iib) i onlyc) iii onlyd) iv only2. Which of the following features (特征)that distinguish(区别) object oriented programming from other conventional(常规的) programming?i. Structural design(结构设计)ii. Inheritanceiii. Modular programming(模)iv. bottom-upa) i onlyb) Both ii and iiic) Both ii and ivd) iv only3. Comments (解释)in C+ starts with _ symbol.a) /b) c) *d) None of the above4. The insertion operator (插入操作符)is another name fora) input operatorb) output operator(输出操作符)c) extraction operatord) None of the above5. Which header file in C+ does contain function prototypes for memory(记忆)allocation(分配)?a) b) c) d) 6. What is the output of the following code?int n=10;while (n10)cout “Number:”n+1;a) 10b) 11c) No outputd) None of the above 7. Which of the following statements require the header file to be included?a) a=b/c;b) cout a;c) c=sqrt(a);(平方根)d) Both a and c8. Identify the error, if any: char str_name a;a) str_name is not a valid variable nameb) Variables cannot be initialized at the time of declarationc) Missing = sign between str_name and ad) No error9. Name the library that must be included while using cin.a) b) (输入输出流)c) d) 10. A C+ program structure is based on the concept ofa) Client-server modelb) N-Tier modelc) Both a and bd) None of the aboveChapter III: Tokens, Expressions and Control Structures1. return is an example of a a) Keyword(关键字)b) Functionc) Statement (声明)d) Comment2. Which of the following is not a keyword?i. forii. friendiii. virtualiv. privatea) i onlyb) Both ii and iiic) Both i and ivd) ii, iii and iv3. Identify the valid (有效地)variable(可变的) name from the following:i. charii. var_nameiii. _varnameiv. str_name2a) Both i and iiib) Both ii and ivc) ii, iii, and ivd) i only4. Which of the following is not a user-defined data type?a) arrayb) structurec) uniond) class5. Write the equivalent C+ statement for the following expression,X= *c/da) X=sqrt(a+b) *(c/d);b) X=(squareroot(a+b)*c)/d;c) X=(* c)/d;d) None of the above6. The statement int main() is a _.a) function prototypeb) function callc) function header lined) None of the above7. The declaration of global variables(全局变量) must be madea) inside the functionb) outside the functionc) in a function header lined) None of the above8. Identify the error, if any:double avg=tot/n;a) Declaration should not contain any expressionb) Initialization cannot be done in the declaration statementc) Dynamic initialization is not possibled) No error9. Which of the following is true about scope resolution operator?a) Qualifies a namespace member to its namespaceb) Allows you to access a global variablec) Qualifies the hidden variabled) All of the above10. Which of the following is not a member-dereferencing operator?a) :*b) :c) *d) *11. Which of the following is true about new operator?i. While using new operator, sizeof() operator is not neededii. It is also not necessary to use cast operatoriii. new operator can be overloadediv. All of the abovea) Both i and iib) Both i and iiic) ii onlyd) iv only12. Identify the manipulators in C+:a) Endl(输出时换行)b) setw(设置域宽)c) Both a and bd) None of the above13. a = (b = 5); The C+ statement is an example ofa) Compound (合成)assignmentb) Embedded (嵌入)assignmentc) Chained (束缚)assignmentd) Multiple (多重)assignment14. Water-fall model is associated witha) Control structuresb) Type conversions c) Manipulatorsd) None of the above15. Selection structure is also known bya) Branching(歧义)b) straight linec) iterationd) None of the above16. Consider the following code:cout “Welcome”; This is an example ofa) C+ statementb) Return typec) Functiond) Both a and cChapter IV: Functions in C+1. Which of the following is true about a function call in a C+ program?a) A function must be called atleast onceb) A function cannot be called from other functionsc) A function may be called whenever it is necessaryd) Both a and c2. Function prototyping definesa) The return type of the functionb) The identifier of the functionc) The number and type of argumentsd) All of the above3. Find if the following function prototype contains any error:double area(int )a) No errorb) Variable name is not included in the argument listc) Semicolon(分号) is not foundd) None of the above4. Identify which function prototype exhibits(显示) the following: Name of the function is sample_calc, which receives two values of type double and returns no value;a) sample_calc(double, double);b) void sample_calc(double, double);c) double sample_calc(void);d) void sample_calc(double, double)5. When you call a function by passing the address of a data variable, it is called _.a) Call by referenceb) Call by valuec) Call by two directionsd) Both b and c6. Which of the following function calls is correct while providing default arguments:I. double calc(int a, float b=12.0);II. double calc(int a=3, float b=12.0, int c);III. double calc(int a=3, float b, int c=8);IV. double calc(int a, float b=12.0, int c=8);a) I onlyb) II onlyc) Both I and IV d) Both II, and III7. Which function call does invoke the following function prototype?float sub1(int a, float b);a) X=sub1(5.0,6.5);b) X=sub1(5,6.5);c) X=sub1(5,6);d) Both b and c8. Identify the variables, which are local to the following function:int calc(int p, int n)int q;q=pow(p,n);return(q);a) p and nb) p,n, and qc) qd) Cannot be determined without the main() function9. Which of the following statements is true about the function that contains the const argument?a) The function should not modify the const argumentb) Const declaration is necessary only when the arguments are passed by referencec) Both b and cd) None of the above10. Which of the following functions in C+ replace the usage of macros in C?a) friend functionb) virtual functionc) inline functiond) All of the aboveChapter IX: Pointers, Virtual Functions and Polymorphism1. Which of the following is true about pointers?a) A pointer is a data typeb) A pointer is a keywordc) A special type of integer (整数 )variabled) None of the above2. Which of the following statement(s) is true according to the following statement?p=*ptr;a) p must be a pointer variableb) The value of ptr is assigned to the variable pc) The address of the pointer ptr is assigned to the variable pd) The value of the variable that the pointer ptr is pointing to is assigned to the variable p3. Compile time polymorphism is also known as a) early bindingb) static bindingc) static linkingd) All of the above4. C+ supports a mechanism virtual function to achievea) compile time polymorphismb) function overloadingc) run time polymorphism d) operator overloading5. Which of the following is NOT true about virtual functions?I. They cannot be static membersII. A virtual function can be a friend of another classIII. We can have virtual constructors, but we cannot have virtual destructorsIV. They are accessed by using object pointersa) II onlyb) III onlyc) Both II and IIId) I, II and IV6. Consider the following code segment:int main()int x, *x_ptr=&x;x=5;x_ptr=NULL;cout x “ “ *x_ptr;return 0;What is the output of the above code?a) 0b) but addresses are samec) but having different addressesd) 57. Consider the following code segment:int main()double f, *f_ptr=&f;f=5.25;f_ptr=4.5;cout “Value of f is:” “ “ f;return 0;What is the output of the above code?a) Value of f is: 5.25b) Value of f is: c) Value of f is: 4.5d) Compiler error8. How will you assign value 5 to the variable x inside a member function using this pointer?a) this-x=5;b) this.x=5;c) x=5;d) None of the above9. Consider a class X, which includes a virtual function called X_output. The virtual function receives a float value and returns nothing. Find out the function prototype for the same.a) virtual void X_output(float );b) X: virtual void X_output(float );c) virtual X: void X_output(float );d) virtual : void X_output(float );10. What would be the output of the following code?#include#includeclass Apublic: virtual void disp()coutThis is from class A;class B : public A public:void disp()coutdisp();a) This is from class Ab) This is from class Bc) This is from class A This is from class Bd) None of the above11. Which of the following is NOT true about pure virtual function?a) It is also called do-nothing functionb) It cannot declare its own objectsc) A virtual function, which is not equated to zero is called a pure virtual functiond) None of the aboveChapter V: Classes and Objects1. The declaration of a class includesa) Declaration of data membersb) Declaration of function prototypec) Return statements of functionsd) Both a and b2. By default, the members of a class area) privateb) publicc) protectedd) static3. Which OOP feature can be enabled by using private declaration for the class members?a) Data abstractionb) Polymorphismc) Encapsulationd) Modularity4. Which of the following will assign the value to the class member variable num?void getnum(int a)a) num=a;b) num=a;c) a=num;d) a=num;5. Which of the following is not true about member functions?a) Can access private data variablesb) Can call another function directly without using dot operatorc) Both a and bd) None of the above6. Identify all the members of the following class xyz:class xyzint x,y;public:xyz();void calc(int a, int b);void output_calc(void);a) Data members x and yb) Data members x and y, Constructor, and member functions calc() and output_calc()c) Data members x and y, and member functions calc() and output_calc()d) Constructor and member functions calc() and output_calc()7. Which of the following is not true about static member variable?a) Only one instance of static member can be createdb) Visible only within the classc) It can be initialized whenever necessaryd) Both a and b8. What is the general format of calling a static member function using a class name?a) class-name : function-nameb) function-name : class-namec) class-name : function-name;d) function-name : class-name;9. Which of the following is true while passing objects as function arguments? It is possiblea) to pass copy of the entire object to the functionb) to pass only the address of the object to the functionc) to pass the objects to a non-member functiond) All of the above10. A friend functionI. Can be invoked similar to other functions without using objectsII. Cannot access to other member functions directlyIII. Cannot be called using the object of the class to which it has been declared as friendIV. Can be declared only in the public part of a classa) I, II and IIIb) I, II and IVc) I, II, III and IVd) IV onlyChapter VI: Constructors and Destructors1. Which of the following is not true about constructors and destructors?a) They must have the same name as classb) They cannot return valuesc) They cannot be called more than once in a programd) They are called automatically2. The default constructor for class A isa) A : A()b) A : A(int)c) A : A(int);d) A : A(); 3. Which of the following statements do correctly describe the characteristics of constructors?I. They cannot be inheritedII. They cannot be virtualIII. They need not be declared in the public sectionIV. We cannot refer to their addressesa) Both I and IIb) I, II, and IV c) Both II and IIId) I, III and IV4. Which of the following is called an implicit constructor for the class xyz?a) xyz() b) xyz(int)c) xyz() ;d) None of the above5. Consider the following code segment:class simpleint a,b;public:simple();simple(char);Which of the following would assigns the string “welcome” to the second constructor?a) simple s(“welcome”);b) simple s(welcome);c) simple s=”welcome”;d) None of the above6. Identify if any error in the following code segment1. class example2. 3. float x;4. public:5. void example();6. example(int, float);7. ;a) Line 7 should not include the semicolonb) Line 6 is an incorrect statementc) Line 5 cannot include voidd) No error7. Which of the following statements are true about copy constructors?I. It declares and initializes an object from another objectII. It will not be useful when arguments are passed by valueIII. It can be used to pass arguments by referenceIV. The compiler provides its own copy constructor, if it is not defined.a) I, II, IVb) All are correctc) Both II and IIId) III only8. The following statement creates a constant object of a class simple:const simple m(a,b);Which the following is true regarding the above statement?a) The compiler generates compile-time error if you try to change the values of a and bb) Const member is a function prototypec) The compiler generates an error if m tries to invoke non-const member functionsd) All of the above9. Which of the following statements do incorrectly describe the characteristics of destructors?I. A destructor is a member function, which has the same name as class nameII. A destructor receives only one argumentIII. A destructor does not return any valueIV. Usage of destructors in a program clean up memory space that is not useda) Both I and IIb) All are incorrectc) Both II and IIId) I, II and IV10. Which of the following is a correct description of the destructor sample and includes output statements (if possible)?a) sa
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025甘肃庆阳市庆城县事业单位引进高层次和急需紧缺人才4人(第三批)模拟试卷及答案详解(全优)
- 2025年甘肃省大数据中心招聘工作人员模拟试卷完整答案详解
- 2025湖北黄冈市武穴市事业单位第二批考核招聘三支一扶服务期满人员1人考前自测高频考点模拟试题附答案详解(考试直接用)
- 2025北京大兴区旧宫镇红星派出所流动人口和出租房屋管理员招录1人考前自测高频考点模拟试题及答案详解(必刷)
- 2025杭州青少年活动中心招聘工勤岗位工作人员20人模拟试卷及答案详解一套
- 2025年4月广东深圳市大鹏新区政务服务和数据管理局招聘编外人员2人模拟试卷及答案详解一套
- 2025河南工程学院招聘高层次人才160人模拟试卷附答案详解(突破训练)
- 2025年福建省泉州市晋江市首峰中学招聘1人考前自测高频考点模拟试题参考答案详解
- 2025年上半年五粮液集团公司招聘870人笔试题库历年考点版附带答案详解
- 2025年3月吉林省高速公路集团有限公司公开招聘3人(总部岗位)笔试题库历年考点版附带答案详解
- 2025至2030年中国车载摄像头行业市场调研及投资战略规划建议报告
- 政府机关防恐防暴演练方案范文
- 安徽省蚌埠市2025-2026学年高三上学期调研性监测语文(含答案)
- 钢铁销售基础知识培训
- 5.1延续文化血脉 教案 -2025-2026学年统编版道德与法治九年级上册
- 2025年保密观原题附答案
- 基于项目学习的英语核心素养心得体会
- 2025年全球汽车供应链核心企业竞争力白皮书-罗兰贝格
- 第六章-材料的热性能
- (完整版)抛丸机安全操作规程
- 高一前三章数学试卷
评论
0/150
提交评论