B.Tech Information Technology Assignment 1 - C++ - Question Paper | Lovely Professional University

ASSIGNMENT – 1 Classes And Objects

Question 1. Distinguish ranging from the following:
a) Classes and Objects
b) Abstraction and Encapsulations

Question 2. Discuss
a) Message Passing
b) Dynamic Binding
c) Overloading
d) Object based languages
e) Object oriented languages

Question 3. What is meant by interface of a class and implementation of a class?

Question 4. Differentiate ranging from classes and structures with improper examples?

Question 5. 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();
}
Question 6. 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

Question 7. Write the output of subsequent programs:
a)# 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=”< }
b)# 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();
}
Question 8. Provide the classification of different access specifiers. How are they various from every other?

Question 9. 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?

Question 10. Write down difference ranging from call by value,call by reference and call by address

Question 11.  Write down difference ranging from default arguments and general arguments with
Suitable example