SlideShare a Scribd company logo
1 of 5
INTRODUCTION TO OBJECT ORIENTED PROGRAMMING AND C++
                                           B Sc (IT) – II Semester
                                                Assignment


1.   class can have                                                  c. Cannot create an object

     a.   Methods                                                    d.   Can change the data member of the
                                                                          class
     b.   Data

     c. Another Class
                                                               5. A static variable in a class
     d.   All of the above
                                                                     a.   has copy of it all the objects of the class

                                                                     b.   is shared among all the objects of the
2.   The two major components of an object are
                                                                          class
     a. Methods and Data members                                     c.   is same as instance variable

     b.   Constructors and copy constructor                          d.   none of the above

     c.   Constructors and destructor

     d. Constructors and assignment operator                   6. A class can have defined in it

                                                                     a.   Only one constructor

3. If A class inherits its properties from a class                   b.   Any number of constructors
     B, then A is called as
                                                                     c.   Only one default constructor
     a.   Derived class
                                                                     d.   Only one parameterized constructor
     b.   Base class

     c. Const class
                                                               7.    Function overloading in c++ means
     d.   Static class
                                                                     a. Two functions must have same name
                                                                          and different parameters

4. A const function                                                  b. Two functions must have different
                                                                          name and different parameters
     a. Cannot change the data member of the
          class                                                      c. Two functions must have same name
                                                                          and same parameters
     b. Cannot call other class method
d. Two functions must have different                d. Cannot be accessed outside the class
         name and same parameters


                                                    12. Which of the following statement is true for
8. Two functions can be overloaded if                   a class

    a.   Their arguments are similar and return         a.   Constructor can return an int value
         types are different
                                                        b.   Constructor return type is void
    b.   Their arguments are similar and return
                                                        c.   Constructor cannot return any value
         types are similar
                                                        d.   None of the above
    c.   Their arguments are different and return
         types are similar

    d.   A and B both                               13. Which of the following statement is true for
                                                        a class

                                                        a.   Constructors can be overloaded
9. If no access specifier is mentioned then the
    data members by default are                         b. Constructors cannot be private
    a. public                                           c. Constructors cannot be overloaded
    b.   Private
                                                        d.   All of the above
    c.   Friend

    d.   Protected
                                                    14. For a class A, the destructor will be
                                                        declared as

10. If no access specifier is mentioned then            a.   A(int);
    methods by default are
                                                        b.   ~A(int);
         a.   Public
                                                        c.   A();
         b.   Private
                                                        d. ~A();
         c.   Friend

         d.   protected
                                                    15. The destructor of a class is called

                                                        a.   Automatically when the object of class
11. Protected members defined in a class                     is created

    a. Can be accessed in main method                   b.   Automatically when the object of class
                                                             is copied
    b.   Can be accessed in any class
                                                        c.   Automatically when the object of class
    c.   Can be accessed in derived classes only             goes out of scope
d.   Automatically when the object of class     19. A is a class defined properly. A1 is an
         is assigned to other object                    object of class A. Then for the statement



16. The major function of a constructor in a                     A a2 = a1
    class is

    a. To initialize the member variables of
                                                        a.   Assignment operator is called
         class
                                                        b.   Constructor is called
    b.   To create a copy of object of the class
                                                        c.   Nothing is called
    c.   To destroy the object of the class
                                                        d.   Copy constructor is called
    d.   To handle only cleanup stuff



17. A is a base class. B is derived from A.         20. A method in a class can be

               B b;                                     a. Can never be defined as a static
                                                             member
    Constructors will be called in the sequence
                                                        b. Can never be defined as a const
    e.         B’s Constructors, A’s Constructors            member
    f.         Only B’s Constructors                    c.   defined as a static member
    g.         A’s Constructors, B’s Constructors       d.   none of the above
    h.         Only A’s Constructors                21. See the code below and choose the correct
                                                        answer

                                                                 class A {
18. A is a base class. B is derived from A.                        ........
                                                                 }
               main () {
                                                                 class B extends A{
                       B b;                                        ........
                                                                 }
               }
                                                                 class C extends B {
    Destructors will be called in the sequence                     ........
                                                                 }
    a.         B’s Destructor, A’s Destructor
                                                             This is example of
    b.         Only B’s Destructor
                                                        a.   multiple inheritance
    c.         A’s Destructor, B’s Destructor           b.   multi level inheritance
                                                        c.   single level inheritance
    d.         Only A’s Destructor                      d.   none of the above

                                                    22. See the code below and choose the correct
answer                                             a.   Can be changed as per the requirement
                                                       b.   Cannot be changed as per the
             class A {                                      requirement
               ........                                c.   Can be redefined in user manner
             }                                         d.   None of the above

             class B {                             29. Associativity of the operator while operator
               ........                                overloading
             }                                         a. Can be changed as per the requirement
                                                       b. Can be redefined in user manner
             class C extends B, A {                    c. Cannot be changed as per the
               ........                                    requirement
             }                                         d. None of the above

             This is example of
                                                   30. Given is an abstract class A
    a.   multiple inheritance
    b.   multi level inheritance                       a. object can be created of A type
    c.   single level inheritance                      b. cannot create object of A type
    d.   none of the above                             c. can create derived class of A
                                                       d. both b and c
23. The correct c++ comment
    a. /                                           31. _______________means that both the data
    b. //                                              and the methods which may access it are
    c. /* */                                           defined together in the same unit.
    d. both b and c
                                                       a. Encapsulation
                                                       b. data hiding
24. The operator << is called                          c. data binding
    a. insertion operator                              d. inheritance
    b. put to operator
    c. either a or b                               32. Can two classes contain member functions
    d. invalid operator                                with the same name?

25. The operator << is called                               a.   No.
    a. extraction operator                                  b. Yes, but only if the two classes
    b. get to operator                                           have the same name.
    c. either a or b                                        c. Yes, but only if the main program
    d. invalid operator                                          does not declare both kinds.
                                                            d. Yes, this is always allowed.
26. What is a reference?
                                                   33. The statement block used to handle an
    a. an operator                                     exception is
    b. an alias for an object                          a. throw block
    c. a pointer to an object                          b. catch block
    d. both b and c                                    c. {}
                                                       d. none of these
27. Operator overloading is
                                                   34. try block is used to write the code
    a. making c++ operators work with objects          a. that may throw an exception
    b. give new meaning to the existing operator       b. that may catch an exception and handle it
    c. making new c++ operators                        c. all the code always
    d. both b and c                                    d. none of the above

28. Associativity of the operator while operator   35. How do you define an abstract class? In
    overloading
other words, what makes a class abstract?
    a. The class must not have method                38. Defining a method in the derived class with
        definitions.                                     the same name in the base classis called
    b. The class must have a constructor that
        takes no arguments.                              a. overlaoding
    c. The class must have a function                    b. overriding
        definition equal to zero.                        c. data hiding
    d. The class may only exist during the
        planning phase.                                  d. none of these


36. If a catch statement is written to catch         39. throw keyword is used
    exception objects of a base class type, it can       a. to catch an exception
    also catch all _____ derived from that base
    class                                                b. to delete memory

    a.   Exceptions for objects                          c. to throw an object of exception
    b.   Objects of classes                              d. to allocate memory
    c.   Arguments
    d.   Errors
                                                     40. throws keyword is used in the function
37. A pure virtual method of a base class                specification
    a. may be defined in the concrete derived            a. to specify the exceptions that function
    class                                                may throw
    b. may not be defined in the concrete                a. to specify the exceptions that function
    derived class                                        may catch
    c. must be define in the concrete derived            a. to specify that function can throw nothing
    class                                                d. all of the above
    d none of these

More Related Content

Similar to B1ce9 assignmentbsc

Similar to B1ce9 assignmentbsc (20)

cse l 5.pptx
cse l 5.pptxcse l 5.pptx
cse l 5.pptx
 
11th class my sql basic operators, functions and keywords
11th class my sql basic operators, functions and keywords11th class my sql basic operators, functions and keywords
11th class my sql basic operators, functions and keywords
 
CSharp difference faqs- 1
CSharp difference faqs- 1CSharp difference faqs- 1
CSharp difference faqs- 1
 
Ganesh groups
Ganesh groupsGanesh groups
Ganesh groups
 
Destructors
DestructorsDestructors
Destructors
 
Inheritance
InheritanceInheritance
Inheritance
 
C# programming constructors
C# programming  constructorsC# programming  constructors
C# programming constructors
 
Inheritance
InheritanceInheritance
Inheritance
 
C++ questions
C++ questionsC++ questions
C++ questions
 
PART - 1 Cpp programming Solved MCQ
PART - 1 Cpp programming Solved MCQPART - 1 Cpp programming Solved MCQ
PART - 1 Cpp programming Solved MCQ
 
Inheritance and Interfaces
Inheritance and InterfacesInheritance and Interfaces
Inheritance and Interfaces
 
FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER FP 301 OOP FINAL PAPER
FP 301 OOP FINAL PAPER
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optInheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ opt
 
+2 CS class and objects
+2 CS class and objects+2 CS class and objects
+2 CS class and objects
 
C++ interview question
C++ interview questionC++ interview question
C++ interview question
 
Inheritance
InheritanceInheritance
Inheritance
 
Constructor and destructor in C++
Constructor and destructor in C++Constructor and destructor in C++
Constructor and destructor in C++
 
Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2
 

More from Mukund Trivedi

More from Mukund Trivedi (20)

System development life cycle (sdlc)
System development life cycle (sdlc)System development life cycle (sdlc)
System development life cycle (sdlc)
 
New file and form 2
New file and form 2New file and form 2
New file and form 2
 
File organisation
File organisationFile organisation
File organisation
 
Evaluation
EvaluationEvaluation
Evaluation
 
Database
DatabaseDatabase
Database
 
Case tools
Case toolsCase tools
Case tools
 
Evaluation
EvaluationEvaluation
Evaluation
 
Dfd final
Dfd finalDfd final
Dfd final
 
Sad
SadSad
Sad
 
C++ file
C++ fileC++ file
C++ file
 
Ff40fnatural resources (1)
Ff40fnatural resources (1)Ff40fnatural resources (1)
Ff40fnatural resources (1)
 
Ff40fnatural resources
Ff40fnatural resourcesFf40fnatural resources
Ff40fnatural resources
 
F58fbnatural resources 2 (1)
F58fbnatural resources 2 (1)F58fbnatural resources 2 (1)
F58fbnatural resources 2 (1)
 
F58fbnatural resources 2
F58fbnatural resources 2F58fbnatural resources 2
F58fbnatural resources 2
 
F6dc1 session6 c++
F6dc1 session6 c++F6dc1 session6 c++
F6dc1 session6 c++
 
Ee2fbunit 7
Ee2fbunit 7Ee2fbunit 7
Ee2fbunit 7
 
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (2)
 
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2 (1)
 
E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2E212d9a797dbms chapter3 b.sc2
E212d9a797dbms chapter3 b.sc2
 
C96e1 session3 c++
C96e1 session3 c++C96e1 session3 c++
C96e1 session3 c++
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

B1ce9 assignmentbsc

  • 1. INTRODUCTION TO OBJECT ORIENTED PROGRAMMING AND C++ B Sc (IT) – II Semester Assignment 1. class can have c. Cannot create an object a. Methods d. Can change the data member of the class b. Data c. Another Class 5. A static variable in a class d. All of the above a. has copy of it all the objects of the class b. is shared among all the objects of the 2. The two major components of an object are class a. Methods and Data members c. is same as instance variable b. Constructors and copy constructor d. none of the above c. Constructors and destructor d. Constructors and assignment operator 6. A class can have defined in it a. Only one constructor 3. If A class inherits its properties from a class b. Any number of constructors B, then A is called as c. Only one default constructor a. Derived class d. Only one parameterized constructor b. Base class c. Const class 7. Function overloading in c++ means d. Static class a. Two functions must have same name and different parameters 4. A const function b. Two functions must have different name and different parameters a. Cannot change the data member of the class c. Two functions must have same name and same parameters b. Cannot call other class method
  • 2. d. Two functions must have different d. Cannot be accessed outside the class name and same parameters 12. Which of the following statement is true for 8. Two functions can be overloaded if a class a. Their arguments are similar and return a. Constructor can return an int value types are different b. Constructor return type is void b. Their arguments are similar and return c. Constructor cannot return any value types are similar d. None of the above c. Their arguments are different and return types are similar d. A and B both 13. Which of the following statement is true for a class a. Constructors can be overloaded 9. If no access specifier is mentioned then the data members by default are b. Constructors cannot be private a. public c. Constructors cannot be overloaded b. Private d. All of the above c. Friend d. Protected 14. For a class A, the destructor will be declared as 10. If no access specifier is mentioned then a. A(int); methods by default are b. ~A(int); a. Public c. A(); b. Private d. ~A(); c. Friend d. protected 15. The destructor of a class is called a. Automatically when the object of class 11. Protected members defined in a class is created a. Can be accessed in main method b. Automatically when the object of class is copied b. Can be accessed in any class c. Automatically when the object of class c. Can be accessed in derived classes only goes out of scope
  • 3. d. Automatically when the object of class 19. A is a class defined properly. A1 is an is assigned to other object object of class A. Then for the statement 16. The major function of a constructor in a A a2 = a1 class is a. To initialize the member variables of a. Assignment operator is called class b. Constructor is called b. To create a copy of object of the class c. Nothing is called c. To destroy the object of the class d. Copy constructor is called d. To handle only cleanup stuff 17. A is a base class. B is derived from A. 20. A method in a class can be B b; a. Can never be defined as a static member Constructors will be called in the sequence b. Can never be defined as a const e. B’s Constructors, A’s Constructors member f. Only B’s Constructors c. defined as a static member g. A’s Constructors, B’s Constructors d. none of the above h. Only A’s Constructors 21. See the code below and choose the correct answer class A { 18. A is a base class. B is derived from A. ........ } main () { class B extends A{ B b; ........ } } class C extends B { Destructors will be called in the sequence ........ } a. B’s Destructor, A’s Destructor This is example of b. Only B’s Destructor a. multiple inheritance c. A’s Destructor, B’s Destructor b. multi level inheritance c. single level inheritance d. Only A’s Destructor d. none of the above 22. See the code below and choose the correct
  • 4. answer a. Can be changed as per the requirement b. Cannot be changed as per the class A { requirement ........ c. Can be redefined in user manner } d. None of the above class B { 29. Associativity of the operator while operator ........ overloading } a. Can be changed as per the requirement b. Can be redefined in user manner class C extends B, A { c. Cannot be changed as per the ........ requirement } d. None of the above This is example of 30. Given is an abstract class A a. multiple inheritance b. multi level inheritance a. object can be created of A type c. single level inheritance b. cannot create object of A type d. none of the above c. can create derived class of A d. both b and c 23. The correct c++ comment a. / 31. _______________means that both the data b. // and the methods which may access it are c. /* */ defined together in the same unit. d. both b and c a. Encapsulation b. data hiding 24. The operator << is called c. data binding a. insertion operator d. inheritance b. put to operator c. either a or b 32. Can two classes contain member functions d. invalid operator with the same name? 25. The operator << is called a. No. a. extraction operator b. Yes, but only if the two classes b. get to operator have the same name. c. either a or b c. Yes, but only if the main program d. invalid operator does not declare both kinds. d. Yes, this is always allowed. 26. What is a reference? 33. The statement block used to handle an a. an operator exception is b. an alias for an object a. throw block c. a pointer to an object b. catch block d. both b and c c. {} d. none of these 27. Operator overloading is 34. try block is used to write the code a. making c++ operators work with objects a. that may throw an exception b. give new meaning to the existing operator b. that may catch an exception and handle it c. making new c++ operators c. all the code always d. both b and c d. none of the above 28. Associativity of the operator while operator 35. How do you define an abstract class? In overloading
  • 5. other words, what makes a class abstract? a. The class must not have method 38. Defining a method in the derived class with definitions. the same name in the base classis called b. The class must have a constructor that takes no arguments. a. overlaoding c. The class must have a function b. overriding definition equal to zero. c. data hiding d. The class may only exist during the planning phase. d. none of these 36. If a catch statement is written to catch 39. throw keyword is used exception objects of a base class type, it can a. to catch an exception also catch all _____ derived from that base class b. to delete memory a. Exceptions for objects c. to throw an object of exception b. Objects of classes d. to allocate memory c. Arguments d. Errors 40. throws keyword is used in the function 37. A pure virtual method of a base class specification a. may be defined in the concrete derived a. to specify the exceptions that function class may throw b. may not be defined in the concrete a. to specify the exceptions that function derived class may catch c. must be define in the concrete derived a. to specify that function can throw nothing class d. all of the above d none of these