SlideShare a Scribd company logo
1 of 23
Download to read offline
PERI INSTITUTE OF TECCHNOLOGY
                                 MANNIVAKKAM, CHENNAI-48
                     DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
                              CONTINUOUS ASSESMENT TEST-3
                         CS2311 - OBJECT-ORIENTED PROGRAMMING
Class: III / EEE                                             Date:
Semester: V                                                  Duration: 180 Min.
                                                             Max. Marks: 100
                                               PART A                                  (10 X 2 = 20 )
1. Define class and object.
  Ans: Class is a collection of similar object,
 it’s an aggregation of data members and function member.
Ex: fruit mango
Objects are the basic runtime entities, ex: place, person

2.   What is the function overloading? Give an example.
  Ans: More than one functions with same name but with different set of arguments. This is known as function
overloading
 Ex: add(int a, int b);
    add(float b, float c);
3. Define copy constructor
 Ans: When one object is copied to another using initialization they are copied by executing the copy
constructor.
  Ex: integer(integer &i);

4. Define multiple inheritances.
 Ans: The inheritance where the derived class is derived from more than one base class.




5.     What are all types of type conversions?
       Ans:
     a. Implicit Type conversion,
     b. Built-in Data type to an Object,
     c. object to Built-in Data type,
     d. Object to Object

6.    What is the need for function templates? How are they created?
      Function template is used create a family of function with different argument (generic function).
7.   What is virtual base class? Give an example.
     A class which is defined as virtual at the time of inheriting it. The complier takes a note of it and when it
     is inherited further using multiple inheritance, it ensures that only one copy of the sub object of the
     virtual inherited class exists in the derived class.
     class L { /* ... */ }; // indirect base class
     class B1 : virtual public L { /* ... */ };
     class B2 : virtual public L { /* ... */ };
     class D : public B1, public B2 { /* ... */ }; // valid




8.   How is an exception handled in C++?




9.    Define a Namespaces.
 Ans: An enclosure of logical nature which helps libraries to have separate existence and solves the name conflict
     problem
Ex: using namespace std;

10. Define Java Virtual Machine (JVM).
Ans: Java virtual machine (JVM) is a virtual machine that can execute Java bytecode. It is the code execution
component of the Java software platform
PART B                           ( 5 X 16 = 80 )

11. (a) Explain the basic concepts of oops with suitable Examples                             (16)
      Ans:
      Object oriented programming concepts:
      i) objects
      ii) classes
      iii) methods and messages
      iv) abstraction and encapsulation
      v) inheritance
      vi) abstract classes
       Polymorphism




      Class:
      When you define a class, you define a blueprint for an object. This doesn't actually define any data, but it
      does define what the class name means, that is, what an object of the class will consist of and what
      operations can be performed on such an object.


      Method and Message:
      Method is function, it is used for communicating between object, message is use to command the
      functionality behavior of object.


      Abstract class:
      Class with no object is known as abstract class
Inheritance: One of the most useful aspects of object-oriented programming is code reusability. As the name
suggests Inheritance is the process of forming a new class from an existing class that is from the existing class
called as base class, new class is formed called as derived class. This is a very important concept of object oriented
programming since this feature helps to reduce the code size




Polymorphism: The ability to use an operator or function in different ways in other words giving different
meaning or functions to the operators or functions is called polymorphism. Poly refers many. That is a single
function or an operator functioning in many ways different upon the usage is called polymorphism.




                                                      Or
(b) .Write a C++ program to construct student mark list for three subjects.
      Write the program to display name, rollno,marks,avg and total. Use class and objects (16)
12. (a) Write a program to create a class “EMPLOYEE” with data members emp_name ,emp_id,
       emp_dept, basicpay, PF,gross_pay ,net_pay, store them in an array of objects. Input the total
        number if employees and perform the following:
         (i)   Calculate the Gross pay and Net pay.
         (ii)  Display the employee’s details with salary.                                  (16)

     #include<iostream.h>
     #include<string.h>
     #include<conio.h>
     class EMPLOYEE
     {
     int empid;
     char name[10];
     char dept[10];
     int bp,hra;
     float gp,np;
     int pf;
     public:
     void input();
     void show();
     void pay(int bp,int pf,int hra);
     };
     void EMPLOYEE::input()
     {
     std::cout<<"nEnter empid:";
     std::cin>>empid;
     cout<<"Enter employee name:";
     cin>>name;
     cout<<"Enter department:";
     cin>>dept;
     cout<<"Enter basic pay:";
     cin>>bp;
     cout<<"Enter hra:";
     cin>>hra;
     cout<<"Enter pf:";
     cin>>pf;
     }
     void EMPLOYEE::show()
     {
     cout<<"nn";
     cout<<"nEmployee id is: "<<empid;
     cout<<"nEmployee name: "<<name;
     cout<<"nDepartment: "<<dept;
     pay(bp,pf,hra);
     }
     void EMPLOYEE::pay(int bp,int pf,int hra)
     {
     gp=bp+hra;
     np=gp-pf;
     cout<<"nGross Pay is: "<<gp;
     cout<<"nNet Pay is: "<<np;
     }
     void main()
     {
EMPLOYEE emp[10];
int i,n;
clrscr();
cout<<"Enter the no.of employees:";
cin>>n;
for(i=1;i<=n;i++)
 {
   emp[i].input();
   emp[i].show();
 }
 getch();
}

                                          Or

 (b) Explain the constructor concept with its types with example programs.   (16)
12.   (a) What is operator overloading? What are its types? Explain the types with Example
      Programs.(16)
Or
(b) Explain in detail about type conversion and its three cases.   (16)




Example:
14.   (a) what is template ?. Explain type of template with suitable example   (16)




Type of Template:
   i) class template
   ii) Function Template

Class Template:




Example:
Example:




           Or
(b) What are the types of inheritance? Explain about Multiple inheritances with example.   (16)
Example:
15. (a) Explain the Exception Handling mechanism available in C++ with suitable examples.   (16)
Or
(b) (i) What is file handling? Explain with example program   (8)
(ii) Explain following Formatted I/O function with Example.
             1)width() 2) precision() 3) fill() 4)setf() 5) unsetf() (8)
i)




ii)




iii)
iv)




v) Unsetf()
 Clear the flag specified by the arg1,arg2 of setf( ) function

More Related Content

What's hot

basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteachingeteaching
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Kamlesh Makvana
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Languagesatvirsandhu9
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cppNilesh Dalvi
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismJussi Pohjolainen
 
Object Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioObject Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioDurgesh Singh
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Sanjit Shaw
 
Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Gamindu Udayanga
 

What's hot (19)

Bc0037
Bc0037Bc0037
Bc0037
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
Oop l2
Oop l2Oop l2
Oop l2
 
C++ Interview Questions
C++ Interview QuestionsC++ Interview Questions
C++ Interview Questions
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
 
Labsheet1stud
Labsheet1studLabsheet1stud
Labsheet1stud
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function
 
Presentation on C++ Programming Language
Presentation on C++ Programming LanguagePresentation on C++ Programming Language
Presentation on C++ Programming Language
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 
C++ interview question
C++ interview questionC++ interview question
C++ interview question
 
C++ Presentation
C++ PresentationC++ Presentation
C++ Presentation
 
C++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphismC++: inheritance, composition, polymorphism
C++: inheritance, composition, polymorphism
 
Object Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World ScenarioObject Oriented Programming With Real-World Scenario
Object Oriented Programming With Real-World Scenario
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
 
Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++Pointers Refrences & dynamic memory allocation in C++
Pointers Refrences & dynamic memory allocation in C++
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 

Viewers also liked

Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)indiangarg
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014Supriya Radhakrishna
 
inline function
inline function inline function
inline function imran khan
 
M.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IM.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IVijayananda Mohire
 
Software Engineering tools
Software Engineering tools Software Engineering tools
Software Engineering tools imran khan
 
05211201 Advanced Data Structures And Algorithms
05211201 Advanced Data Structures  And  Algorithms05211201 Advanced Data Structures  And  Algorithms
05211201 Advanced Data Structures And Algorithmsguestac67362
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSSupriya Radhakrishna
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notesSrikanth
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS ConceptBoopathi K
 
Best Engineering Colleges of Computer science – GNIOT
Best Engineering Colleges of Computer science – GNIOTBest Engineering Colleges of Computer science – GNIOT
Best Engineering Colleges of Computer science – GNIOTGniot group
 
Inline function
Inline functionInline function
Inline functionTech_MX
 

Viewers also liked (20)

Trees
TreesTrees
Trees
 
Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)Programming Fundamentals With OOPs Concepts (Java Examples Based)
Programming Fundamentals With OOPs Concepts (Java Examples Based)
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
M.TECH 1ST SEM COMPUTER SCIENCE AOS LAB PRGMS 2014
 
Viva questions
Viva questions Viva questions
Viva questions
 
inline function
inline function inline function
inline function
 
M.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment IM.Tech : Advanced DBMS Assignment I
M.Tech : Advanced DBMS Assignment I
 
Software Engineering tools
Software Engineering tools Software Engineering tools
Software Engineering tools
 
6th Semester CS / IS (2013-June) Question Papers
6th Semester CS / IS (2013-June) Question Papers6th Semester CS / IS (2013-June) Question Papers
6th Semester CS / IS (2013-June) Question Papers
 
05211201 Advanced Data Structures And Algorithms
05211201 Advanced Data Structures  And  Algorithms05211201 Advanced Data Structures  And  Algorithms
05211201 Advanced Data Structures And Algorithms
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
 
Dacj 1-1 b
Dacj 1-1 bDacj 1-1 b
Dacj 1-1 b
 
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMSM.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
M.TECH 1ST SEM COMPUTER SCIENCE ADBMS LAB PROGRAMS
 
Datastructure notes
Datastructure notesDatastructure notes
Datastructure notes
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Best Engineering Colleges of Computer science – GNIOT
Best Engineering Colleges of Computer science – GNIOTBest Engineering Colleges of Computer science – GNIOT
Best Engineering Colleges of Computer science – GNIOT
 
C++ programming function
C++ programming functionC++ programming function
C++ programming function
 
Inline function
Inline functionInline function
Inline function
 

Similar to EEE 3rd year oops cat 3 ans

C questions
C questionsC questions
C questionsparm112
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...Make Mannan
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)SURBHI SAROHA
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)rashmita_mishra
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & AnswersRatnala Charan kumar
 
C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaManoj Kumar kothagulla
 
C++ Multiple Inheritance
C++ Multiple InheritanceC++ Multiple Inheritance
C++ Multiple Inheritanceharshaltambe
 
2nd puc computer science chapter 8 function overloading
 2nd puc computer science chapter 8   function overloading 2nd puc computer science chapter 8   function overloading
2nd puc computer science chapter 8 function overloadingAahwini Esware gowda
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingHock Leng PUAH
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 

Similar to EEE 3rd year oops cat 3 ans (20)

C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
C questions
C questionsC questions
C questions
 
Ds lab handouts
Ds lab handoutsDs lab handouts
Ds lab handouts
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
 
Ppt of c++ vs c#
Ppt of c++ vs c#Ppt of c++ vs c#
Ppt of c++ vs c#
 
Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)Object Oriented Programming using C++(UNIT 1)
Object Oriented Programming using C++(UNIT 1)
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & Answers
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 
C basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kellaC basic questions&amp;ansrs by shiva kumar kella
C basic questions&amp;ansrs by shiva kumar kella
 
C++ Multiple Inheritance
C++ Multiple InheritanceC++ Multiple Inheritance
C++ Multiple Inheritance
 
2nd puc computer science chapter 8 function overloading
 2nd puc computer science chapter 8   function overloading 2nd puc computer science chapter 8   function overloading
2nd puc computer science chapter 8 function overloading
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
C sharp chap6
C sharp chap6C sharp chap6
C sharp chap6
 
Unit 3 (1)
Unit 3 (1)Unit 3 (1)
Unit 3 (1)
 

EEE 3rd year oops cat 3 ans

  • 1. PERI INSTITUTE OF TECCHNOLOGY MANNIVAKKAM, CHENNAI-48 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CONTINUOUS ASSESMENT TEST-3 CS2311 - OBJECT-ORIENTED PROGRAMMING Class: III / EEE Date: Semester: V Duration: 180 Min. Max. Marks: 100 PART A (10 X 2 = 20 ) 1. Define class and object. Ans: Class is a collection of similar object, it’s an aggregation of data members and function member. Ex: fruit mango Objects are the basic runtime entities, ex: place, person 2. What is the function overloading? Give an example. Ans: More than one functions with same name but with different set of arguments. This is known as function overloading Ex: add(int a, int b); add(float b, float c); 3. Define copy constructor Ans: When one object is copied to another using initialization they are copied by executing the copy constructor. Ex: integer(integer &i); 4. Define multiple inheritances. Ans: The inheritance where the derived class is derived from more than one base class. 5. What are all types of type conversions? Ans: a. Implicit Type conversion, b. Built-in Data type to an Object, c. object to Built-in Data type, d. Object to Object 6. What is the need for function templates? How are they created? Function template is used create a family of function with different argument (generic function).
  • 2. 7. What is virtual base class? Give an example. A class which is defined as virtual at the time of inheriting it. The complier takes a note of it and when it is inherited further using multiple inheritance, it ensures that only one copy of the sub object of the virtual inherited class exists in the derived class. class L { /* ... */ }; // indirect base class class B1 : virtual public L { /* ... */ }; class B2 : virtual public L { /* ... */ }; class D : public B1, public B2 { /* ... */ }; // valid 8. How is an exception handled in C++? 9. Define a Namespaces. Ans: An enclosure of logical nature which helps libraries to have separate existence and solves the name conflict problem Ex: using namespace std; 10. Define Java Virtual Machine (JVM). Ans: Java virtual machine (JVM) is a virtual machine that can execute Java bytecode. It is the code execution component of the Java software platform
  • 3. PART B ( 5 X 16 = 80 ) 11. (a) Explain the basic concepts of oops with suitable Examples (16) Ans: Object oriented programming concepts: i) objects ii) classes iii) methods and messages iv) abstraction and encapsulation v) inheritance vi) abstract classes Polymorphism Class: When you define a class, you define a blueprint for an object. This doesn't actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object. Method and Message: Method is function, it is used for communicating between object, message is use to command the functionality behavior of object. Abstract class: Class with no object is known as abstract class
  • 4. Inheritance: One of the most useful aspects of object-oriented programming is code reusability. As the name suggests Inheritance is the process of forming a new class from an existing class that is from the existing class called as base class, new class is formed called as derived class. This is a very important concept of object oriented programming since this feature helps to reduce the code size Polymorphism: The ability to use an operator or function in different ways in other words giving different meaning or functions to the operators or functions is called polymorphism. Poly refers many. That is a single function or an operator functioning in many ways different upon the usage is called polymorphism. Or
  • 5. (b) .Write a C++ program to construct student mark list for three subjects. Write the program to display name, rollno,marks,avg and total. Use class and objects (16)
  • 6. 12. (a) Write a program to create a class “EMPLOYEE” with data members emp_name ,emp_id, emp_dept, basicpay, PF,gross_pay ,net_pay, store them in an array of objects. Input the total number if employees and perform the following: (i) Calculate the Gross pay and Net pay. (ii) Display the employee’s details with salary. (16) #include<iostream.h> #include<string.h> #include<conio.h> class EMPLOYEE { int empid; char name[10]; char dept[10]; int bp,hra; float gp,np; int pf; public: void input(); void show(); void pay(int bp,int pf,int hra); }; void EMPLOYEE::input() { std::cout<<"nEnter empid:"; std::cin>>empid; cout<<"Enter employee name:"; cin>>name; cout<<"Enter department:"; cin>>dept; cout<<"Enter basic pay:"; cin>>bp; cout<<"Enter hra:"; cin>>hra; cout<<"Enter pf:"; cin>>pf; } void EMPLOYEE::show() { cout<<"nn"; cout<<"nEmployee id is: "<<empid; cout<<"nEmployee name: "<<name; cout<<"nDepartment: "<<dept; pay(bp,pf,hra); } void EMPLOYEE::pay(int bp,int pf,int hra) { gp=bp+hra; np=gp-pf; cout<<"nGross Pay is: "<<gp; cout<<"nNet Pay is: "<<np; } void main() {
  • 7. EMPLOYEE emp[10]; int i,n; clrscr(); cout<<"Enter the no.of employees:"; cin>>n; for(i=1;i<=n;i++) { emp[i].input(); emp[i].show(); } getch(); } Or (b) Explain the constructor concept with its types with example programs. (16)
  • 8.
  • 9. 12. (a) What is operator overloading? What are its types? Explain the types with Example Programs.(16)
  • 10.
  • 11. Or
  • 12. (b) Explain in detail about type conversion and its three cases. (16) Example:
  • 13.
  • 14. 14. (a) what is template ?. Explain type of template with suitable example (16) Type of Template: i) class template ii) Function Template Class Template: Example:
  • 15. Example: Or
  • 16. (b) What are the types of inheritance? Explain about Multiple inheritances with example. (16)
  • 18. 15. (a) Explain the Exception Handling mechanism available in C++ with suitable examples. (16)
  • 19.
  • 20. Or
  • 21. (b) (i) What is file handling? Explain with example program (8)
  • 22. (ii) Explain following Formatted I/O function with Example. 1)width() 2) precision() 3) fill() 4)setf() 5) unsetf() (8) i) ii) iii)
  • 23. iv) v) Unsetf() Clear the flag specified by the arg1,arg2 of setf( ) function