C ++ multiple choice questions

Source: Internet
Author: User

Multiple choice questions:

1. It indicates that the int method A (floct) is a friend. The function should be ():
A) friend int method A (floctz) B): Friend int method A (floctz)
C): int friend a (floctz) friend d): int method a friend (floctz)
2. For the following functions:
Void F (int x )(...) 1/1 int F (INT y )(...) 1/2
Int F (int I, Int J (...)) 1/3 floct K (int x )(...) (C) is an overloaded function.
A): 4 all B): 1 and 4 C): 2 and 3 D): 3 and 4
3. The C ++ language gradually evolved from the early C language. Compared with the C language, what makes the greatest improvement in solving the problem is (B ):
A): process-oriented B): object-oriented C): Security D): reusability
4. Which of the following statements about overload functions are true? (c ):
A): the overload function must have different return value types. B): the number of references for the overload function must be the same.
C): the overloaded function must have different row parameter lists. d) The names of the overloaded functions can be different.
5. Which of the following statements about the constructor is false? (d ):
A): the constructor can set the default parameter B): the constructor automatically executes the class object in the definition.
C) constructor can be an inline function D): constructor cannot be overloaded.
6. Which of the following statements is false? (B ):
A): The Public Member in the base class of public inheritance is still public in the derived class.
B): the private member of the private inherited base class is still private in the derived class.
C): the protected member in the base class of the public inheritance is still in the derived class of protected.
D): The Public Member of the private inherited base class is private in the derived class.
7. The correct statement to be entered in the following program lines is (c)
# Include <iostream>
Class base
{Public:
Void fun () {cout <"base. Fun" <Endl ;}
}:
Class perived: public Base
{Void fun ()
{// Display the function fun () that calls the base class ()
Cout <"perived: Fun" <Endl;
}
};
A) Fun (); B): Bas fun (); c): Base: Fun (); d): Base → fun ();
8. The following statements about the new and delete operators. Which is correct? (d)
A): use the new operator to dynamically allocate memory resources in the global heap.
B): If the p type has been forcibly converted from A to void *, The destructor of Class A will not be called when the delete p * Statement is executed.
C): When implementing global functions, the new and delete statements are usually displayed in pair-by-pair statement blocks limited by matching curly braces.
D): When Statement A * P = new A [100] is executed, the constructor of Class A is called only once.
9. Which of the following statements does not reflect the combination between Class A and Class B (d ):
A) Declare data member BB. B In Class A): declare data member B * B in Class;
C): no answer. d) Declare data member B fun (B &. OBJ) in Class );
10. Class C is inherited from Class A and Class B in the form of multi-inheritance. Class A and Class B do not have a public base class, so (B );
A): Class C can only inherit from public. B): You can use a single inheritance method to implement the function of class C.
C): Class A and Class B must have at least one abstract class. D): Only one of Class a B is the virtual base.
12. If Class A has an instantiated constant object A, which of the following statements is incorrect? ():
A): non-static data members in Class A must be constant members.
B): using a, you can directly call a constant member function of Class.
C): A cannot be used directly as a storage value. D): A can be a static constant object.
13. Which of the following functions can be virtual? (d)
A): Custom constructor. B): copy the constructor. C): static member functions. D): destructor.
14. Class B is generated from Class A through public inheritance. If both Class A and Class B have complete implementation code, which of the following statements is true? ():
A): number of public accessible member functions in Class B. It must be no less than the number of public member functions in Class.
B): the memory space occupied by an instance object of Class B must be not less than that occupied by the Instance Object of Class.
C): as long as the constructors in Class B are all public, they are in the main function.
D): Class A and Class B are functions of the same name.
15. About exceptions and the exception handling mechanism provided by C ++. The incorrect statement is ().
A): If programmers predict program exceptions, they can modify the program code to avoid exceptions.
B): Exceptions may occur when the dyname cast operator is used.
C): Catch can be used to capture and handle exceptions.
D): exceptions can be objects or common functions.

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.