forum_image

Discussion Forum

Interative Forum for discussing any query literally to UGC-NET Computer Science, GATE Computer Science and Computer Sciene and Technology in general.

ugc_net image

UGC-NET Computer Science

Correspondence Courses and Test Series to prepare for UGC-NET computer science and applications

GATE image

GATE

MCQs, Lecture Notes, Ebooks for GATE preparation

freestuff image
jobs image

Jobs Newsfeed

Timely information of various Recruitments.

NextPrev

MCQs C++ |UGC-NET|GATE|Computer Science

41.What is "encapsulation"?
A.The division of a program into independent modules
B.The enforcement of data hiding within a class
C.The aggregation of data members within a class
D.The aggregation of function members within a class
View/Hide Ans
Explanation
42.Which of the following is a valid C/C++ function pointer definition
A.int (*f)();
B.int* f();
C.(int*)f();
D.(int* f)();
View/Hide Ans
Explanation
43.Apart from reserving the required memory, what else do the allocation operators do?
A.Automatically deallocate the memory when it goes out of scope
B.Automatically deallocate the memory when it is is no longer accessible
C.Calls the constructor(s) for the specified type
D.Calls the destructors(s) for the specified type
View/Hide Ans
Explanation
44.Once a reference is declared, how can it be distinguished from the original object it references?
A.They have different addresses (i.e. use the & operator)
B.They have different sizes (i.e. use the sizeof() function)
C.They have different scopes (i.e. test for a call to their destructors)
D.A reference can't be distinguished from the original object it references
View/Hide Ans
Explanation
45.A reference can't be distinguished from the original object it references
A.Changes to parameter values within the function also affect the original arguments
B.There is need to copy parameter values
C.There is no need to call constructors for parameters
D.All of the above
View/Hide Ans
Explanation
46.In what ways are references and pointers similar?
A.Both provide a mechanism for accessing some other piece of memory
B.Both must be dereferenced before use
C.Both are first class objects in C++
D.Both are always more compact (use less memory) than the objects to which they refer (or point)
View/Hide Ans
Explanation
47.Why is operator overloading sometimes desirable?
A.To change the precedence of inbuilt operators for user-defined classes
B.To make user-defined classes act more like inbuilt classes
C.To improve the performance of operations between inbuilt types
D.All of the above.
View/Hide Ans
Explanation
48.If a binary operator is overloaded as a non-member function, how many parameters will the member function require?
A.None. Both operands are already known.
B.One, to pass the first operand. The second operand will be a member of the first.
C.Two, to pass the first and second operands.
D.Binary operators can't be overloaded as global functions, only as member functions of a class.
View/Hide Ans
Explanation
49.Why is it necessary to be able to overload some operators by specifying a global function (rather than a member function)?
A.Because member functions are slower than global functions
B.Because inbuilt types can't have member functions
C.Because sometimes the order of arguments puts an unmodifiable class as the first operand
D.Because some operators are commutative (the order of operands doesn't matter) so we have to use a global function which will accept operands in either order.
View/Hide Ans
Explanation
50.Two or more overloadings of the same operator can not be in a single class because
A.every operator name has to be unique in its original scope
B.operator look-up has to be done at compile time, but the compiler can't know what the run-time operands to an operator will be
C.two or more overloadings of the same operator in a single class is allowed, as long as their signatures are distinct.
D.both b and c
View/Hide Ans
Explanation


Author Does Not claim of any answer these answers are as per expert opinion


Pages: 1 2 3 4 5 6 7 8 9