Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: Object Oriented Programming Questions
Description: Here are few questions of OOPS for Students who study computer sciences as compulsory or optional subject at BS levels. Notes that match the Students level of concepts !

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


BS COMPUTER SCIENCE
SUBJECT

:

OOPS

Section A
Question 1(a):
Answer:
Template :
Template are the mechanism by which c++ implement genetic concept
...

Template is a blue print or formula for creating a generic class or function
...
class template is
an alternative of function overloading as once class is declared it can be used for different data types
to have a various related result
...


Syntax:
template < class T1, class T2,
...


:

DESTRUCTOR
Destructor is a special
member of a class used to
deallocate memory for a
class
...

to execute some code at the
time of it destruction
...


They are called in reverse
order
...


The memory deallocate by
destructor can be further
located at the other resources
used in the program
...


There is always a single
destructor in a class
...


It can not be overloaded
...


Destructor have the same
name as the class but have
a tild (~) symbol in a name
...
e c++ and
high level language i
...


Destructors are not supported
in Java
...


Destructors have no
parameters or arguments as
it only deallocate memory for
an object
...


It has no such concept
...
The return address is located where subroutine was called
...
It terminate the execution of the function and transfer the
control back to the calling function (or to the operating system if transfer control from main()
...
It return value for only void
function for non void function it may or may not return value
...
#include 2
...

4
...
{
6
...
Public:
8
...
{
10
...
Cout<<” constructor \n”;
12
...
}
14
...
{ 16
...
Cout<<”Destructor \n”;
18
...

20
...
Int main()
22
...
Method m();
24
...
}
26
...

Question 1(b):
Answer :
Difference Between Class and Object :

Class
1
...
e object
...
object is an instance of class
helps programmers to used
variables and methods inside
class
...
Class once created ,it does not 2
...

allocate memory space to store
values
...
It is declared using keyword
class
...
It is declared using keyword
new
...
Cass is used to bind data as
well as methods in a single
unit
...
Object is a variable of class
...
Class have logical exsistance 5
...

used for some special purpose
...
The new class inherit all the behavior of the original class
...

Derived class:
The new class that inherit the properties and functions of the existing class is known as Derived
class or child class
...
The basic principle of
inheritance is that each subclass share common properties with the class from which it is derived
...

2
...

4
...
Reusebillity:
Inheritance allows the developers to reuse the existing code in many situations
...
Saves Time And Efferts:
Inheritance saves a lot of time and effort to write the same classes again
...

3
...
This class can be used in a new application
without compiling it again
...


Program:
1
...
using namespace std;
3
...
o(); B
...
This operator has
many uses in c++
...

Uses:
Scope Resolution Operator is used for:
1
...

2
...

3
...

4
...


5
...

6
...

Program:
1
...

3
...
int main()
5
...
Int num=2;
7
...
std::Cout<<”local variable=”<<::num;
9
...
In Hierarchical inheritance all the features that are common in derived classes are
included in the base class
...

}
Class first_derived_class : public base _class{

...

}
Class third _derived_class: public base_class{

...
All derived classes have there own members as well as there base class
members
...

Program using Hierarchical Inheritance:

//Hierarchical inheritance
1
...

using namespace std;
3
...
class A //single base class
5
...
Public:
7
...
void getdata()
9
...

11
...

13
...

15
...

17
...

19
...

}
22
...

24
...

26
...

28
...

31
...

33
...

35
...


};
class C: public A // derived from base class A
{
public :
void sum()
{
cout<<”\n the sum of X and Y is :”< ...
void subtrction()
37
...

39
...

41
...
};
43
...
int main()
45
...
C obj1; //object of derived class C
47
...
D obj3;//object of derived class D 49
...
obj1
...
obj1
Title: Object Oriented Programming Questions
Description: Here are few questions of OOPS for Students who study computer sciences as compulsory or optional subject at BS levels. Notes that match the Students level of concepts !