How To Exam?

a knowledge trading engine...


Gujarat University 2009-2nd Year B.C.A Computer Application Object Oriented Programming With Cpp - Question Paper

Sunday, 12 May 2013 09:15Web



2

2007-B

Time: 3 Hours]    C'f'T    (Max. Marks: 70

1. Do as directed.

(A) Fill in the blanks. (Any Four) 04

(1) A private function of the class can be accessed using _ and

(2)    The constructor should be declared in the_section.

(3)    The overloaded operator must have at least_operand/s that is of

user-defined type.

(4)    _is used for basic to class type conversion.

(5)    The_flag should be passed to the open function lo ensure that a

file does not get created if it docs not exist.

(B)    State, whether the following statements are true or false (Any Five):    05

(1) C++ is a procedure oriented programming language. t \\

*(2) The Virtual function is used to achieve runtime polymorphism.

(3)    The return type of the constructor is void.

(4)    An actual function definition is created from a function template during run time.

(5)    The const_cast operator is used to convert a pointer of base class type to a pointer of derived class type.

(6)    The destructor cant be declared as a virtual.

(C)    Define following terms (Any Five):    05

(1)    Dynamic Constructor

(2)    C++ Stream

r


(3)    STL

(4)    Destructor

(5)    Encapsulation

(6)    RTTI

2. (A) Write short notes on following (Any Two):    10

) ( Run Time Polymorphism

(2) Exception Handling

Sequential Input-Output in the Text File

2007-B    1    lYf.O.


04

Is it nccessary to have constructor in the derived class ? What is the best possible solution to avoid this situation ? Explain both scenarios.

(A) Do as directed. (Any Two)

10


(1)    Create a class called scheme with schcmeJd, scHcmc_name, outgoing_rate and mcssage_charge. Derive customer class form scheme and include cust_id, name and mobile_no data. Define ncccssary functions lo read and display data. Create a menu driven program to road call and message information for a customer and display the detail bill.

(2)    Create a class called cricket_player with data such as no, name, type, match played, highest scorc and highest wicket. Type may be Bowler, Batsman or All-rounder. Create a new class called cricket_team using cricket_player objects to form a team of 11 players. Include data to spccify the caption and wicketkccpcr. Define getdata and displaydata functions: Use this class in

1 main.

(3)    Create Calendar class with day, month and year as data members. Include default and parameterized constructors to initialize a Calendar object with a valid date value. Define a function AddDays to add days to the Calendar object. Define a display function to show data in dd/mm/yyyy" format.

(B) Create two classes called Celsius and Fahrenheit to store temperature in terms of Celsius and Fahrenheit respectively. Include necessary functions to read and display the values. Define conversion mechanism to convert Celsius object to Fahrenheit object and vise versa. Show both types of conversions in main function.    04

OR

Create two classes called UScurrcncy and IndianCurrcncy to store Dollars and Rupees respectively. Define functions to read and show data in both classes. Overload + operator to add an UScumency object and an IndianCurrency objcct and return the sum in terms of Paisa.

Answer the following questions (Any Seven):


(1)    Explain insertion and extraction operators.

(2)    What is function prototype ? \J

(3)    ' Explain this pointer.

14


(4)    When do we need to use the static data member in the class ?

(5)    Explain sct_new_handler function. \y

(6)    Whai is data hiding ? I low can it be achieved ?

(7)    Explain virtual base class. \y'

(8)    Explain any two functions available for fild error handling.

(9)    List benefits of inheritance.

5. Do as directed.

(A) Write output for following C++ code. If any error is there, correct it. (Any Three) 06

(1)    int total - 50;

int & sum = total; total = sum + sum ; cout sum ; %

(2)    inline logn area (int k)

(

return (k * k);

I

void main ()

{

cout arca(A); getch ();

}

(3)    int const n = 5; int no (4] = {n};

for (n=2; n<5 ; n++) cout no[n-2];

r


(4)    class num

( public:

int k=5;    '

li

void mainO { numnl; cout nl.k; gctchO; I

2007-B    3    P.T.O.

. X


(B)    Will ihcrc be any error, if a float value is assigned to an int variable ? Can wc assign a class object to a built-in type variable ? If not, what is the solution ? 05

OR

Why can wc declarc a friend function either in the private or the public section of the class with affecting its meaning ? Discuss the situation when wc need forward declaration of the class in the program that is using concept of friend function.

(C)    What are the similarities and differences between function overloading and default argument conccpt ?    03

OR

Explain setw, setprecision and setiosflags functions for formatted output. Write the name of the header file that contains these functions.

I


2007-B    4







Attachment:

( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER Gujarat University 2009-2nd Year B.C.A Computer Application Object Oriented Programming With Cpp - Question Paper