New ! Computer Science MCQ Practise Tests



11th Standard English Medium Computer Science Subject Polymorphism Book Back 5 Mark Questions with Solution

11th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Science

Time : 01:00:00 Hrs
Total Marks : 25

    5 Marks

    5 x 5 = 25
  1. What are the rules for operator overloading?

  2. Answer the question (i) to (v) after going through the following class.
    classBook
    {
    intBookCode ; char Bookname[20];float fees;
    public:
    Book( ) //Function 1
    {
    fees=1000;
    BookCode=1;
    strcpy (Bookname,"C++");
    }
    void display(float C) //Function 2
    { cout<<BookCode<<":"<<Bookname<<":"<<fees<<endl; }
    ~Book( ) //Function 3
    { cout<<"End of Book Object"<<endl; }
    Book (intSC,char S[ ],float F) ; //Function 4
    };
    (i) In the above program, what are Function 1 and Function 4 combined together referred as?
    (ii) Which concept is illustrated by Function3? When is this function called/ invoked?
    (iii) What is the use of Function3?
    (iv) Write the statements in main to invoke function1 and function2
    (v) Write the definition for Function4.

  3. Write the output of the following program
    include < iostream >
    using namespace std;
    class Seminar
    {
    int Time;
    public:
    Seminar()
    {
    Time=30;cout << "Seminar starts now"<<endl; }
    void Lecture()
    {
    cout << "Lectures in the seminar on"<<endl; }
    Seminar(int Duration)
    {
    Time=Duration;cout << "Welcome to Seminar "<<endl; }
    Seminar(Seminar &D)
    {
    Time=D.Time;cout << "Recap of Previous Seminar Content "<<endl; }
    ~Seminar()
    {
    cout << "Vote of thanks"<<endl; }
    };
    int main()
    {
    Seminar s1,s2(2),s3(s2);
    s1.Lecture();
    return 0;
    }

  4. Debug the following program
    #include < iostream >
    using namespace std;
    class String
    {
    public:
    charstr[20];
    public:
    void accept_string
    {
    cout << "\n Enter String : ";
    cin>>str;
    }
    display_string()
    {
    cout< }
    String operator *(String x) //Concatenating String
    {
    String s;
    strcat(str,str);
    strcpy(s.str,str);
    goto s;
    }
    }
    int main()
    {
    String str1, str2, str3;
    str1.accept_string();
    str2.accept_string();
    cout << "\n\n First String is : ";
    str1=display_string();
    cout << "\n\n Second String is : ";
    str2.display_string();
    str3=str1+str2;
    cout>>"\n\n Concatenated String is : ";
    str3.display_string();
    return 0;
    }

  5. Answer the questions based on the following program
    #include < iostream >
    #include < string.h >
    using namespace std;
    class comp {
    public:
    char s[10];
    void getstring(char str[10])
    {
    strcpy(s,str);
    }
    void operator==(comp);
    };
    void comp::operator==(comp ob)
    {
    if(strcmp(s,ob.s)==0)
    cout << "\nStrings are Equal";
    else
    cout << "\nStrings are not Equal";
    }
    int main()
    {
    comp ob, ob1;
    char string1[10], string2[10];
    cout << "Enter First String:";
    cin>>string1;
    ob.getstring(string1);
    cout << "\nEnter Second String:";
    cin >> string2;
    ob1.getstring(string2);
    ob==ob1;
    return 0;
    }
    (i) Mention the objects which will have the scope till the end of the program.
    (ii) Name the object which gets destroyed in between the program
    (iii) Name the operator which is over loaded and write the statement that invokes it.
    (iv) Write out the prototype of the overloaded member function
    (v) What types of operands are used for the overloaded operator?
    (vi) Which constructor will get executed? Write the output of the program.

*****************************************

Reviews & Comments about 11th Standard English Medium Computer Science Subject Polymorphism Book Back 5 Mark Questions with Solution updated Book back Questions

Write your Comment