Lovely Professional University 2008 B.Tech Information Technology Assignment 1- C++ - Question Paper
Friday, 25 January 2013 04:05Web
ASSIGNMENT – 1
Classes And Objects
Q1. Distinguish ranging from the following:
a) Classes and Objects
b) Abstraction and Encapsulations
Q2). discuss
a) Message Passing
b) Dynamic Binding
c) Overloading
d) Object based languages
e) Object oriented languages
Q3.What is meant by interface of a class and implementation of a class?
Q4. Differentiate ranging from classes and structures with improper examples?
Q5. obtain Error:
a)#include
#include
class a
{
private:
int x=20;
public:
void set(int a)
{
x=a;
}
int get()
{
return x;
}
void show()
{
cout<<”\nx= “ << get()<
b)#include
#include
class a
{
private:
int x;
public:
void set(int a)
{
x=a;
}
int get()
{
return x;
}
void show()
{
cout<<”\nx= “ << get()<
};
c) #include
#include
class a
{
private:
int x;
public:
void show()
{
cout<<”\nx= “ <
};
void main()
{
a obj;
obj.x=10;
obj.show();
}
Q6. Create a class to represent a bank account.It should include the following:
Data Members:
Name of account holder
Account number
kind of account
Balance account
Member Functions:
To initialize the data members with improper data
To deposit an account
To withdraw an amount afer checking the balance
To display details of account holder
Q7. Write the output of subsequent programs:
i)# include
#include
# include
void main()
{
char a;
clrscr();
a=getch();
cout<<”value of a=”<a=getche();
cout<<”value of a=”<a=getchar();
cout<<”value of a=”< }
ii)# include
# include
int a=7;
void main()
{
int i,a=10;
clrscr();
{
int a=20;
cout<<”In inner block value of a=”< cout<<” In inner block value of ::a=”<<::a;
}
cout<<”In outerr block value of a=”< cout<<” In outer block value of ::a=”<<::a;
for( i=0;i<=5;i++)
cout<<”value of i++=”<
for( i=0;i<=5;++i)
cout<<”value of ++i=”<getch();
}
Q8. provide the classification of different access specifiers. How are they various from every other?
Q9:There are various advantages of inline function, discuss them with suitable example
And if member functions are described within class declaration then those functions
are inline or not?
Q10:Write down difference ranging from call by value,call by reference and call by address
Q11: Write down difference ranging from default arguments and general arguments with
Suitable example
Earning: Approval pending. |