Whatsapp +92 307 4151718 vuassassins@gmail.com

CS304 – Object Oriented Programming

In CS304 Object Oriented Programming we have you covered with Digitized Past Papers From Fall of Mid Term and Final Term.

FINAL TERM

CS304_FINAL_SOLVEDSUBJ_MOAAZ                        View     Download

CS304_FINAL_SPRING2005                                         View     Download

CS304_FINAL_SPRING2006                                         View     Download

CS304_FINALTERMSOLVEDMCQSMOAAZ.                View     Download

MID TERM

CS304_Mid_2009_Sbj_Moaaz_Paper5                           View     Download

CS304_Mid_2010_MCQs_Moaaz_Paper1                      View     Download

cs304_Mid_2010_Mcqs_Moaaz_Paper6                         View     Download

CS304_Mid_20109_Sbj_Moaaz_Paper4                         View     Download

CS304_MId_Fall_Paper3                                                 View     Download

CS304_Mid_Fall_Sbj_Paper2                                          View     Download

FINAL QUIZ PREPARATION BY JAHANZAIB ASHIQ

CS304 – Final Preparation 1

CS304 – Final Preparation 2

CS304 – Final Preparation 3

CS304 – Final Preparation 4

CS304 – Final Preparation 5

POSTED DATE:31-01-2019   IDEA SOLUTION

 

#include<iostream>

using namespace std;

class person{

private:

string nam;

string gen;

int age;

public:

person();

 

void readdata(){

cout<<“name : “<<nam<<endl;

cout<<“gender : “<<gen<<endl;

cout<<“age : “<<age<<endl;

}

 

void displaydata(){

person::readdata();

}

 

};

 

class study:public person{

protected:

int rollno;

string sub;

public:

study();

 

void readdata(){

person::displaydata();

cout<<“Roll no : “<<rollno<<endl;

cout<<“subject : “<<sub<<endl;

 

}

void displaydata()

{study::readdata();

}

 

};

class exam:public study{

int submrk1;

int submrk2;

public:

exam();

 

void readdata(){

study::displaydata();

cout<<“marked scored in subject 1 : “<<submrk1<<endl;

cout<<“marked scored in subject 2 : “<<submrk2<<endl;

cout<<“total marked scored :”<<submrk1+submrk2<<endl;

}

void displaydata(){

exam::readdata();

 

}

 

};

 

person::person(){

cout<<“name : “;

cin>>nam;

cout<<“Gender : “;

cin>>gen;

cout<<“age : “;

cin>>age;

 

}

study::study(){

cout<<“Roll no : “;

cin>>rollno;

cout<<“Study : “;

cin>>sub;

}

exam::exam(){

cout<<“enter number of subject no 1 : “;

cin>>submrk1;

cout<<“enter number of subject no 2 : “;

cin>>submrk2;

}

 

main(){

 

cout<<“Enter data for student …….”<<endl;

 

exam t;

cout<<“\n\nstudent detail ……..”<<endl;

t.displaydata();

 

}

 

1 Comment

  1. AYESHA MUMTAZ

    < strong>FINAL TERM EXAMINATION 2011
    1-define composition and give its example with coding
    Answer:- (Page 53)

    An object may be composed of other smaller objects, the relationship between the “part” objects and the “whole” object is known as Composition.
    Example: Ali is made up of different body parts; They can’t exist independent of Ali.

    2-what are container classes? How many types of container classes are there?
    Answer:- (Page 312)

    Container is an object that contains a collection of data elements like we have studied before now we will study them in detail. STL provides three kinds of containers,
    1. Sequence Containers
    2. Associative Containers
    3. Container Adapters

    3-what is virtual inheritance?
    Answer:- (Page 253)
    In virtual inheritance there is exactly one copy of the anonymous base class object

    4-can a constructor throw exception? If it fails, how should this error be handled?
    Answer:

    One-stage constructors should throw if they fail to fully initialize the object. If the object cannot be initialized, it must not be allowed to exist, so the constructor must throw.

    5-define inheritance and give its example.
    Answer:- (Page 29)

     Derived class inherits all the characteristics of the base class
     Besides inherited characteristics, derived class may have its own unique characteristics
     Major benefit of inheritance is reuse

    7-what is constructor?
    Answer:- (Page 74)

    Constructor is used to initialize the objects of a class. Constructor is used to ensure that object is in well defined state at the time of creation.

    8-define static and dynamic binding.
    Answer:- (Page 227)

    Static binding means that target function for a call is selected at compile time. Dynamic binding means that target function for a call is selected at run time.

Submit a Comment