ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:24.58KB ,
资源ID:6982536      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6982536.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(推荐C++常见英文面试笔试题 精品.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

推荐C++常见英文面试笔试题 精品.docx

1、推荐C+常见英文面试笔试题 精品C/C+ Programming interview questions and answers By Satish Shetty, July 14th, 20XXWhat is encapsulation?Containing and hiding information about an object, such as internal data structures and code. Encapsulation isolates the internal plexity of an objects operation from the rest of t

2、he application. For example, a client ponent asking for net revenue from a business object need not know the datas origin.What is inheritance?Inheritance allows one class to reuse the state and behavior of another class. The derived class inherits the properties and method implementations of the bas

3、e class and extends it by overriding methods and adding additional properties and methods.What is Polymorphism?Polymorphism allows a client to treat different objects in the same way even if they were created from different classes and exhibit different behaviors.You can use implementation inheritan

4、ce to achieve polymorphism in languages such as C+ and Java.Base class objects pointer can invoke methods in derived class objects.You can also achieve polymorphism in C+ by function overloading and operator overloading.What is constructor or ctor?Constructor creates an object and initializes it. It

5、 also creates vtable for virtual functions. It is different from other methods in a class.What is destructor?Destructor usually deletes any extra resources allocated by the object. What is default constructor?Constructor with no arguments or all the arguments has default values.What is copy construc

6、tor?Constructor which initializes the its object member variables ( by shallow copying) with another object of the same class. If you dont implement one in your class then piler implements one for you.for example:Boo Obj1(10); / calling Boo constructorBoo Obj2(Obj1); / calling boo copy constructorBo

7、o Obj2 = Obj1;/ calling boo copy constructorWhen are copy constructors called? Copy constructors are called in following cases: a) when a function returns an object of that class by valueb) when the object of that class is passed by value as an argument to a functionc) when you construct an object b

8、ased on another object of the same classd) When piler generates a temporary objectWhat is assignment operator? Default assignment operator handles assigning one object to another of the same class. Member to member copy (shallow copy)What are all the implicit member functions of the class? Or what a

9、re all the functions which piler implements for us if we dont define one.?default ctorcopy ctorassignment operatordefault destructoraddress operatorWhat is conversion constructor?constructor with a single argument makes that constructor as conversion ctor and it can be used for type conversion.for e

10、xample:class Boo public: Boo( int i );Boo BooObject = 10 ; / assigning int 10 Boo objectWhat is conversion operator?class can have a public method for specific data type conversions.for example:class Boo double value; public: Boo(int i ) operator double() return value; ;Boo BooObject;double i = BooO

11、bject; / assigning object to variable i of type double. now conversion operator gets called to assign the value.What is diff between malloc()/free() and new/delete?malloc allocates memory for object in heap but doesnt invoke objects constructor to initiallize the object.new allocates memory and also

12、 invokes constructor to initialize the object.malloc() and free() do not support object semantics Does not construct and destruct objects string * ptr = (string *)(malloc (sizeof(string)Are not safe Does not calculate the size of the objects that it construct Returns a pointer to void int *p = (int

13、*) (malloc(sizeof(int);int *p = new int;Are not extensible new and delete can be overloaded in a class delete first calls the objects termination routine (i.e. its destructor) and then releases the space the object occupied on the heap memory. If an array of objects was created using new, then delet

14、e must be told that it is dealing with an array by preceding the name with an empty :-Int_t *my_ints = new Int_t10;.delete my_ints;what is the diff between new and operator new ?operator new works like malloc.What is difference between template and macro?There is no way for the piler to verify that

15、the macro parameters are of patible types. The macro is expanded without any special type checking.If macro parameter has a postincremented variable ( like c+ ), the increment is performed two times.Because macros are expanded by the preprocessor, piler error messages will refer to the expanded macr

16、o, rather than the macro definition itself. Also, the macro will show up in expanded form during debugging.for example:Macro:#define min(i, j) (i j ? i : j)template:template T min (T i, T j) return i j ? i : j;What are C+ storage classes?autoregisterstaticexternauto: the default. Variables are autom

17、atically created and initialized when they are defined and are destroyed at the end of the block containing their definition. They are not visible outside that blockregister: a type of auto variable. a suggestion to the piler to use a CPU register for performancestatic: a variable that is known only

18、 in the function that contains its definition but is never destroyed and retains its value between calls to that function. It exists from the time the program begins executionextern: a static variable whose definition and placement is determined when all object and library modules are bined (linked)

19、 to form the executable code file. It can be visible outside the file where it is defined.What are storage qualifiers in C+ ?They are.constvolatilemutableConstkeyword indicates that memory once initialized, should not be altered by a program.volatilekeyword indicates that the value in the memory loc

20、ation can be altered even though nothing in the programcode modifies the contents. for example if you have a pointer to hardware location that contains the time, where hardware changes the value of this pointer variable and not the program. The intent of this keyword to improve the optimization abil

21、ity of the piler. mutable keyword indicates that particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.struct datachar name80;mutable double salary;const data MyStruct = Satish Shetty, 1000 ; /initlized by pliers

22、trcpy ( MyStruct.name, Shilpa Shetty); / piler errorMyStruct.salaray = 2000 ; / plier is happy allowedWhat is reference ?reference is a name that acts as an alias, or alternative name, for a previously defined variable or an object.prepending variable with & symbol makes it as reference.for example:

23、int a;int &b = a; What is passing by reference?Method of passing arguments to a function which takes parameter of type reference.for example:void swap( int & x, int & y ) int temp = x; x = y; y = temp;int a=2, b=3;swap( a, b );Basically, inside the function there wont be any copy of the arguments x

24、and y instead they refer to original variables a and b. so no extra memory needed to pass arguments and it is more efficient. When do use const reference arguments in function?a) Using const protects you against programming errors that inadvertently alter data.b) Using const allows function to proce

25、ss both const and non-const actual arguments, while a function without const in the prototype can only accept non constant arguments.c) Using a const reference allows the function to generate and use a temporary variable appropriately. When are temporary variables created by C+ piler?Provided that f

26、unction parameter is a const reference, piler generates temporary variable in following 2 ways.a) The actual argument is the correct type, but it isnt Lvaluedouble Cube(const double & num) num = num * num * num; return num;double temp = 2.0;double value = cube(3.0 + temp); / argument is a expression

27、 and not a Lvalue;b) The actual argument is of the wrong type, but of a type that can be converted to the correct typelong temp = 3L;double value = cuberoot ( temp); / long to double conversion What is virtual function?When derived class overrides the base class method by redefining the same functio

28、n, then if client wants to access redefined the method from derived class through a pointer from base class object, then you must define this function in base class as virtual function.class parent void Show() cout im parent endl;class child: public parent void Show() cout im child show() / calls pa

29、rent-show() i now we goto virtual world.class parent virtual void Show() cout im parent endl;class child: public parent void Show() cout im child show() / calls child-show() What is pure virtual function? or what is abstract class?When you define only function prototype in a base class without imple

30、mentation and do the plete implementation in derived class. This base class is called abstract class and client wont able to instantiate an object using this base class.You can make a pure virtual function or abstract class this way.class Boovoid foo() = 0;Boo MyBoo; / pilation error What is Memory alignment?The term alignment primarily means the tendency of an address pointer value to be a multiple of some power of two. So a pointer with two byte alignment has a zero in the least significant bit. And a pointer with four byte alignment has a zero in both the two least

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1