SlideShare a Scribd company logo
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

DOC
7806 java 6 programming essentials using helios eclipse
PPTX
Inheritance
PDF
OOM MCQ 2018
PPT
Set Theory In C++
PPTX
Process of design
DOC
9b4c1 vb(pd) (2)
7806 java 6 programming essentials using helios eclipse
Inheritance
OOM MCQ 2018
Set Theory In C++
Process of design
9b4c1 vb(pd) (2)

Similar to B1ce9 assignmentbsc (20)

PPTX
cse l 5.pptx
DOCX
11th class my sql basic operators, functions and keywords
PDF
CSharp difference faqs- 1
DOCX
Ganesh groups
PPTX
Destructors
PDF
Starting Out with C++ Early Objects 9th Edition Gaddis Test Bank
PPTX
6. Virtual base class.pptx and virtual function
PDF
Inheritance
PDF
C# programming constructors
PDF
DOC
C++ questions
PPTX
PART - 1 Cpp programming Solved MCQ
PPTX
Inheritance and Interfaces
PDF
FP 301 OOP FINAL PAPER
PPT
Inheritance
PPSX
PDF
Inheritance chapter-6-computer-science-with-c++ opt
PPTX
+2 CS class and objects
PDF
C++ interview question
PPT
Inheritance
cse l 5.pptx
11th class my sql basic operators, functions and keywords
CSharp difference faqs- 1
Ganesh groups
Destructors
Starting Out with C++ Early Objects 9th Edition Gaddis Test Bank
6. Virtual base class.pptx and virtual function
Inheritance
C# programming constructors
C++ questions
PART - 1 Cpp programming Solved MCQ
Inheritance and Interfaces
FP 301 OOP FINAL PAPER
Inheritance
Inheritance chapter-6-computer-science-with-c++ opt
+2 CS class and objects
C++ interview question
Inheritance
Ad

More from Mukund Trivedi (20)

PPTX
System development life cycle (sdlc)
PPT
New file and form 2
PPT
File organisation
PPTX
Evaluation
PPTX
Database
PPTX
Case tools
PPTX
Evaluation
PPTX
Dfd final
DOCX
C++ file
PPT
Ff40fnatural resources (1)
PPT
Ff40fnatural resources
PPT
F58fbnatural resources 2 (1)
PPT
F58fbnatural resources 2
PPT
F6dc1 session6 c++
DOC
Ee2fbunit 7
PPT
E212d9a797dbms chapter3 b.sc2 (2)
PPT
E212d9a797dbms chapter3 b.sc2 (1)
PPT
E212d9a797dbms chapter3 b.sc2
PPT
C96e1 session3 c++
System development life cycle (sdlc)
New file and form 2
File organisation
Evaluation
Database
Case tools
Evaluation
Dfd final
C++ file
Ff40fnatural resources (1)
Ff40fnatural resources
F58fbnatural resources 2 (1)
F58fbnatural resources 2
F6dc1 session6 c++
Ee2fbunit 7
E212d9a797dbms chapter3 b.sc2 (2)
E212d9a797dbms chapter3 b.sc2 (1)
E212d9a797dbms chapter3 b.sc2
C96e1 session3 c++
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
August Patch Tuesday
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Mushroom cultivation and it's methods.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Getting Started with Data Integration: FME Form 101
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation theory and applications.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
Assigned Numbers - 2025 - Bluetooth® Document
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
1. Introduction to Computer Programming.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
August Patch Tuesday
SOPHOS-XG Firewall Administrator PPT.pptx
OMC Textile Division Presentation 2021.pptx
Unlocking AI with Model Context Protocol (MCP)
Mushroom cultivation and it's methods.pdf
TLE Review Electricity (Electricity).pptx
Encapsulation_ Review paper, used for researhc scholars
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative study of natural language inference in Swahili using monolingua...
NewMind AI Weekly Chronicles - August'25-Week II
Getting Started with Data Integration: FME Form 101

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