(A) at file scope
(B) within class definition
(C) within member function
(D) within main function
Tag: Introduction to Computer Programming
Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
(A) Class-name operator +() ;
(B) Class-name operator +(int) ;
(C) Class-name operator ++() ;
(D) Class-name operator ++(int) ;
The operator function will be implemented as __, if obj1 drive the – operator whereas obj2 is passed as arguments to – operator in the statement given below. obj3 = obj1 – obj2;?
(A) Member function
(B) Non-member function
(C) Friend function
(D) None of the given options
For non-member operator function, object on left side of the operator may be?
(A) Object of operator class
(B) Object of different class
(C) Built-in data type
(D) All of the given options
The operator function overloaded for an Assignment operator (=) must be?
(A) Non-member function of class
(B) Member function of class
(C) Friend function of class
(D) None of the given options
Which of the following statement is best regarding declaration of friend function?
(A) Friend function must be declared after public keyword.
(B) Friend function must be declared after private keyword.
(C) Friend function must be declared at the top within class definition.
(D) It can be declared anywhere in class as these are not affected by the public and private keywords.
new and delete are __ whereas malloc and free are __.
(A) Functions, operators
(B) Classes, operators
(C) Operators, functions
(D) Operators, classes
Which of the following option is true about new operator to dynamically allocate memory to an object?
(A) The new operator determines the size of an object
(B) Allocates memory to object and returns pointer of valid type
(C) Creates an object and calls the constructor to initialize the object
(D) All of the given options