0% found this document useful (0 votes)
26 views3 pages

Inventory Management Viva Questions

The document outlines key concepts and questions related to an Inventory Management System using Object-Oriented Programming (OOP). It covers topics such as inheritance, abstraction, polymorphism, encapsulation, and memory management. Additionally, it discusses the use of vectors, static functions, and the handling of user input and file saving in the system.

Uploaded by

muh.arham786
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)
26 views3 pages

Inventory Management Viva Questions

The document outlines key concepts and questions related to an Inventory Management System using Object-Oriented Programming (OOP). It covers topics such as inheritance, abstraction, polymorphism, encapsulation, and memory management. Additionally, it discusses the use of vectors, static functions, and the handling of user input and file saving in the system.

Uploaded by

muh.arham786
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
You are on page 1/ 3

Inventory Management System - Viva Questions

1. What is OOP and which concepts are used here?

Object-Oriented Programming. Used concepts:

- Inheritance

- Polymorphism

- Abstraction

- Encapsulation

- Dynamic Memory Allocation

2. What is inheritance? What type is used?

Inheritance is when a class inherits features from a base class.

Type: Single inheritance.

3. What is abstraction?

Hiding unnecessary details and showing only essentials. The InventoryItem class is abstract using

pure virtual functions.

4. What is polymorphism? Where is it used?

Same interface behaving differently for different objects.

Used when InventoryItem* points to derived class and calls display().

5. What is encapsulation?

Wrapping data and functions in a class. Data is kept protected.

6. What is a pure virtual function?

A function declared like: virtual void display() const = 0;

It must be overridden by derived classes.

7. Why is the destructor virtual in the base class?

So the correct derived class destructor is called when deleting via base pointer.
8. Why do you use new?

To create objects at runtime (dynamic memory allocation). Needed for polymorphism.

9. Why did you use vector instead of array?

Vector is dynamic and flexible. Array has fixed size.

10. What happens if you don't use delete at the end?

Memory leak. Destructors won't be called. Heap memory remains occupied.

11. What is the use of static function in InventoryFileHandler?

It can be called without creating an object.

12. What does cin.ignore(); do?

Clears newline from the input buffer before getline().

13. What is the role of getDetails() function?

Returns a short string summary of item like: Clothing - Jeans x5.

14. Can we create an object of InventoryItem?

No, because it is an abstract class.

15. How is total inventory value calculated?

By looping over items and summing getTotalValue() of each.

16. What is the difference between compile-time and runtime polymorphism?

- Compile-time: function overloading

- Runtime: virtual functions (used here)

17. What is the difference between -> and . operators?

- . is used with objects

- -> is used with pointers

18. What is the use of cin.ignore() after cin?

To avoid input skipping when switching from cin to getline().


19. How does the program allow ending the session?

Through a do-while menu loop that exits on user choice 3.

20. How is file saving handled in this program?

It's simulated using cout. In a real case, ofstream can be used.

You might also like