Classes & Objects


  1. Pick out the other definition of objects.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    instance of the class


  1. How many objects can present in a single class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Because a class may contain any number of objects according to its compliance.



  1. What will happen when introduce the interface of classes in a run-time polymorphic hierarchy?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Separation of interface from implementation


  1. How many types of inheritance are there in c++?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    There are five types of inheritance in c++. They are single, Multiple, Hierarchical, Multilevel, Hybrid.



  1. What is the output of this program?
    #include <iostream>
    using namespace std;
    class student
    {
    protected:
    int Rollno;
    public:
    void get_Rollno(int num)
    {
    Rollno = num;
    }
    void put_Rollno(void)
    {
    }
    };
    class test:public student
    {
    protected:
    float Subject1,Subject2;
    public:
    void get_mark(float num1, float num2)
    {
    Subject1 = num1;
    Subject2 = num2;
    }
    void put_marks()
    {
    }
    };
    class sports
    {
    protected:
    float score;
    public:
    void getscore(float s)
    {
    score = s;
    }
    void putscore(void)
    {
    }
    };
    class result: public test, public sports
    {
    float total;
    public:
    void display(void);
    };
    void result::display(void)
    {
    total = Subject1 + Subject2 + score;
    put_Rollno();
    put_marks();
    putscore();
    cout << "Total Score = " << total << "\n";
    }
    int main()
    {
    result student;
    student.get_Rollno(101);
    student.get_mark(50.25, 42.52);
    student.getscore(7.0);
    student.display();
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    In this program, We are passing the values by using different
    methods and totaling the marks to get the result.