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

3rd Semester, B. Tech, Object Oriented Programming, IT 2005 (For 2022 (L.E.) 2021 & Previous Admit

Uploaded by

aksad1991
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)
36 views4 pages

3rd Semester, B. Tech, Object Oriented Programming, IT 2005 (For 2022 (L.E.) 2021 & Previous Admit

Uploaded by

aksad1991
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

Qn.

Set Code-1 Semester: 3'd


Programme: 8.Tech
Branch: CSE, rr, CSCE, CSSE

AUTUMN END SEMESTER EXAMINATION-2022


3 rd Semester B.Tech
OBJECT ORIENTED PROGRAMMING
IT 2005
(For 2022 (L.E), 2021 & Previous Admitted Batches)
Time: 3 Hours Full Marks: 50
Answer any SIX questions.
Question paper consists of four SEC110NS i.e. A, B, C and D.
Section A is compulsory.
Attempt minimum one question each from Sections B, C, D.
The figures in the margin indicatefull marks.
Candidates are required to give their answers in their own words as far as practicable
and all parts ofa question should be answered at one place only.

SECTION-A
I. Answer the following questions. [ I x 1 O]
(a) How does a class enforce data-hiding, abstraction &
encapsulation?
(b) Illustrate the concept of default arguments using appropriate
example.
(c) Differentiate between function overloading and function
overriding.
(d) What do you mean by virtual base class?
(e) In an overloaded binary operator function, why does friend
function take two objects and whereas member function takes
just one object?
(f) What is delegation?
(g) Find the output.
#include <iostream>
using namespace std;
class A
{
int a;
public:
A(){}

KIIT-l)U 21122 SOT Autumn End Semester faammat,on-2022 (l)


A(int d)
{a=d;}
-A()
{
cout<<"Object of A being deleted"<<endl;
}

void show_A()
{ cout<<a<<endl;
}
};
class B{
int b;
public:
B(){}
B(int d)
{b=d; }
-BO
cout<<"Object of B being deleted"<<endl;
}
void show B()
{ cout<<b<<endl;}
};
class C: public A, public B
{
int c;
public:
C():A(),B(){}
C(int dl, int d2,int d3):A(d1),B(d2)
{
c= d3;
}
-co
{
cout<<"Object of C being deleted"<<endl;
}
void show_CO
{
show_A();
show_B();
cout<<c<<endl;
}
};

KJIT-DU'2022 SOT Autumn End SemeJter Examination-2022 (2)


int main()
{
C *p;
p=new C( I 0,20,30);
p->show_C();
delete p;
return 0;

(h) Differentiate between the following statements:


throw;
throw 8;
(i) What do you mean by object slicing?
U) Can we define a constructor as private member of a class?
Justify your answer.
SECTION-B
2. (a) What is the difference between member function defined [4]
inside and outside the body of the class? How is inline
member function defined outside the body of the class?
Discuss the memory requirements for static and non-static
data members.
(b) Write a program in C++ to keep track of and display the [4]
number of objects created, the number of objects destroyed,
and number of active objects for a class named counter.

3. (a) Write a program to compare two data members belonging to [4]


two different classes.
(b) What is abstract class? Write a program having student as an [4]
abstract class and create many derived classes such as
engineering, science, medical & commerce from the student
class. Create their objects and process them.
SECTION-C
4. (a) Create a class student with data members: roll-no & name. [4]
Include two member functions to input and output the
corresponding values of the above data members. Access
members of student class using Array of Pointers to Objects.
(b) WAP to create a class which stores name, id and salary of an [4]
employee. Allocate and de-allocate the memory dynamically for
the employee name. Create objects using default, copy and
parameterized constructor and display them.

Kl!T-DU,2022 SOTAutunm End Semester Examination-2022 (3)


5. (a) Write a program to create class which stores and integer array. [4]
Overload the following operators given below:
-Unary minus to negate all the elements of the array.
-binary multiplication to multiply an integer number to all the
elements of the array and store in another object. [OB2=OB1*5]
(b) Write a program in C++ to throw the exception when user [4]
entered the amount to be withdrawn is less than zero(<O) and
greater than 20000(>20000).

6. (a) Write a program to copy the contents of one file in reverse order [4]
to another file.
(b) Convert Centimeter to Meter using class type to basic type [4]
conversion.( 1Meter = 100 Centimeter)

SECTION-D
7. (a) Write a program in C++ to enter a string into file and read the [4]
same file to display all the words in the file with starting letter
'R'.
(b) Convert Degree to Radian using conversion routine in the [4]
destination class. (Radian=Degree* PI /180)
8. (a) Write a C++ program to implement the following structure: [4]
Create a class Person with data members: name & age &
member functions: void readdata() & void displaydata(). Derive
a class Student from the class Person with data members: Roll
No & Branch & member functions: void readdata() & void
displaydata(). Derive a class Exam from the class Student with
data members: mark! & mark2 & member functions: void
readdata() & void displaydata(). Derive a class Sports from the
class Person with data members: game_name & score &
member functions: void readdata() & void displaydata(). Derive
a class Result from the class Exam & the class Sports with data
member: total & member functions : void readdata() & void
displaydata(). Result class will display the total marks scored
by the student by adding the subject marks and score.
(b) Write a C++ program for overloaded template functions to [4]
calculate the perimeter of a circle, square and rectangle.
*****

KI!T-DU,·20J2·SOT Au1um11 End Semester Examination-2022 (4)

You might also like