Thursday, November 19, 2015

Phase III qus for BCA III

Sub Name: Object Oriented Programming Using UML & C++
Sub Code: TBC 302
PHASE III

FUNCTION OVERLOADING:
Q 1. Write a program that use function overloading to do the following task-
n  Demonstrate the exact match
n  Demonstrate the integral promotion
n  Demonstrate the ambiguity error
n  Demonstrate the concept of default arguments along with function overloading
Q2. Write a program that use function overloading to do the following task-
n  Find the max. of two numbers
n  Find the max of three numbers
Q3. Write a program that use function overloading to do the following task-
n  Compute xy , where x and y both are of int type. 
n  Compute xy,  where x is float type and y is int type.
Q4. Write a C++ program to create a class called COMPLEX and implement the following overloading functions ADD that return a complex number:
a. ADD(a, s2) – where ‘a’ is an integer (to be added to real part only) and s2 is a complex number
b. ADD(s1, s2) – where s1 and s2 are complex numbers
c. ADD(s1, a) – where ‘a’ is an integer (to be added to real part as well as imaginary part) and s1 is a complex number
Q5. Demonstrate the concept of function overloading among the classes by designing three classes Square, Rectangle, & Circle. All the three classes must have functions getdata(), calc_area(), disp();
Operator Overloading
Q6. Write a complete definition for an overloaded + , - , * operator for the INTEGER class. It should add 2 INTEGER objects. It can solve the following expressions:
A=B*C
A=B*8;
A=B+C-D
A=B-C*D/E
Q7 A class Clock has following members:
Data members:
            Hour of type integer
            Minute of type integer
Second  of type integer
Member function:
            Readtime (int h, int m, int s);
            Showtime ();
            addTime(Clock);
addTime(Clock,Clock);
Write a complete program in C++ to input two different objects FT, ST. Print their sum (assuming 24 hour clock time) by overloading the + operator for class Clock
Q8. Write a complete definition for an overloaded + , - , * operator for the COMPLEX class. It should add 2 COMPLEX objects. It can solve the following expressions:
A=B*C
A=B+C
A=B*8;
A=A*B+C-5*D+8
A=8*B;
If some operation is not possible, mention the reason.
Q9. WAP to add one INTEGER with one FLOAT object, using overloading binary + operator using friend function for FLOAT class and member function for INTEGER class.
Q10. WAP to overload += operator overloading.
Q11. WAP to overload ++ operator overloading.(prefix & postfix)
Q12. WAP to overload -- operator overloading. (prefix & postfix)
Q13. WAP to overload == operator overloading.
Q14. WAP to overload << operator overloading.

Q15. WAP to overload >> operator overloading.

No comments:

Post a Comment