Parallel object-oriented programming for parallel simulations
Object Oriented Programming ( 22316)
-
Upload
khangminh22 -
Category
Documents
-
view
2 -
download
0
Transcript of Object Oriented Programming ( 22316)
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 1 of 18
Subject
Object Oriented Programming ( 22316)
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 2 of 18
Chapter No. Name of chapter Marks With
Option
1 Principle of Object Oriented programming 24
2 Classes and Object 30
3 Extending classes using inheritance 28
4 Pointers and polymorphism in C++ 10
5 File operations 14
Total Marks :- 106
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 3 of 18
Q.1 Attempt any FIVE 5*2=10
a) Principle of Object Oriented programming
b) Classes and Object
c) Principle of Object Oriented programming
d) Classes and Object
e) File operations
f) Classes and Object
g) Extending classes using inheritance
Q.2 Attempt any THREE 3*4=14
a) Principle of Object Oriented programming
b) Extending classes using inheritance
c) Classes and Object
d) Pointers and polymorphism in C++
Q.3 Attempt any THREE 3*4=12
a) Classes and Object
b) Principle of Object Oriented programming
c) Extending classes using inheritance
d) Classes and Object
Q.4 Attempt any TWO 2*6=12
a) Extending classes using inheritance
b) Principle of Object Oriented programming
c) Classes and Object
d) File operations
Q.5 Attempt any TWO 2*6=12
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 4 of 18
a) Pointers and polymorphism in C++
b) File operations
c) Classes and Object
Q.6 Attempt any TWO 2*6=12
a) Principle of Object Oriented programming
b) Extending classes using inheritance
c) Extending classes using inheritance
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 5 of 18
Syllabus:-
Unit
No. Name of the Unit
Course Outcome
(CO)
1 Principle of Object Oriented programming Co-316-1
2 Classes and Object Co-316-2
3 Extending classes using inheritance Co-316-3
Q.1
Attempt any FOUR 4*2=8Marks
Course Outcome
(CO)
a) Principle of Object Oriented programming CO-316.1
b) Principle of Object Oriented programming CO-316.1
c) Classes and Object CO-316.2
d) Classes and Object CO-316.2
e) Extending classes using inheritance CO-316.3
f) Classes and Object CO-316.2
Q.2 Attempt any TWO 2*6=12Marks
a) Principle of Object Oriented programming CO-316.1
b) Extending classes using inheritance CO-316.3
c) Classes and Object CO-316.2
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 6 of 18
Syllabus:-
Unit
No.
Name of the Unit
Course Outcome
(CO)
3 Extending classes using inheritance Co-316-3
4 Pointers and polymorphism in C++ Co-316-4
5 File operations Co-316-5
Q.1
Attempt any FOUR 4*2=8Marks
Course Outcome
(CO)
a) Extending classes using inheritance (CO-316.3)
b) Pointers and polymorphism in C++ (CO-316.4)
c) Pointers and polymorphism in C++ (CO-316.4)
d) Extending classes using inheritance (CO-316.3)
e) File operations (CO-316.5)
f) File operations
(CO-316.5)
Q.2 Attempt any TWO 2*6=12Marks
a) Extending classes using inheritance (CO-316.3)
S Pointers and polymorphism in C++ (CO-316.4)
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 7 of 18
c) Pointers and polymorphism in C++ (CO-316.4)
d) File operations (CO-316.5)
COURSE: Object Oriented Programming (22316)
CO.NO Course Outcome
CO-
316.01 Develop C++ program to solve problem using Procedure Oriented Approach.
CO-
316.02 Develop C++program using classes and objects.
CO-
316.03 Implement Inheritance in C++ program.
CO-
316.04 Use Polymorphism in C++ program.
CO-
316.05 Develop C++ program to perform file operations.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 8 of 18
UNIT-1 . Principle of Object Oriented programming
(Total Marks =14)
Q1. Explain Need of OOP.
Q2. List any four Object Oriented languages.
Q3.Write any four features of object oriented programming.
Q4. Differentiate between OOP& POP.
Q5. Explain the structure of C++program with suitable example.
Q6. Explain different operator used in C++.
Q7. Describe syntax of „cin „& „cout‟ with example.
Q8. Explain the Scope resolution operator.
Q9.What is function ?What is call by value? What is call by reference? What is difference
between them?
Q10.Give syntax and example of defining structure and declaring structure variables.
Q11. Write a C++ program to find whether the entered number is even or odd.
Q12.Write a C++ program to declare a structure employee with member as empid and
empname.Accept and display data for one employee using structure variable
Q13.Define a structure with it‟s syntax.
Q14.Write a program to display largest element from entered array.
Q15. Write a program to swap two integer values by using call by reference.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 9 of 18
Q16. Write a program to find whether a string is palindrome or not.
Q17.Write a C++ program to accept array of five elements, find and display smallest
number from an array.
Q18. Write a C++ program to print multiplication table of 7.
(example 7*1=7…..7*10=70)
Q19.Write a program to find whether the entered number is even or odd
Q20. Write a C++ program to declare a structure employee with member as empid and
empname .Accept and display data for one employee using structure variable.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 10 of 18
UNIT- 2. Classes and Object (Total Marks =18)
Q1.Define class with it‟s syntax.
Q2. Explain how memory is allocated to an object of a class with diagram.
Q3.State any two access specifier with example.
Q4.How many way we can define member function in class?Give it‟s syntax.
Q5.Differnce between Defining member function inside and outside class.
Q6. Compare structure and class.
Q7.Explain object as function argument.
Q8. List characteristic of static data member and static member function.
Q9.What do you mean by inline function ?Write its syntax and example
Q10.polymorphism is implemented using function overloading . justify the statement.
Q11.How do we invoke a constructor.
Q12. Describe constructor with syntax and example?
Q13.Explain types of Constructor with example.
Q14.What is parameterized constructor ?Explain the example.
Q15.Explain overloaded constructor in class with suitable example.
Q16. Explain multiple constructor in class with example.
Q17. Explain constructor with default argument.
Q18.What is copy constructor ?Give the syntax and example for copy constructor.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 11 of 18
Q19.What is destructor ? give it‟s syntax .How many destructors can be defined in a single
class?
Q20. Differentiate between constructor and destructor.
Q21.Explain Friend function with example.
Q22.Why Friend function is required ? Give four characteristic of friend function.
Q23. Write a program to calculate area of circle and rectangle using the concept of function
overloading.
Q24. Write a C++ program to declare a class „circle‟ with data members as radius and
area. Declare a function getdata to accept radius and putdata to calculate and display area
of circle.
Q25. Write a C++ program to declare a class addition with data members as x and y.
Initialize value of x and y with constructor. Calculate addition and display it using function
„display.‟
Q26. Write a C++ program to swap two integer numbers and swap two float
numbers using function overloading.(Hint : overload swap function)
Q27. Write a C++ program to find greatest number among two numbers from
two different classes using friend function.
Q28.Write a C++ program to declare a class „Account‟ with data members as
accno, name and bal. Accept data for eight accounts and display details of
accounts having balance less than 10,000.
Q29. Write a C++ program to find smallest number from two numbers using friend function.
(Hint : use two classes).
Q30. Write a C++ program to declare a class student with members as roll no, name and
department. Declare a parameterised constructor with default value for department as „CO‟
to initialize members of object. Initialize and display data for two students.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 12 of 18
Q31. Write a program to show object as function arguments.
Q32.write a program to declare a class student having data member name , percentage
write constructor to initialize these data member ,Accept and display this data for one
object.
Q33. write a program to declare a class student having data member as hrs,min secs.write
constructor to assign values and destructor to destroy values. Accept & display data for one
object.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 13 of 18
datamember : Name
: Teacher Class
Class : Info
UNIT- 3. Extending classes using inheritance
(Total Marks =16)
Q1.What is inheritance? Why inheritance used in C++.
Q2.What is base class? What is derived class? Give example.
Q3.State general format of defining derived class.
Q4.Write any two advantages of inheritance.
Q5.State different types of inheritance with diagram.
Q6.Explain single inheritance with diagram.
Q7.Explain function overriding with example.
Q8.Explain Multiple inheritance with example.
Q9.Explain virtual base class in inheritance with suitable diagram.
Q10.State different visibility modes used in inheritance.
Q11. Write a C++ program to declare a class „College‟ with data members as name
and college code. Derive a new class „student‟ from the class college with data
members as sname and roll no. Accept and display details of one student with
college data.
Q12.Write a C++ program to implement inheritance shown in following figure:
Accept and display data of one teacher and one student using object of class „Info‟.
datamember : sname
: Student Class
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 14 of 18
Class : Carmanufacturer
datamember : Name
Class : Carmodel
datamember : Model name,
Model no.
Class : Car
datamember : Car no., colour
data mem : Total
: Result Class
data mem : m2
: Subject 2 Class
data mem : m1
: Subject 1 Class
Class : Employee
Data : empid
Member : empcode
Datamember : department : Manager Class
Datamember : Skill : Programmer Class
Q13 Write a C++ program to implement following inheritance.
SAccept and display data for one programmer and one manager.
Q14.Write C++ program for following multilevel inheritance.
Accept and display data for one car with all details.
Q15.Write a C++ program to declare a class COLLEGE with members as college code.
Derive a new class as STUDENT with members as studid. Accept and display details of
student along with college for one object of student.
Q16..What is hybrid inheritance? Give one example.
Q17.Write a program to implement multiple inheritance as shown in following
Accept and display data for one object of class result.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 15 of 18
: Result Class
data mem : grade
: sports Class
data mem : percentage
: test Class
Data mem : College_code
: College Student
student id
Class
Q18.Write a C++ program to implement following in heritance. Refer Figure
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 16 of 18
UNIT- 4. Pointers and polymorphism in C++
(Total Marks =14)
Q1.Define pointer variable .Give its syntax.
Q2.What is advantages of using pointer.
Q3.How address of (&) operator is used in pointer ,explain with example.
Q4.Give significance of „&‟and „*‟operator.
Q5. Explain pointer arithmetic with example.
Q6.What is pointer to array? Explain with example.
Q7. Explain memory management operator.
Q8.How pointer is assigned to object? Explain with simple example.
Q9. Explain „this‟ pointer.
Q10.Explain the derived class access by pointer.
Q11.Explain Virtual Function with example .
Q12.What is need of virtual function ? Explains with example.
Q13. Explain „pure‟ Virtual function.
Q14. Explain Abstract class with example.
Q15.Define polymorphism . list types of polymorphism.
Q16.What is static polymorphism.
Q17.Compare Compile time polymorphism and Runtime polymorphism.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 17 of 18
Q18.Explain rules for operator overloading.
Q19.Write a program to find reverse of a string using pointer to string.
Q20. Write a program to overloaded binary ++ operator.
Q21. Write a program to overloaded – operator to negate value of variable.
Q22.Write a program to copy the content of one string to another string using pointer to
string .
Q23.Write a program to declare a class Account having data member as acc_no and
balance. Accept and display data for five object using pointer to array of object.
Q24.Write a program which concate and reverse string by using pointer to string.
Q25.Write a program for overloaded of ++ unary operator for inch of feet conversion.
12 inches = 1 feet
Q26. Write a program to copy content of one string to another string using pointer to string.
Q27.Wrtie a program to search a number from an array using pointer to array.
Q28. Implement a program to declare a class city with data member city name and state.
Accept and display data for 1 object using pointer to object.
Q29. Write a program to search a number from an array using pointer to array.
Q30 . Write a program to find length of a string using pointer to string.
Q31. Write a C++program to overload binary operator „+‟ to concatenate two strings.
Prepared By: Ms.S.S.Rajole (Department of Information Technology) Page 18 of 18
UNIT- 5. File operations (Total Marks =08)
Q1. Describe meaning of following:
(i) ios : : in
(ii) ios : : out
Q2.Give the syntax and use of with respect to
(i) get()
(ii) put()
Q3.Explain the any two file stream classes needed for the file manipulation.
Q4.What are stream extraction and stream insertion operators?
Q5.Explain the function used to read and write data in binary file.
Q6.List file mode operation.
Q7.Explain the namespace in C++ ,with their syntax and Rule with example.
Q8.Write a C++ program to count number of spaces present in contents of file.
Q9.Write a C++ program to write “Welcome to poly” in a file .Then read the data from file
and display it on screen
Q10.Write a program for reading and writing data in a file.