Sie sind auf Seite 1von 7

OOP with C++

Questions

Note:-
Examples mean valid running coding
Numbers in the brackets in the right represent maximum marks for
that question.
The Answers should contain the following information
1. Point-wise definition.
2. Diagrams if possible.
3. Common Syntax.
4. Valid Running Code to prove the definition.

UNIT-1 (Basic Concepts)

1. Write down the rules for naming of the identifiers. (5)

2. What is the Difference between Procedure Oriented and Object Oriented


Programming?. (5)

3. Explain various concepts of Object Oriented Programming. (10)

4. Explain various benefits of OOP. (5)

5. Compare Basic Data types and Derived Data types. (5)

6. Compare between Initialization and Assignment. Give Examples. (5)

7. What is Type Casting?. Why is it used?. Give examples. (5)

8. What is a Scope Resolution Operator?. How can it be used to access global


data?. Give examples. (5)

9. What is a Scope?. How does a scope governs the behavior of a variable?.


Explain using examples. (5)

10. What is an Enumerated data type. Explain using an Example. (10)

11. Explain Pointers. Give an example. (10)

12. What are the various ways of creating constants (# define, enum & const).
Give respective examples. (15)

13. What is a Constant Pointer, Pointer to a Constant and Constant Pointer to a


Constant. Give Examples. (15)

14. What is a Reference Variable?. Give example. (5)

Developed by Partha Roy Page 1


15. Compare a Pointer and a Reference Variable. Give Example. (5)

16. Explain Dynamic Memory Allocation. Why is it needed?. Give examples. (10)

17. Explain the difference between Malloc function in C and New Operator in
C++. Give Examples. (10)

18. Give a Chart explaining Operator Precedence and its Associativity for any
five operators (with different precedence). (5)

19. Explain the difference between Sequential Statements, Selection Statements


and Loop Statements. Give examples. (15)

20. Explain the difference between Function Prototype, Function Definition and
Function Calling. Give Examples. (10)

21. Explain the difference between Call by Value, Call by Address and Call by
Reference. Give examples. (15)

22. Explain Inline Functions. Give Example. (5)

23. What are Default Arguments in functions?. How are they useful?. Give
examples. (5)

24. What are const arguments in functions?. Explain using examples. (5)

25. What is return by reference?. Explain using an example. (10)

UNIT-2 (Class & Objects)

26. Explain Scope Resolution Operator specific examples. (5)

27. What is the difference between Structure and Class?. Explain with example.
(5)

28. Explain various Access mode specifiers with examples. (10)

29. Explain the meaning of members of a class. How can we access these
members? . Give examples. (10)

30. What is the relation between Object and Class. Explain with examples. (5)

31. How can we implement Data hiding and data protection. Explain with
examples. (10)

32. How is Data Encapsulation, Hiding , Abstraction and Protection related to


each other. How can all these be done at a time ?, give example. (10)

Developed by Partha Roy Page 2


33. What is Abstract Data type?. How can we implement it ?. What is the use of
Abstract Data types. Give examples. (10).

34. How can we do Message Passing between User to Objects and between
Object to Object. Give examples and explain. (10)

35. Explain Static members. What is the use of Static members?. Explain with
examples. (10)

36. How can we create array of Objects during Runtime?. Explain using an
example. (10)

37. Explain Friend functions. How are friend functions useful to us?. Why are friend
functions dangerous?. Explain with examples. (10)

38. What are Const Member Functions?. How are they useful?. Explain with
example. (10)

39. Explain Local Classes with an example. (5)

40. Explain Friend Classes with an example. (10)

41. What are rules to be followed while creating Inline functions?. (5)

42. What are the rules to be followed while creating Static Data & Function
members. (5)

43. What are the rules to be followed while creating Friend Functions. (5)

44. Create a database to maintain Students information where every student


should have a Name and Roll number. The name data part should be
implemented using a nested class which should contain two parts of the
name, i.e first name and last name. In both the nested and outer class there
should be functions to fill and show the data.

45. Create a database to maintain information about the money present in a


single account. Any number of debit cards can be issued from the same
account. The minimum balance should not go below 100.

46. Create a Chatting system where there is one Server and many Clients. The
Clients can send and receive messages through the Server. The Clients are
identified by their unique ID. When the Server receives a message it holds the
message for the other client to receive it from the server. A client would read
only that message whose ID matches with its own.

Developed by Partha Roy Page 3


UNIT 3 (Constructor, Destructor and Overloading)

47. What are Constructors & Destructors?. When do we need them?. (10)

48. What is Function and Operator Overloading?. What is the advantage of


Overloading?. (10)

49. What are the rules to be followed while creating Overloaded Functions. (5)

50. Explain Function Overloading with examples. How is it useful?. (10)

51. What is a Constructor?. Explain with an examples. (10)

52. Explain the difference between Default Constructor provided by the compiler
and user defined Default Constructor. Explain with example. (10)

53. What is a Parameterized Constructor?. Explain with example. (10)

54. What is the difference between a Default Constructor and a Parameterized


Constructor. Explain with example. (10)

55. What is the difference between Implicit Constructor call and Explicit
Constructor call. Give example. (5)

56. What is a Copy Constructor?. What are the situations where a Copy
Constructor is called automatically?. Explain with example. (10)

57. Explain Constructor Overloading with example. (10)

58. Equating two objects of a class should not be done if the “ = “ operator is not
overloaded. Justify this statement and give a solution to this situation with
appropriate example. (10)

59. What is a Destructor?. Why its needed?. Explain using example. (10)

60. Explain Operator Overloading with example. (10)

61. What is the difference between Overloading Operators using Member


Functions and using Friend Functions?. Give example. (10)

62. Write down the basic Steps for Overloading Unary and Binary Operators. (5)

63. How can we use Overloading of cast operation to convert an object of a


class into a basic data type. Give example. (10)

64. Explain how an object of one class can be converted to object of another
class using overloaded “ = ” operator. Explain with example. (10).

65. Write a program to count the number of Objects created and destroyed.
Every object should have a unique ID which should only be set during object
creation. Use Constructor and Destructor only.

Developed by Partha Roy Page 4


UNIT 4 (Inheritance, Abstract Classes and Virtual Functions)

66. What is Inheritance?. Why do we need Inheritance?.

67. Explain Single level Inheritance with example. (10)

68. Explain Multi level Inheritance with example. (10)

69. Explain Multiple Inheritance with example. (10)

70. Explain Hierarchical Inheritance with example. (10)

71. Explain Hybrid Inheritance with example. (10)

72. What are Virtual Base Classes?. Where are they needed. Give example. (10)

73. Explain how Parameterized Constructors are called when Inheritance is done.
Give example. (10)

74. What happens when functions in the Derived Class have the same name as
the function names given in the Parent class?. How can we use them
separately from the Derived class ?. Explain with example. (10)

75. Explain Nested Classes with example. (10)

76. Explain “ this “ pointer with example of objects of class. (10)

77. Explain the use of Pointer to Objects with example. (10)

78. What is a Virtual Function?. Explain their use using example. (10)

79. Give 5 basic rules to be followed while creating Virtual Functions. (5)

80. What are Pure Virtual Functions?. What happens if all the functions in a class
are Pure Virtual Functions?. Explain with example. (10).

81. Differentiate between Overloading and Over-riding. Also explain how the
problem related to Over-riding is solved. Give proper example.

Developed by Partha Roy Page 5


82. Create a database of Customers in a Bank. Every customer has Account
number, Name, Address of branch and Balance amount. Two categories of
accounts can be opened, one is Current account where the minimum
balance should not go below 500 and Savings account where the minimum
balance should not go below 100. Use Hierarchical Inheritance to implement
the solution.

83. Explain with example Data over-riding and Function over-riding during
inheritance.

84. Prove with example how 1) Only protected & public members get inherited,
2) How to stop further inheritance of members to a certain level of
inheritance structure and 3) How to make all the inherited members as
protected.

85. Explain with example how the Ambiguity problem is encountered during
Multiple inheritance and how it can be solved.

86. Explain the problem faced when there are only parameterized constructors
present in every class in the inheritance structure. Give solution with proper
example to prove your solution.

87. Explain the problem faced when there are only parameterized constructors
present in every class in the Multilevel inheritance structure. Give solution with
proper example to prove your solution.

88. Explain the problem faced when there are only parameterized constructors
present in every class in the Hierarchical inheritance structure. Give solution
with proper example to prove your solution.

89. Explain the problem faced when there are only parameterized constructors
present in every class in the Multiple inheritance structure. Give solution with
proper example to prove your solution.

90. Explain the problem faced when there are only parameterized constructors
present in every class in the Hybrid inheritance structure. Give solution with
proper example to prove your solution.

91. Create a Shape class which should be Abstract. Derive two subclasses Circle
and Triangle from it. Using pointer of Shape class fill the required members
and display the Area. Every operation should be done in Runtime.

Developed by Partha Roy Page 6


UNIT 5 (Disk File I/O and Templates)

92. Explain the Utility of I/O streams. Also explain the header files and classes
used.

93. Explain the use of width(), precision(), and fill() functions with example. (10)

94. Write down the basic steps for performing Disk file operations in C++. (10)

95. Explain the use of following functions with respect to Disk File I/O operations
using example (10)
1. open()
2. close()
3. eof()
4. seekp()
5. seekg()

96. Explain the use of following functions with respect to Disk File I/O operations
using example (10)
1. tellp()
2. tellg()
3. put()
4. get()
5. fail().

97. Explain the use of read() and write() functions with respect to Disk File I/O
using example. (10)

98. What are Templates?. What are their advantages?. Explain with example.
(10)

99. Explain with examples the use of Class Templates and Function Templates.
(10)

100. Explain the use of try, throw and catch statements using an example. (10)

Best of Luck

Developed by Partha Roy Page 7

Das könnte Ihnen auch gefallen