C++ questions 1. Choice questions: 1. The incorrect statement about classes and objects is (C) A) Class is a type that encapsulates data and operations B) Objects are instances of classes C) There is only one object in a class. D) An object must belong to a class 2. Outside the class definition, members that can be accessed are (C) A) All Class Members B) Private or Protected Class Members C) Class member of public D) Class member of public or private 3. The wrong way to say this pointer is (A) A) The this pointer must show instructions B.) When an object is created, the this pointer points to the object. C) Member functions have this pointer D) Static member functions do not have this pointer 4. When declaring an object of a class, the system calls (B) function automatically, and when revoking the object, the system calls (C) function automatically. A) Member Function B) Constructor C) Destructor D) General Function 5. The following incorrect description of the constructor is (B) A) The system can provide default constructor B) The constructor can have parameters, so it can have a return value. C) Constructors can overload D) Constructors can set default parameters 6. The following correct description of the destructor is (C) A) The system cannot provide default destructors B) Destructors must be user-defined C) Destructors have no parameter D) Destructors can set default parameters 7. The incorrect description of static members is (C) A) Static members do not belong to objects, but are shared members of classes B) Static data members are defined and initialized outside classes C) Static member functions are activated by classes or objects, so static member functions have this pointer D) Non-static member functions can also operate on static data members 8. In the following options, the member function that is not a class is (C) A) Constructor B) Destructor C) Friend D) Constructor Dialect with Default Parameters 9. The following wrong description of friends is (D) A) The keyword friend is used to declare friends B) A member function of one class can be a friend of another class. C) Members of friendly function accessing objects are not affected by access characteristics D) Friend function accesses object members through this pointer 10. In C++, the inheritance relationship between classes has (C) A) reflexivity B) symmetry C) transitivity D) antisymmetry 11. The following description of class inheritance, (A) is incorrect A) Derived classes can access all data members of the base class, and can also call all member functions of the base class. B) Derived classes are also base classes, but base classes do not necessarily have all the attributes and methods of derived classes. C) Inheritance describes the hierarchical relationship of classes, and derived classes can have the same attributes and methods as the classes. D) A base class can have more than one derived class, and a derived class can have more than one base class. 12. When a derived class only inherits a base class, all public members of the base class become (A) of the derived class. A) Public Member B) Private Member C) Protected Member D) Friends 13. When a derived class privately inherits a base class, all members of the base class that have only members and protect members become derived classes (B) A) Public Member B) Private Member C) Protected Member D) Friends 14. No matter how derived classes inherit base classes, they cannot use base classes (B) A) Public Member B) Private Member C) Protected Member D) Public Member and Protected Member 15. In the following description, the error is (BC) (two answers) A) The public members defined in the base class are visible in public inherited derived classes and can be accessed outside the class. B) The public and protected members defined in the base class are visible in privately inherited derived classes and can be accessed outside the class. C) Public and protected members defined in base classes are not visible in derived classes that protect inheritance D) To make members invisible in derived classes accessible, access declarations are required 16. In C++, functions that cannot be inherited by derived classes are (BC) (two answers) A) member function B) constructor C) destructor D) static member function 17. When creating a derived class object, the constructor executes in (D) A) Object member constructor, base class constructor, constructor of derived class itself B) Constructor of derived class

docxDoc C Question with Answers

Professional Docs > Common > Other > Preview
14 Pages 0 Downloads 184 Views 3.0 Score
Tips: Current document can only be previewed at most page8,If the total number of pages in the document exceeds page 8,please download the document。
Uploaded by admin on 2019-10-15 12:05:06
Rate
You can enter 255 characters
What is my domain?( answer:www.45doc.com )
comments
  • No comments yet