MCQ of C/C++ Programming Language – Set 2
2-1. A constructor is called whenever
A. a object is declared
B. an object is used
C. a class is declared
D. a class is used
2-2. Overload function in C++
A. a group function with the same name
B. all have the same number and type of arguments
C. functions with same name and same number and type of arguments
D. All of the above
2-3. Operator overloading is
A. making C++ operators works with objects
B. giving new meaning to existing C++ operators
C. making new C++ operator
D. both a & b above
2-4. A constructor is called whenever
A. a object is declared
B. an object is used
C. a class is declared
D. a class is used
2-5. A class having no name
A. is not allowed
B. can’t have a constructor
C. can’t have a destructor
D. can’t be passed as an argument
2-6. The differences between constructors and destructor are
A. constructors can take arguments but destructor can’t
B. constructors can be overloaded but destructors can’t be overloaded
C. both a & b
D. None of these
2-7. A destructor takes
A. one argument
B. two arguments
C. three arguments
D. Zero arguments
2-8. Constructors are used to
A. initialize the objects
B. construct the data members
C. both a & b
D. None of These
2-9. In C++ a function contained within a class is called
A. a member function
B. an operator
C. a class function
D. a method
2-10. The fields in a class of a C++ program are by default
A. protected
B. public
C. private
D. None of these
Click Here for Answers
Sir,
I want to know some answers of IT related questions.
How can I do this ? Kindly suggest ..
Pradeep Singh
Dear Pradeep,
You can contact me by using any convenient option available in “About
hello sir i want to know how i attempt objective type question in job examination
2-5. A class having no name can’t have a destructor
Why this so?
And how can i write a class without name.
Good Afternoon
My understanding is that a class without a Name is not allowed in C++ Programming. However the answer for the question 2-5 advised that the correct answer is C cant have a Destructor. Could you please update this minor error at your earliest convenience. Thank you
This website is very useful.
This website is very useful.but one are more set don’t support for online quiz…..
Answer to number 2-5 is it correct? The class can not be passed as an argument. For nameless classes the compiler will provider a default constructor and destructor.
kindly give me MCQ Question & Answer