Babaria Institute of Technology Computer Science and Engineering Department Practical List of Object Oriented Programming with C

Similar documents
I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE1303. B.Tech. Year - II

Lesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

VALLIAMMAI ENGINEERING COLLEGE

Object Oriented Programming Using C ++ Page No. : 1. ASSIGNMENT SHEET WITHOUT USING OBJECT AND CLASSES

Object Oriented Programming 2012

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

END TERM EXAMINATION

PROGRAMMING IN C AND C++:

Object Oriented Programming. Solved MCQs - Part 2

Object Oriented Programming with c++ Question Bank

Get Unique study materials from

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

Introduction to Programming Using Java (98-388)

Revised time table of BCA (2011 admission) record submission

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

CS 162, Lecture 25: Exam II Review. 30 May 2018

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Inheritance, and Polymorphism.

CS201 Latest Solved MCQs

KLiC C++ Programming. (KLiC Certificate in C++ Programming)

CS201 Some Important Definitions

COMS W3101 Programming Language: C++ (Fall 2016) Ramana Isukapalli

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Shapes leading to CAD system project

Time: 3 HOURS Maximum Marks: 100

M.C.A DEGREE EXAMINATION,NOVEMBER/DECEMBER 2010 Second Semester MC 9222-OBJECT ORIENTED PROGRAMMING (Regulation 2009)

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

Introduction to C++ Introduction to C++ Dr Alex Martin 2013 Slide 1

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

Rani Durgavati Vishwavidyalaya Jabalpur (M.P.) (UICSA) Master of Computer Application (MCA) Practical List of. MCA III SEM Session -2010

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli

Programming, numerics and optimization

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

COMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli

C++ (Non for C Programmer) (BT307) 40 Hours

Time : 3 hours. Full Marks : 75. Own words as far as practicable. The questions are of equal value. Answer any five questions.

OBJECT ORIENTED PROGRAMMING. Ms. Ajeta Nandal C.R.Polytechnic,Rohtak

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

CS304 Object Oriented Programming Final Term

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Ch02. True/False Indicate whether the statement is true or false.

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

Absolute C++ Walter Savitch

Short Notes of CS201

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

CS201 - Introduction to Programming Glossary By

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

OBJECT ORIENTED PROGRAMMING

RAJIV GANDHI COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY OBJECT ORIENTED PROGRAMMING QUESTION BANK UNIT I 2 MARKS

Syllabus of C++ Software for Hands-on Learning: This course offers the following modules: Module 1: Getting Started with C++ Programming


OOP THROUGH C++(R16) int *x; float *f; char *c;

BCA (Part II) EXAMINATION, 2009 C++ PROGRAMMING Time allowed: Three Hours Maximum Marks: 50 Attempt any five questions

What is Polymorphism? Quotes from Deitel & Deitel s. Why polymorphism? How? How? Polymorphism Part 1

CS304 Object Oriented Programming

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING

Subject: Computer Science

B.C.A 2017 OBJECT ORIENTED PROGRAMMING USING C++ BCA303T MODULE SPECIFICATION SHEET

List of Practical for Class XII Computer Science

Object Oriented Paradigm

An Object Oriented Programming with C

Polymorphism Part 1 1

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

More C++ : Vectors, Classes, Inheritance, Templates

S Y B Voc Software Development Syllabus

Object Oriented Pragramming (22316)

C++ Memory Map. A pointer is a variable that holds a memory address, usually the location of another variable in memory.

Questions Bank. 14) State any four advantages of using flow-chart

AN OVERVIEW OF C++ 1

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

AC55/AT55 OBJECT ORIENTED PROGRAMMING WITH C++ DEC 2013


More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

Come and join us at WebLyceum


JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

LIST OF EXPERIMENTS. (1) (Office Automation)

SAURASHTRA UNIVERSITY

Name: Username: I. 20. Section: II. p p p III. p p p p Total 100. CMSC 202 Section 06 Fall 2015

ENGINEERING PROBLEM SOLVING WITH C++

COMP322 - Introduction to C++

AHLCON PUBLIC SCHOOL, MAYUR VIHAR I, DELHI ASSIGNMENT CLASS XI Session Chapter 1: Computer Overview

6.096 Introduction to C++

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

HOLIDAYS HOMEWORK CLASS : XII. Subject : Computer Science

Object Oriented Programming

COEN244: Class & function templates

Sri Vidya College of Engineering & Technology

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

SHREE RAMCHANDRA COLLEGE OF ENGINEERING. Laboratory Manual

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Object Oriented Design Final Exam (From 3:30 pm to 4:45 pm) Name:

Transcription:

Practical -1 Babaria Institute of Technology LEARN CONCEPTS OF OOP 1. Explain Object Oriented Paradigm with figure. 2. Explain basic Concepts of OOP with example a. Class b. Object c. Data Encapsulation d. Data Abstraction e. Data Hiding f. Inheritance g. Polymorphism 3. State various benefits of OOP Practical -2 CONCEPTS OF OOP USING C++ 1. What is C++? 2. Give the Applications of C++. 3. State and explain differences between C & C++. 4. Draw and explain the structure of C++. 5. Explain insertion (<<) and extraction (>>) operators of C++. 6. What are manipulators? Explain endl and setw with example. 7. W.A.P. to show the effects of manipulator endl and setw. 8. What is type conversion? Explain with example. 9. W.A.P. to show the effect of type conversion. 10. What is dynamic initialization? Explain with example. 11. W.A.P. to check the effect of dynamic initialization. 12. Explain reference variable with example. 13. W.A.P. that will show the effect of reference variable. 14. Write a function using variables as arguments to swap the values of a pair of integers using call by value, call by address and call by reference. 15. Explain the working of scope resolution operator (::) with example. 1

Practical -3 Babaria Institute of Technology DEFAULT ARGUMENTS AND FUNCTION OVERLOADING 1. WAP to print following using default arguments 2. repchar() // prints 45 times asterisks (*) 3. repchar ('=) // prints 45 times (=) 4. repchar('+',30) // prints 30 times (+) 5. WAP to add two matrices using default argument. 6. WA function called zerosmaller() uses two arguments. Use return by reference to the function concept and set a smaller value to 0. 7. WAP that prints various types of data using function overloading. 8. WAP that prints a character on screen using function overloading 9. WA function power() to raise a number m to power n. The function takes a double value for m and int value for n, and returns the value (results) correctly. Use default argument 2 for n and m to make a function to calculate squares when argument is not passed. WAP for the same. 10. Write overloaded functions to convert ascii to int and ascii to float. Practical -4 CLASS AND OBJECTS 1. Create a class player with the following data members name, age, runs, hi, lo, tsts, avg c. To calculate the average of the player 2. Create a class item with the following data members item code, cost, qty, total_price c. To calculate the total price of the item 2

3. Create a class book with the following data members bookname, authorname, rate, qty c. To calculate the total price of the book 4. Create a time with the following data members int h, m, s in number of seconds b. To set the data in number of seconds c. To display the data d. To convert seconds into h, m, s 5. Create a student with the following data members rollno, name, marks[6], per, class c. To calculate percentage d. To calculate class based on percentage 6. Add constructors and destructors in above five examples. 7. Write a program to count number of objects created for any class. Practical 5 ARRAY OF OBJECTS 1. Create class player with following data members Player name Team name Batting average, Read data for 10 payers, Use constructors and destructors properly and write member function for each of the following 3

c. Sort it according to the batting average d. Print a team wise sorted list of player s name with their batting average 2. Create class book with following data members book name author name Qty price, Read data for 10 books, Use constructors and destructors properly and write member function for each of the following c. To find total price (i.e. qty * price) d. Sort it according to the total price 3. Declare a class catalog with following data members title, author, year_of_publication, no_of_copies create array of 15 objects, Use constructors and destructors properly and write member function for each of the following c. To search the particular title, if exists then display that particular record 4. Create a student with the following data members rollno, name, marks[6], per, class c. To calculate percentage d. To calculate class based on percentage e. To sort the students percentagewise f. Use constructors and destructors 4

5. Create class complex with following data members real and imaginary, Use constructors and destructors properly and for performing various arithmetic operations write member functions for each of the following a. Addition function to add two complex no b. Subtraction function to add two complex no c. Multiplication function to add two complex no d. Division function to add two complex no e. Function to get data and to print data 6. Create class matrix with following data members int array[size][size] (size can vary), Use constructors and destructors properly and for performing various arithmetic operations write member functions for each of the following a. Addition function to add two matrices b. Subtraction function to add two matrices c. Multiplication function to add two matrices d. Division function to add two matrices e. Function to get data and to print data 7. Create a class date with following data member int day, month and year Use constructors and destructors properly and write member functions for each of the following a. To set the date b. To get the date c. To Print the date into dd/mm/yy format d. Nextday function, to increment the day by one, while incrementing day by one be sure for two things i. Must increment month by one if day is 29, 28, 30 or 31 in a particular month ii. Must increment year accordingly 5

8. Create a class distance with the following data members int feet, float inches Use constructors and destructors properly and write member functions for the following c. Add two distance objects 9. Create a class time with the following data members int h,m,s (input data in seconds only) Use constructors and destructors properly and write member functions for each of the following c. To convert the seconds into h, m,s d. To add two time objects 10. Create class string with the data member as char str[20], Use constructors and destructors properly and write member functions for each of the following Practical 6 c. To concatenate two string objects OPERATOR OVERLOADING 1. Rewrite complex class (from assignment 5) using operator overloading concept. i.e. overload (+,-,*,/) 2. Rewrite matrix class (from assignment 5) using operator overloading concept. i.e. overload (+,-,*,/) 3. Rewrite date class (from assignment 5) using operator overloading concept. i.e. overload (++) operator 6

4. Create class string with following data member char str[20], for performing various comparison operations, overload >, <, ==,!= operators for two string objects. 5. Create a class distance with following data members int feet float inches write an overloaded operators <, >, ==,!= two compare two distance objects. 6. Write a program to compare two date class objects by overloading <, >, ==,!= operators. 7. Write a program to compare two time class objects by overloading <, >, ==,!= operators. 8. Rewrite assignment 1&2(from assignment 6) using +=,-=, *= & /=operator overloading. 9. Rewrite student class (from assignment 5) using comparison overloaded operators < & >. Practical -7 DATA CONVERSION 1. WAP to convert from ton to Kg & gms and vice-versa. Create two classes for the same. Class tons (with ton as data member) and Class kilo (with kg and gms as data members) Use formula 1 ton = 100 kg, 1kg = 1000gms 2. Create a class time12 that store hh:mm:ss in 12 hour format along with am or pm, create another class time24 that store time hh:mm:ss in 24 hour format. Write a Conversion function to convert from one class object to another class object. 3. Write a program to perform following operations on distance calss. 1)d1 = 2.0 and 2) float m = d1 Practical -8 INHERITANCE AND CONTAINERSHIP 1. Assume that Circle is defined using radius and Cylinder is defined using radius and height. Write a Circle class as base class and inherit the Cylinder class from it. Develop classes such that user can compute the area of Circle objects and volume of Cylinder objects. Area of Circle is pie *radius*radius, while volume of Cylinder is pie*(radius * radius)*height. 7

2. Consider a class network as shown in figure given below. The class Employee derives information from both Account and Admin classes which in turn derive information from the class Person. Define all the four classes and write a program to create, update and display the information contained in Employee objects. 3. Define class employee which has fname and lname as data member. Define following: 1. Constructor for employee class with default arguments 2. Print function Derive a class called hourly_worker (with wage and hours as data members). Define following: 1. Constructor for hourly_worker class with default arguments 2. Getpay() function that calculates and returns the pay and 3. A print function 4. Write a class Box to draw a rectangle. Derive a class NewBox to add a data member character. Use this character and draw a particular shape instead of lines. 5. Create a class publication with title and price. Use necessary constructors, destructors and functions. Derive two classes books (member page_count), tape(member mins). Write necessary functions. 6. Modify above program with two base classes. One as publication and create another sales (member totalsales). Now, Derive two classes books (member page_count), tape(member 8

mins) from publication and sales. Use necessary constructors, destructors and functions. 7. Define Inheritance. Explain public, private and protected inheritance with example. 8. Rollno Engineering University CE No. of courses IT No. of course Create classes as shown in figure. Write a program to create, update and display information using inheritance. 9. What is containership? Rewrite above program using containership. Practical-9 POINTERS 1. Create a class Account. It has three data member account id, name and balance. Define function to assign value and display value. Define function that search account number given by the user. If account number exists, print detail of that account. Write a program using array of pointers to the object. Declare at least 5 account and print details. 2. Create class Country with country name, capital and population as data member. Country name and capital should be defined as char *. Write a program using array of pointers to the object. Read data at least for 5 countries and sort it country wise. 3. Define and Discuss Pure Virtual Function. 4. Explain new and delete operator. What are the advantages of new operator Over malloc? 5. What is pointer to void? 6. Explain pointer to objects with example. 9

Practical-10 COPY CONSTRUCTOR AND FRIEND FUNCTION 1. Write a program for string class using copy constructor. 2. Explain Friend function and its characteristics. Define a class matrix with an integer array of 3X3 as a data member. Define a friend function which adds two matrix objects and returns resultant matrix object. 3. Explain and demonstrate, how virtual function to achieve runtime polymorphism? Define Friend Function. Create two classes DM and DB which store the value of distances. DM stores distances in meters and centimeters and DB in feet and inches. Write a program that can read values for the class objects and add one object of DM with another object of DB. Use a friend function to carry out the addition operation. The object stores the results may a DM object or DB object, depending on the units in which the results are required. The display should be in the format of feet and inches or meters and centimeters depending on the object on display. 1 Feet = 0.3048 Meter 1 Meter = 3.28 Feet 1 Inch = 2.54 Centimeter 1 Centimeter = 0.3937 Inch Practical -11 FILE HANDLING 1. Write a program using file handling concepts to read from Country and capital file and display data for the same. 2. Write a program using file handling to demonstrate the concepts of get() and put() functions 3. WAP to read from one file and write it to another file. 4. Write a program to demonstrate use of read() and write() functions for person class. 5. WAP to copy contents of one file to another. 6. WAP to create array of 10 numbers and write even and odd numbers into two different files. Practical -12 EXCEPTION HANDLING AND TEMPLATES 1. What is this pointer? Write a complete program to illustrate the use of this pointer. 2. What is Copy Constructor? Explain with example 3. What is an exception? What are the advantages of using exception handling in a program? Illustrate C++ exception handling mechanism. 4. What is Exception? Explain Exception Handling Mechanism. Write a program that demonstrates use of multiple catch. Add at least three catch blocks in your Program. 5. What is STL? Explain in detail 6. What is Generic Programming? How it is implemented in C++. Write General format of class templates and function Template. Write program to swap Number using Function Template. Function prototype is given below: void swap(int, int, float, float ) Swap two integer number and swap two float number. [Summer-2013] 7. Explain with the help of an example why templates are used in programming? 10

Practical -13 WAP to implement stack WAP to implement Simple queue Practical -14 WAP to implement Linked List with various operations Practical-15 Any OEP problem selected by a group of students (3 to 4 from the same batch only) 11