0% found this document useful (0 votes)
3 views1 page

C Assignment

The document is an assignment for M.Tech II Semester students focusing on C++ programming concepts. It includes questions on inheritance, polymorphism, friend functions, file handling, and exception handling, as well as a programming task to simulate a Bank Account System with classes for SavingsAccount and CurrentAccount. The assignment aims to assess students' understanding of C++ features and their practical application.

Uploaded by

vexas71843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

C Assignment

The document is an assignment for M.Tech II Semester students focusing on C++ programming concepts. It includes questions on inheritance, polymorphism, friend functions, file handling, and exception handling, as well as a programming task to simulate a Bank Account System with classes for SavingsAccount and CurrentAccount. The assignment aims to assess students' understanding of C++ features and their practical application.

Uploaded by

vexas71843
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

International Institute of Professional Studies, DAVV

[Link] II Semester C++ Programming- Assignment


1. Differentiate following:
a) Private and public inheritance
b) Structure and classes in c++
c) Structure in c and structure in c++
d) Inline function and macro
e) Inline and normal function
f) Char * const p and char const *p
g) Const and # define
h) Class and object
i) Early binding and late binding
2. When we do need to use default arguments in a function?
3. What is a friend function? What are the advantages and disadvantages of using friend functions?
4. Can we have more than one constructor in our class? If yes, what is the need for such a situation?
5. When is a friend function compulsory in operator overloading? Explain with example.
6. What are the different forms of inheritance? Give an example for each.
7. What is virtual base class? When do we make a class virtual?
8. What is containership? How it differs from inheritance?
9. Class D is derived from class B. The class D does not contain any data members of its own. Does the
class D require constructors? If yes, why?
10. What are the implications of following two definitions in case of constructor and destructor calling:
a) class A: public B, public C
b) class A :public C, public B
11. What is polymorphism? Explain, how it is achieved at a)Compile time b)Run time
12. What does this pointer point to? What are the applications of this pointer?
13. When do we make virtual function and how? What are implications of making a virtual function“pure”?
14. Both cin and getline() function can be used for reading a string .What is the difference?
15. What is file mode? Explain different file mode available in C++.
16. What are the different ways to open a file in c++? Explain.
17. How many file objects you need to create and manage the following situations?
a)To process four files sequentially b) To merge two sorted files into a third file
18. Explain Exception handling mechanism.
19. What are templates? Explain use of it.
20. Write a C++ program to simulate a Bank Account System with the following requirements:
1. Class Account:
o Data Members: accountNumber (int), balance (float).
o Constructor to initialize accountNumber and balance.
o A function deposit(float amount) to deposit money into the account.
o A function withdraw(float amount) to withdraw money from the account.
o A pure virtual function display() to print account details.
o Overload the << operator to display account details
2. Class SavingsAccount (derived from Account):
o Additional Data Member: interestRate (float).
o Implement a member function calculateInterest() to calculate and add interest to the balance.
o Override display () function to display interestRate along with accountNumber and balance.
3. Class CurrentAccount (derived from Account):
o Additional Data Member: overdraftLimit (float).
o Override display () function to display overdraftLimit along with accountNumber and balance.
4. In the main() function:
o Create instances of SavingsAccount and CurrentAccount.
o Use the deposit and withdraw functions for both accounts.
o Use runtime polymorphism to call the display() function for both account types.

You might also like