Anda di halaman 1dari 4

OR

4. Define a class for rational numbers and overload the operators


+ and * to add and multiply rational numbers

12

UNIT-III
5. a) Explain container class in C++
b) What are abstract classes? Give examples
c) Write rules for operator overloading

4
4
4

OR

6. a) What is meant by inheritance? How is it useful in C++?


b) Class B is inherited from class A. A uses a dynamic pointer. B
inherits that dynamic pointer and uses another dynamic pointer.
Write constructor and destructor for both A and B

UNIT-IV
7. a) What is the purpose of new operator in C++? What does delete
operator do in C++?
b) What are virtual destructors? How are they used in C++?

6
6

OR

8. a) What is virtual function? When is it needed?


b) Distinguish between abstract classes and pure virtual functions

6
6

UNIT-V
9. a) Describe the limitations of exception handling in C++
b) Define a function template that returns the sum of an array of
elements. The function must use two arguments-the type of
array (generic) and the size of array (int)

OR

10. a) Explain the use of class templates with multiple parameters


b) How is a function template overridden for a specific data type?

6
6

[123456789/II S/111]

[A-11]

[EURCS 206]

B.Tech. DEGREE EXAMINATION


II SEMESTER
OBJECT ORIENTED PROGRAMMING WITH C++
(Effective from the admitted batch 200809)
(Common for all branches)
Time: 3 Hours
Max.Marks: 60
---------------------------------------------------------------------------------------------------Instructions: Each Unit carries 12 marks.
Answer all units choosing one question from each unit.
All parts of the unit must be answered in one place only.
Figures in the right hand margin indicate marks allotted.
--------------------------------------------------------------------------------------- -------------

UNIT-I
1. Write a program to read a positive integer less than 99999 and
prints the individual digits of the number on a line with three spaces
in between them. The first line is to start with left most digit (it can
be zero if the given number has less than 5 digits) and prints all the
five digits. Second line starts with second digit from left and prints
four digits and so on. For example, if the given number is 1234, the
out put lines should be respectively.
0 1 2 3 4; 1 2 3 4; 2 3 4; 3 4 and 4
12
OR

2. a) Distinguish between procedure oriented programming and


object oriented programming
b) List at least four different constructs in C++ to define user
defined data types. Identify the mathematical principles behind
these constructs
c) Define scope of variables in C++. What is the need for scope
resolution operator in C++?
UNIT-II

4
4

3. a) What is an inline function? What is its purpose? Why should in


line functions be used in C++ programs?
4
b) What are access specifiers? What is their purpose?
4
c) What is a friend function? Give example
4

OR

4. Define a class for rational numbers and overload the operators


+ and * to add and multiply rational numbers

12

UNIT-III
5. a) Explain container class in C++
b) What are abstract classes? Give examples
c) Write rules for operator overloading

4
4
4

OR

6. a) What is meant by inheritance? How is it useful in C++?


b) Class B is inherited from class A. A uses a dynamic pointer. B
inherits that dynamic pointer and uses another dynamic pointer.
Write constructor and destructor for both A and B

UNIT-IV
7. a) What is the purpose of new operator in C++? What does delete
operator do in C++?
b) What are virtual destructors? How are they used in C++?

6
6

OR

8. a) What is virtual function? When is it needed?


b) Distinguish between abstract classes and pure virtual functions

6
6

UNIT-V
9. a) Describe the limitations of exception handling in C++
b) Define a function template that returns the sum of an array of
elements. The function must use two arguments-the type of
array (generic) and the size of array (int)

OR

10. a) Explain the use of class templates with multiple parameters


b) How is a function template overridden for a specific data type?

6
6

[123456789/II S/111]

[A-11]

[EURCS 206]

B.Tech. DEGREE EXAMINATION


II SEMESTER
OBJECT ORIENTED PROGRAMMING WITH C++
(Effective from the admitted batch 200809)
(Common for all branches)
Time: 3 Hours
Max.Marks: 60
--------------------------------------------------------------------------------- ------------------Instructions: Each Unit carries 12 marks.
Answer all units choosing one question from each unit.
All parts of the unit must be answered in one place only.
Figures in the right hand margin indicate marks allotted.
--------------------------------------------------------------------------------------- -------------

UNIT-I
1. Write a program to read a positive integer less than 99999 and
prints the individual digits of the number on a line with three spaces
in between them. The first line is to start with left most digit (it can
be zero if the given number has less than 5 digits) and prints all the
five digits. Second line starts with second digit from left and prints
four digits and so on. For example, if the given number is 1234, the
out put lines should be respectively.
0 1 2 3 4; 1 2 3 4; 2 3 4; 3 4 and 4
12
OR

2. a) Distinguish between procedure oriented programming and


object oriented programming
b) List at least four different constructs in C++ to define user
defined data types. Identify the mathematical principles behind
these constructs
c) Define scope of variables in C++. What is the need for scope
resolution operator in C++?
UNIT-II

4
4

3. a) What is an inline function? What is its purpose? Why should in


line functions be used in C++ programs?
4
b) What are access specifiers? What is their purpose?
4
c) What is a friend function? Give example
4

Anda mungkin juga menyukai