1. Write a program to show the utility of
Scope Resolution Operator using suitable example
a) wrt global &local variable
b) wrt member functions of a class
Q2.Write a program to demonstrate the usage of
Inline functions using suitable example. [Write a program to multiply every
element of array with 4.]
Q3.Write a program to demonstrate the usage of
default arguments using suitable example
Q4. WAP which uses a FRIEND function,
that is friend to many classes(Topper out of girls and boys)
Q5. WAP to demonstrate a FRIEND
function, that is member of one class & friend to another.
Q6. Create two classes DM and DB, which
store the value of distances. DM stores distances in meters and centimeters and
DB in feet and inches. Write a program that can read values for the class
object and add one object of DM with another object of DB. Use a friend
function to carry out the addition operation. The object that stores the
results may be a DM object or DB object, depending on the units in which
results are required. The display should be in the format of feet and inches or
meters and centimeters depending on the object on display.
Q
7. Demonstate swap function in all the following ways
Class
NUMBER
{
};
Void
main()
{
Int
a,b;
NUMBER
N,M;
Swap(a,b)
Swap(N.i,M.i);
Swap(N,M)
N.swap(M);
N.swap();
}
Qus
8.Write a program that has two classes RUPEES & DOLLARS. Both should have
relevant members. There should be a friend function that should display the
total monetary value of two objects of the above classes.
Q9.
Demonstrate the friend class using a suitable example.
Q10. Demonstrate the concept of Static Data
Member using a suitable example.
[Define
a stack uses one linear array and counter to notice number of item in stack.
Define a member function corresponding to PUSH and POP operations including
overflow and underflow situation relevantly. Create an object of stack class
and perform these operations for that.]
Q11.
Design a class ARRAY, having the functions getdata(), dispdata(),
sort(),search(int n), get_frequency(int n), reverse().
Q
12. WAP that has three classes Circle, Rectangle &square with appropriate
data members & member functions.write the main() in such a way that user
has to enter only one value ie perimeter of Square or rectangle, or
circumference. The program should have a friend function max_cvrg_area() to specify
which figure has maximum coverage arean.
main()
{
Cout<<Enter
the length;
Cin>>l;
Circle
C;
Rect
R;
SQR
S;
C.getdata(l);
R.getdata(l);
S.getdata(l);
Cout<<max_cvrg_area(C,R,S);
}
NOTE:Write Question in Black ink... Solution in blue ink & Output shuld be Printed.
No comments:
Post a Comment