Professional Documents
Culture Documents
UNIT-I
Classes: Class serves as a blueprint or a plan or a template. It specifies what data and what
functions will be included in objects of that class.
4. What is an encapsulation?(May/June2010)
The wrapping up of data and functions into a single unit is known as data encapsulation. Here
the data is not accessible to the outside world. The insulation of data from direct access by the
program is called data hiding or information hiding.
5. Define data abstraction? NOV/DEC 2014
Abstraction represents the act of representing the essential features without including the
background details or explanations. Classes use the concept of abstraction and are defined as a
list of abstract attributes such as size, weight and cost and functions to operate on these
attributes. The attributes are called data members and functions are called member functions or
methods.
The principle of data hiding helps the programmer to build secure programs that cannot be
invaded by code in other parts of the program.
It is easy to partition the work in a project based on the objects.
Object oriented systems can be easily upgraded from small to large systems
Software complexity can be easily managed.
Object oriented systems can be easily upgraded from small to large systems.
It is possible to map multiple instances of an object to co- exits without any interference.
Message passing techniques for communication between objects make the interface
description with external systems much simpler.
9. What are the valid types of data that the main( ) can return in C/C++ language?
(May/June 2007)
Auto, bool, break, case, catch, char, class, const, const_cast, continue, default, delete, do, double, dynamic cast, else,
enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace.
12. What is the use of the scope resolution operator : : in C++? (Nov/Dec2007)
A variable declared in an inner block cannot be accessed outside the block. To resolve this
problem the scope resolution operator is used. It can be used to uncover a hidden variable.
This operator allows access to the global version of the variable. It takes the form,
:: variable-name
13. What are different data types supported by C++? (April/May 2007)
Primitive Built-in Types:
Boolean bool
Character char
Integer int
only one copy of that member is created for the entire class and is shared by all
the objects
It is only visible within the class, but its life time is the entire class type and scope of each
static member variable must be defined outside the class
It is stored separately rather than objects
Eg: static int count//count is initialized to zero when an object is created.
int classname::count;//definition of static data member
Member function as static
A member function that is declared as static has the following properties
A static function can have access to only o
A static member function can be called usin classname ::function_name;
32. What is the ambiguity between default constructor and default argument constructor?
The default argument constructor can be called with either one argument or no arguments.
when called with no arguments ,it becomes a default constructor. When both these forms are
used in a class ,it cause ambiguity for a statement such as A a;
The ambiguity is whether to call A::A() or A::A(int i=0)
39. What are the difference between default and parameterized constructors? (May/June
2007)
Constructor without arguments is called default constructor.
Constructor with argument is called parameterized constructor.
class max
{
int a;
public:
void getdata()
{
cout<<"Enter the Value :";
cin>>a;
}
max &greater(max &x)
{
if(x.a>=a)
return x;
else return *this;
}
void display()
{
cout<<"Maximum No. is : "<<a<<endl;
}
};
main()
{
clrscr();
max one,two,three;
one.getdata();
two.getdata();
three=one.greater(two);
three.display(); getch();
45. Which is used for achieving Data Hiding in C++? List its types (APR/MAY 2015)
Access Specifier are used for achieving Data Hiding in
C++ There are three types of access specifier.They are
Private : Within the block.
Public: Whole over the class.
Protected: Act as a public and then act as a private
46. With which concept, visibility and life time of the variables differ in C++? List its
types (APR/MAY 2015)
The visibility and lifetime of the variables differs in C++ in Storage
classes. Auto
Extern
Static
Register
Mutuable
PART-B