0% found this document useful (0 votes)
222 views

Nr220504-Object Oriented Programming

Write a program to overload +, -, operators for complex numbers. Implement passing of objects to function with an example. Show how to define and declare a class which consists of both virtual members and virtual destructors under multiple inheritance. Explain the various access specifiers with merits and demerits.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
222 views

Nr220504-Object Oriented Programming

Write a program to overload +, -, operators for complex numbers. Implement passing of objects to function with an example. Show how to define and declare a class which consists of both virtual members and virtual destructors under multiple inheritance. Explain the various access specifiers with merits and demerits.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Code No: 14027 NR Set No.

2
II B.Tech II Semester Supplimentary Examinations,February 2010
OBJECT ORIENTED PROGRAMMING
Common to Information Technology, Electronics And Computer
Engineering, Computer Science And Engineering, Computer Science And
Systems Engineering
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. (a) Write a C++ program to overload +, -, * operators for complex numbers.


(b) How do friend operator functions differ from member operation functions?
(c) Implement passing of objects to function with an example. [6+4+6]

2. (a) Write a program for checking the type of a class with dynamic cast.
(b) Write a program for changing pointer types with dynamic-cast. [8+8]

3. (a) Write a program to show how to define and declare a class which consists of
both virtual members and virtual destructors under multiple inheritance.
(b) Consider a bank maintains two kinds of accounts for customers savings ac-
count and current account. The savings account provides compound interest
and withdrawal facilities but no cheque facility. The current account pro-
vides cheque book facility but no interest. Create a class account that stores
customer name, account number and type of account. From this derive the
classes cur acct and sav acct to make them more specific to their require-
ments. Include necessary member functions in order to achieve the following
tasks:
i. Accept deposit from a customer and update the balance.
ii. Display the balance.
iii. Compute and deposit interest.
iv. Permit withdrawal and update the balance.
Use member functions to initialize the class members. [8+8]

4. (a) Write a short notes on different types constructors and destructors.


(b) Differentiate between default constructor and other constructors with exam-
ple.
(c) Explain the various access specifiers with an example. [5+6+5]

5. Discuss the software design trends with merits and demerits. [16]

6. (a) Write a function count letter that takes a single character. This function
will count the number of consonants and vowels. If a nonletter is given to the
function, it generates an exception
(b) How does the throw differ from return? [10+6]

1
Code No: 14027 NR Set No. 2
7. (a) What is recursion? Give recursive definitions for GCD of two numbers and
for factorial of a number.
(b) Compare recursion with iteration.
(c) Write a C program that reads a character array and gives frequency count of
each character. [6+3+7]

8. (a) Answer the following:


i. Write the declarator for the overloaded >> operator that takes output
from an object of class istream and displays it as the contents of an
object of class Sample.
ii. Used with cin, what does the skipws flag accomplish
iii. Write a statement that moves the current position 13 bytes backward in
a stream object called f 1.
Write a statement that will create an object called salef ile of the of stream
class and associate it with a file called SALES.JUN.
(b) Write a program that allows the input of names and ages from the keyboard
and stores them, in characters, in the file PEOPLE.DAT. After the input is
finished, the program should printout what is in the file as well as the average
age? [9+7]

?????

2
Code No: 14027 NR Set No. 4
II B.Tech II Semester Supplimentary Examinations,February 2010
OBJECT ORIENTED PROGRAMMING
Common to Information Technology, Electronics And Computer
Engineering, Computer Science And Engineering, Computer Science And
Systems Engineering
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. (a) Write a program for checking the type of a class with dynamic cast.
(b) Write a program for changing pointer types with dynamic-cast. [8+8]

2. (a) Answer the following:


i. Write the declarator for the overloaded >> operator that takes output
from an object of class istream and displays it as the contents of an
object of class Sample.
ii. Used with cin, what does the skipws flag accomplish
iii. Write a statement that moves the current position 13 bytes backward in
a stream object called f 1.
Write a statement that will create an object called salef ile of the of stream
class and associate it with a file called SALES.JUN.
(b) Write a program that allows the input of names and ages from the keyboard
and stores them, in characters, in the file PEOPLE.DAT. After the input is
finished, the program should printout what is in the file as well as the average
age? [9+7]

3. (a) Write a program to show how to define and declare a class which consists of
both virtual members and virtual destructors under multiple inheritance.
(b) Consider a bank maintains two kinds of accounts for customers savings ac-
count and current account. The savings account provides compound interest
and withdrawal facilities but no cheque facility. The current account pro-
vides cheque book facility but no interest. Create a class account that stores
customer name, account number and type of account. From this derive the
classes cur acct and sav acct to make them more specific to their require-
ments. Include necessary member functions in order to achieve the following
tasks:
i. Accept deposit from a customer and update the balance.
ii. Display the balance.
iii. Compute and deposit interest.
iv. Permit withdrawal and update the balance.
Use member functions to initialize the class members. [8+8]

4. (a) Write a C++ program to overload +, -, * operators for complex numbers.

3
Code No: 14027 NR Set No. 4
(b) How do friend operator functions differ from member operation functions?
(c) Implement passing of objects to function with an example. [6+4+6]

5. Discuss the software design trends with merits and demerits. [16]

6. (a) Write a short notes on different types constructors and destructors.


(b) Differentiate between default constructor and other constructors with exam-
ple.
(c) Explain the various access specifiers with an example. [5+6+5]

7. (a) What is recursion? Give recursive definitions for GCD of two numbers and
for factorial of a number.
(b) Compare recursion with iteration.
(c) Write a C program that reads a character array and gives frequency count of
each character. [6+3+7]

8. (a) Write a function count letter that takes a single character. This function
will count the number of consonants and vowels. If a nonletter is given to the
function, it generates an exception
(b) How does the throw differ from return? [10+6]

?????

4
Code No: 14027 NR Set No. 1
II B.Tech II Semester Supplimentary Examinations,February 2010
OBJECT ORIENTED PROGRAMMING
Common to Information Technology, Electronics And Computer
Engineering, Computer Science And Engineering, Computer Science And
Systems Engineering
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. (a) Answer the following:


i. Write the declarator for the overloaded >> operator that takes output
from an object of class istream and displays it as the contents of an
object of class Sample.
ii. Used with cin, what does the skipws flag accomplish
iii. Write a statement that moves the current position 13 bytes backward in
a stream object called f 1.
Write a statement that will create an object called salef ile of the of stream
class and associate it with a file called SALES.JUN.
(b) Write a program that allows the input of names and ages from the keyboard
and stores them, in characters, in the file PEOPLE.DAT. After the input is
finished, the program should printout what is in the file as well as the average
age? [9+7]
2. (a) Write a program for checking the type of a class with dynamic cast.
(b) Write a program for changing pointer types with dynamic-cast. [8+8]
3. (a) Write a program to show how to define and declare a class which consists of
both virtual members and virtual destructors under multiple inheritance.
(b) Consider a bank maintains two kinds of accounts for customers savings ac-
count and current account. The savings account provides compound interest
and withdrawal facilities but no cheque facility. The current account pro-
vides cheque book facility but no interest. Create a class account that stores
customer name, account number and type of account. From this derive the
classes cur acct and sav acct to make them more specific to their require-
ments. Include necessary member functions in order to achieve the following
tasks:
i. Accept deposit from a customer and update the balance.
ii. Display the balance.
iii. Compute and deposit interest.
iv. Permit withdrawal and update the balance.
Use member functions to initialize the class members. [8+8]
4. (a) What is recursion? Give recursive definitions for GCD of two numbers and
for factorial of a number.

5
Code No: 14027 NR Set No. 1
(b) Compare recursion with iteration.
(c) Write a C program that reads a character array and gives frequency count of
each character. [6+3+7]

5. (a) Write a short notes on different types constructors and destructors.


(b) Differentiate between default constructor and other constructors with exam-
ple.
(c) Explain the various access specifiers with an example. [5+6+5]

6. Discuss the software design trends with merits and demerits. [16]

7. (a) Write a C++ program to overload +, -, * operators for complex numbers.


(b) How do friend operator functions differ from member operation functions?
(c) Implement passing of objects to function with an example. [6+4+6]

8. (a) Write a function count letter that takes a single character. This function
will count the number of consonants and vowels. If a nonletter is given to the
function, it generates an exception
(b) How does the throw differ from return? [10+6]

?????

6
Code No: 14027 NR Set No. 3
II B.Tech II Semester Supplimentary Examinations,February 2010
OBJECT ORIENTED PROGRAMMING
Common to Information Technology, Electronics And Computer
Engineering, Computer Science And Engineering, Computer Science And
Systems Engineering
Time: 3 hours Max Marks: 80
Answer any FIVE Questions
All Questions carry equal marks
?????

1. Discuss the software design trends with merits and demerits. [16]

2. (a) Answer the following:


i. Write the declarator for the overloaded >> operator that takes output
from an object of class istream and displays it as the contents of an
object of class Sample.
ii. Used with cin, what does the skipws flag accomplish
iii. Write a statement that moves the current position 13 bytes backward in
a stream object called f 1.
Write a statement that will create an object called salef ile of the of stream
class and associate it with a file called SALES.JUN.
(b) Write a program that allows the input of names and ages from the keyboard
and stores them, in characters, in the file PEOPLE.DAT. After the input is
finished, the program should printout what is in the file as well as the average
age? [9+7]

3. (a) What is recursion? Give recursive definitions for GCD of two numbers and
for factorial of a number.
(b) Compare recursion with iteration.
(c) Write a C program that reads a character array and gives frequency count of
each character. [6+3+7]

4. (a) Write a function count letter that takes a single character. This function
will count the number of consonants and vowels. If a nonletter is given to the
function, it generates an exception
(b) How does the throw differ from return? [10+6]

5. (a) Write a short notes on different types constructors and destructors.


(b) Differentiate between default constructor and other constructors with exam-
ple.
(c) Explain the various access specifiers with an example. [5+6+5]

6. (a) Write a program for checking the type of a class with dynamic cast.
(b) Write a program for changing pointer types with dynamic-cast. [8+8]

7
Code No: 14027 NR Set No. 3
7. (a) Write a program to show how to define and declare a class which consists of
both virtual members and virtual destructors under multiple inheritance.
(b) Consider a bank maintains two kinds of accounts for customers savings ac-
count and current account. The savings account provides compound interest
and withdrawal facilities but no cheque facility. The current account pro-
vides cheque book facility but no interest. Create a class account that stores
customer name, account number and type of account. From this derive the
classes cur acct and sav acct to make them more specific to their require-
ments. Include necessary member functions in order to achieve the following
tasks:
i. Accept deposit from a customer and update the balance.
ii. Display the balance.
iii. Compute and deposit interest.
iv. Permit withdrawal and update the balance.
Use member functions to initialize the class members. [8+8]

8. (a) Write a C++ program to overload +, -, * operators for complex numbers.


(b) How do friend operator functions differ from member operation functions?
(c) Implement passing of objects to function with an example. [6+4+6]

?????

You might also like