*8241*
8241
(Pages : 2)
Reg. No. : ..................................... Name : ..........................................
Third Semester B.Tech. Degree Examination, November 2009 (2008 Scheme) Branch : Chemical Engineering 08.305 : COMPUTER PROGRAMMING IN C++ (H) Time : 3 Hours
Max. Marks : 100 PART – A
Answer all questions. Each question carries four marks. 1. Which are the benefits of Object Oriented Programming ? 2. What is meant by preprocessor directives ? 3. Explain the implementation difference between while.... and do....while loops. 4. What are the different logical operators in C++ ? Give its uses. 5. Identify the errors in the following program and correct it. # include < iostreams.h> main () { int i = 0; l = l + 1; Cout << l << “ ”; /* Comment \* // i = i + 1; Cout >> l; } 6. What is meant by function overloading ? 7. Explain the use of ‘new’ and ‘delete operators in C++. 8. What is a class ? How does it accomplish data hiding ? 9. With the help of an example, explain inheritance in C++ programs. 10. Justify the need for Virtual functions in C++ programs. P.T.O.
*8241*
8241 PART – B Answer one question from each Module. Each question carries 20 marks. MODULE – I
11. a) Write a C++ program to print the numbers between 1 and N which are divisible by 2, where N is a number accepted from the keyboard. 10 b) With the help of an example program show how the following operations can be performed. P = 0; q = 0; r = ++p +++q; 10 OR 12. Write a C++ program, using functions, to demonstrate the different mechanisms to pass arguments to functions. 20 MODULE – II 13. Create a complex number class with member function, by a C++ program, to overload the operators “+”, “<<”and “>>”. OR 14. Write a C++ program, using function overloading, to add two matrices.
20 20
MODULE – III 15. a) Explain how a base class member function can be invoked in a derived class if the derived class has a member function with same name. 10 b) What is meant by a pure virtual function ? Explain the syntax and implementation of virtual function with the help of an example. 10 OR 16. Write a C++ program, using virtual functions, to implement dynamic polymorphism. 20 —————