C ++ basic learning notes (5) --- object-oriented (test questions)

Source: Internet
Author: User
Tags c constructor types of functions

Multiple choice questions:

C ++ Overview

1. The following new keywords in C ++ are D.

A break

B continue

C stuct

D inline

2. In object-oriented programming, data and _ A ___ are put together and processed as an interdependent and inseparable whole.

A. Operations on data B. Information C. Data Hiding D. Data abstraction

 

3. object-oriented programming is superior to traditional Structured Programming. Its superiority is mainly manifested in its hope of solving two main problems of software engineering: Software complexity and _ ____.

A software productivity improvement B refined existing code C Shared code D code reusable code

 

4. The _ of the object-oriented system is an information hiding technology. It aims to separate the users of objects from designers, and users do not have to know the Implementation Details of object behavior, you only need to use the Protocol command object provided by the designer.

A polymorphism B encapsulation C inheritance D reusability

 

5. ___ A ___ is not an element of the object-oriented system.

A reloads B Object C Class D inheritance

 

6. In the description of the relationship between C ++ and C, ____ D _ is incorrect.

A c language is A subset of C ++. B C ++ is compatible with C language.

C ++ makes some improvements to C language. Both C ++ and C language are object-oriented.

 

7. In the following statements about the object concept, ___ A ___ is incorrect.

Object A is the structure variable in C language.

Object B represents an object in the system being created.

A c object is a state and action (or method) Encapsulation body.

D. Information Transmission between objects is performed through information.

 

8. Which of the following statements about the class concept is false.

Class A is the implementation of abstract data types. Class B is the Uniform Description body of several objects with common behaviors.

Class C is the template for object creation. Class D is the structure type in C language.

 

9. Which of the following statements about the C ++ class is wrong? ___ C ___.

Communication and communication between Class A and Class can be performed through some means

Class B is used to describe the attributes of a transaction and perform operations on it.

Classes C and classes must be equal, rather than hierarchical.

Class D and class can have explicit independence through Encapsulation

 

10. Of the following keywords, ____ B _ is used in both C and C ++.

A inline B break C private D public

 

11. C ++ has made many improvements to the C language. In the following description, ___ D ___ changes the C language from process-oriented to object-oriented.

A adds some new operators B that allow function overloading and allows you to set default parameters.

C indicates that the function description must use prototype D to introduce the concepts of classes and objects.

 

12. The following C ++ punctuation marks indicate that the line comment starts with ___ C ___.

A # B; C // D}

 

13. Which of the following statements about the relationship between C ++ and C language is false? _ C ____.

A c ++ is A superset of C language. B C ++ expands the C language.

C ++ | both the C language and C language are object-oriented programming languages. d c ++ contains all the syntax of C language.

 

14. Which of the following are the correct options ______.

A inheritance is the ability to create A new class with the attributes and behaviors of another class.

B C language supports Object-Oriented Programming

The C blank space is a compilation symbol.

The D identifier should not be too long. It is generally set to 16 characters.

 

15. Which of the following statements about polymorphism is false? _ B _______.

A different object calls A function with the same name, and can lead to A completely different behavior phenomenon called Polymorphism

Polymorphism in B C ++ is supported by encapsulation technology.

C polymorphism is an important mechanism of object-oriented programming.

D polymorphism is a simulation of human thinking.

 

 

Class and Object

16. for descriptions of the following classes, please point out the error _____ ___.

Class CSample

{

Int a = 2; ()

CSample (); (B)

Public:

CSample (int val); (C)

~ CSample (); (D)

}

 

17. Which of the following statements about classes is incorrect? ____ D ____.

Class A is A user-defined data type.

B. Only member functions in the class can access private data in the class.

C. Unless otherwise specified, all data types are private.

D. Unless otherwise specified, all member functions are of the Public type.

 

18. Which of the following statements about classes and objects are incorrect ____.

Object A is an instance of A class. B. Any object can belong to only one specific class.

C. A class can have only one object. D. Relationship between objects and relationship between data types and variables.

 

19. Which of the following statements about classes and objects is correct ____

A member function of A class can be called at will.

B Generally, only through specific objects can member functions of the callback class

The C object is a template and the class is an instance.

Class D has no relationship with objects.

 

20. Which of the following statements about constructor is incorrect? ____ D ____.

The name of A constructor is the same as that of A class. B constructor is automatically executed when class variables are described.

C constructor does not have any function type D constructor has only one

 

21. Which of the following statements about destructor is false? ___ C _____.

A destructor has only one

B destructor does not have any function type

The C destructor can have the same parameters as the constructor.

D destructor is used to reclaim the previously allocated memory space when the object is revoked.

 

22. when defining a member function in vitro, you must add _ B ______ before the function name ______.

Class A mark Class B mark Class C Object Class D Operator

 

23. In the definition form of A class, data members, member functions, and ___ A ____ constitute the class definition body.

Access control message of A member B public message C private message D PROTECT message

 

24. The ____ C ____ function initializes the object.

A destructor B data member C constructor D static member function

 

25. If Q is a class, a is one of its objects, and p1 is a pointer to Class Object a, Class Object a can use ① ___ B ____ to compile class members, the pointer p1 of Class Object a can be a member of the class through ② _____ D.

A: B. C; D->

 

26. of the following types of functions, ___ C ______ is not a member function of the class.

A constructor B constructor C youyuan function D copy initialization Constructor

 

27. The parameter for copying the initialization constructor is ______ C ____.

A. Object Name B. member name of an object C. Reference name of an object D. pointer name of an object

 

28. The use of class templates is actually to instantiate A class template into A specific ___.

Class a B Object C function D template class

 

29. A template is a tool for implementing the classifier mechanism. It has very powerful functions. It allows users to construct the classifier, which can be ① ____ B ___;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.