[go: up one dir, main page]

0% found this document useful (0 votes)
62 views4 pages

OOP Important Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views4 pages

OOP Important Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Prof Ram Meghe College of Engineering & Management, Badnera

Department of Electronics & Telecommunication Engineering


III Sem 3ETC05 Object Oriented Programming Important Questions

1) What is object oriented programming? List the advantages/ benefits of OOP


2) Write a C++ program to swap values of two variables without using third variable.
3) Write a program in C++ to print the area and perimeter of a rectangle by taking input
from the user.
4) Differentiate between procedure oriented programming and object oriented
programming?
5) Give the structure of C++ program. Write a C++ program to convert the given weight in
kilograms into a weight in pounds.
6) Write a C++ program to swap values of two variables.
7) Explain the following terms in OOP- (elements/ pillars/ concept of OOP)
a. Inheritance
b. Polymorphism
c. Classes
d. Objects
e. Dynamic binding
f. Message passing
g. Data abstraction and encapsulation
8) Write a C++ program to display addition and average of five numbers without using loop.
9) What are identifiers? Give the rules for naming identifiers in C++.
10) What are the data types in C++? Explain in brief.

11) Explain the user defined data types in C++ in detail.


12) Explain the various control structures in C++ in detail.
13) What is function overloading? Write a program using overloaded functions for
computing volume of a cube, cylinder and a rectangular box.
14) What are inline functions? Which are the situations where inline expansion may not
work?
15) Write a complete C++ program using function to find the square of a given number.
16) Write a program to display the name of the day in a week depending upon the number
(from 1 to 7) entered by keyboard. Use switch-case structure.
17) Explain reference variables and its use in C++.
18) Write a program to determine factorial of a given number using for loop.
19) Write a C++ program using an inline function for finding the maximum of the two
numbers entered by the user.
20) What are default arguments? Write a program to compute tax. A tax compute function
takes two arguments: amount and tax percentage. Default tax percentage is 15% of
income.
21) Discuss the use of scope resolution operator :: in C++.
22) Write a C++ program to implement a class Student having following members.
a) Data Members: i) Name of student ii) Marks of two subjects M1, M2
b) Member functions: i) To assign initial values ii) To compute total and average iii) To
display result i.e. Name, total and average.
The program will accept name of a student and two subject marks and display name,
total and average of two subjects.
23) What is a Constructor? List rules about declaring and using Constructors.
24) Explain with suitable example parameterized constructor.
25) Define a class Time with three integer variables i.e. hours, minutes and seconds. Write a
C++ program to add two Time variable (objects) entered in hours, minutes and seconds
into the third time variable. Demonstrate the use of constructors and destructor.
26) What are friend classes? Write a normal function which adds objects of the complex
number class. Declare this normal function as friend of complex class.
27) Explain the types of constructors. How is the constructor and destructor function
invoked?
28) Write a C++ program to read two integer numbers through two different objects of class
„Addition‟. Add these two integers using friend function and display the total.
29) What is a friend function? What are the characteristics of a friend function?

30) Describe the steps involved in overloading of operators.


31) Write a program to add two complex numbers C1 and C2 and store the result in C3 using
operator overloading.
32) Write a program for addition of complex numbers with friend feature using binary
operator overloading.
33) Write a C++ program to overload unary minus (-) operator using friend function.
34) Enlist the rules for overloading C++ operators.
35) Define class “Time” having integer data members hours, mins and secs. Create 3 objects
of this class T1, T2, T3. The data members of T1 and T2 are initialized from keyboard
and data members of object T3 are obtained from addition of data member of object T1
and T2. Overload + operator as a friend function.
36) What is operator overloading? Why it is necessary to overload operators?
37) Explain the syntax of binary operator overloading. How many arguments are required in
the definition of an overloaded binary operator?
38) Explain the syntax of unary operator overloading. Write a C++ program to overload
unary minus (-) operator as a member function in such a way that when applied to
object, it should change the sign of each of its data items.
39) What is a conversion function? How is it created? Explain its syntax.
40) Write a program to overload the unary minus operator in such a way that when applied to
object should change the sign of each of its data items. Declare a class with data members
int x, y, z and member functions named getdata, display for reading the data members
and display their values respectively. Use operator function for overloading unary minus.
(same program of Q33 or Q38 can be written.)
41) List the C++ operators
a. that can not be overloaded.
b. that can be overloaded for binary usages.
c. that can not be overloaded for unary usages.

42) What is visibility mode? What are different inheritance visibility modes supported by
C++?
43) Write a C++ program to implement the structure shown below.
Class student has data members roll no and name. Class test has data members marks1
and marks2 and Class sports has data member sports marks. Define necessary member
functions in these classes. Class result has data member for total marks. Finally display
roll no, name, marks obtained and total marks.

student

test sports

result

44) Why do we need virtual function? What are pure virtual functions? How do they differ
from normal virtual functions?
45) What is inheritance? What are its advantages? With suitable example explain single
inheritance?
46) Write a C++ program to implement the structure shown below using the concept of
virtual base class. Define necessary data members and member functions in the
respective class and finally display roll no, marks1, marks2, sports score and total result.

student

test sports

result

47) How do we define a derived class? Explain single inheritance in C++ with the help of a
program?
48) What is virtual function? List the rules for implementing virtual functions in C++.
49) What are different forms of inheritance? Explain with syntax how to define a derived
class?
50) Consider the class structure shown in figure below. Class student stores name and roll no,
class test stores marks obtained in sub1 and sub2, class result contains total marks in sub1
and sub2. Create all classes and include necessary functions to read name and roll no of
student, read marks in sub1 and sub2, calculate total marks in sub1 and sub2 and then
display it.

student

test

result

division

51) Explain the structure of a Java program and mention the steps for executing a Java
program.
52) Write a Java program to calculate area of circle.
53) What are Java identifiers? List the rules of Java identifiers.
54) Write a program in Java that accepts a series of resistances and outputs the equivalent
resistance when they are connected in series.
55) What is „this‟ keyword in Java? Write a suitable program using „this‟ keyword.
56) What is method overloading? Explain with the help of a program.
57) Write a program in Java that reads a number in meters, converts it to feets and displays
the result.
58) Explain why Java is known as a platform independent language?

You might also like