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

1 – A / 2 – A / 3 – D / 4 – A / 5 – C / 6 – C / 7 – D / 8 – A / 9 – A / 10 – C
 

9 Responses to “MCQ of C/C++ Programming Language – Set 2”

  1. Pradeep 26 August 2011 at 7:07 PM

    Sir,
    I want to know some answers of IT related questions.
    How can I do this ? Kindly suggest ..
    Pradeep Singh

    • Ganesh Maharjan 29 August 2011 at 11:11 PM

      Dear Pradeep,
      You can contact me by using any convenient option available in “About

  2. Ravinder Singh 17 February 2012 at 6:29 PM

    hello sir i want to know how i attempt objective type question in job examination

  3. Prakash 26 March 2012 at 10:44 AM

    2-5. A class having no name can’t have a destructor

    Why this so?
    And how can i write a class without name.

  4. Cathal Delahunty 16 April 2013 at 7:46 PM

    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

  5. Muthu 30 September 2014 at 4:19 PM

    This website is very useful.

  6. Muthu selvam 30 September 2014 at 4:20 PM

    This website is very useful.but one are more set don’t support for online quiz…..

  7. summernyika 24 June 2015 at 3:30 PM

    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.

  8. Md. Abdul Motin 10 April 2016 at 11:42 AM

    kindly give me MCQ Question & Answer


Leave a Reply

error: Content is protected !!