Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

J.llaparInstitute of Engineering and Technology, halala Computer Science and Engineering Department B.E.

Third Year Second Mid Semester Exam Course Code: CS003 Time Allowed: 1 Hr Instructor: Shivani Goel Q.1.(a) Q.l.(b) Q.1(c) Course Name: Object Oriented Programming Max. Marks: 12 Dated: 22/10/2005 (2) (2)

What is static and dynamic binding? Give suitable examples. What is this pointer? Give its significance and explain with a suitable example.

Is it possible to declare an object of the class that contains virtual function? (2) Explain why or why not? Suppose a program wants to examine every byte of a file, which mode will be (2) more appropriate and why?

Q.2.(a)

Q.2.(b) Given a text file containing some text. Write a program in C++ that prompts the user to input name of a text file, reads this file and replaces each occurrence of character 'x' with 'X'. (4)

THAPAR.INSTITUTE OF ENGINEERING AND TECHNOLOGY, PATIALA Computer Science and Engineering Department B.E. 3rd Year End Semester Test Course Code: CS003 Course Name: Object Oriented programming Time Allowed: 3 Hrs Max. Marks: 45 Instructor: Shivani Goel Dated: 16/12/2005 Note: Attempt any five questions. All sub-parts of a question must be attempted at one place. Only first five answers w.iIIbe evaluated. Q.l(a) Write the limitations for overloading the operators in C++? Does Java support operator overloading? Consider the class Complex which contains two data members of type double to store real part and the imaginary part of the complex numbers. (complex number: realpart + the imaginarypart * i where i has the value..f-l). Include one constructorforinitializing data members to zero and another for initializing them to some other values. Overload the operators and for Complex class. Write a main function which inputs the value of a Complex obiect usinll operator and disolavs it usinll operator. Explain the advantages of using object oriented concepts/methodology for developing software. Explain the terms data hiding and encapsulation. Does the use of friend functions violate the rules of data hiding? Justify.

2+1

Q.l(b)

(6)

Q.2(a)

(3)

Q.2(b)

2+4

Q.3(a) What are the benefits of inheritance?Explainany three types of inheritanceusedinC++.


Q.3(b) Explain the effect of inheriting a base class in a protected mode with an example.

1+3

Q.4(a) Explainthe uses of void and this pointers.


Q.4(b) Dynamic binding is achieved using virtual functions. Explain how using a suitable example.

Q.5(a)

What is type casting? Explain various ways in which it can be done in C++. Explain the differences in the mainO function used in C++ and Java.

(3) (3)

,-.

Q.5(b)
....

Q.5 c)

How an exception is different from an error in C++? How an exception can be handled in C++? Give example.

(3)

Q.6(a)

What is a parameterized function and a parameterized class? How are these defmed? Give example. Explain the functions used for successfully initializing the graphics mode in c++. How is the successful installation of graphics checked in C++? Give details.

(4)

Q.6(b)

(5)

Q.7(a) Explainwith examplethe functionsof seekgO,tellgOand eofOfunctionsusedin files.


Q.7(b) Write a program to capitalize first letter of each word in the text file passed as command line arllUment.

(3)
(6)

You might also like