CS-305 · Object Oriented Programming & Methodology/Unsolved PYQ Paper
CS-305 Object Oriented Programming and Methodology - Dec 2024 Question Paper
Under each question, How to answer lists the points an answer should cover, outlined by CampusPrep from the syllabus. Check the details against your textbook.
-
7 MarksaCompare Object-Oriented Programming (OOP), with Procedural Programming, highlighting at least three differences. Discuss the features of the Object-Oriented Paradigm, mentioning its merits and demerits.
How to answer
- Tabular comparison between OOP and Procedural Programming with 3+ points (data hiding, approach, functions vs objects)
- Key features of OOP: Encapsulation, Abstraction, Inheritance, Polymorphism
- Merits (code reusability, maintenance, security) and Demerits (steep learning curve, performance overhead, larger program size)
-
7 MarksbGiven a class rectangle with attributes length and width, write methods to calculate the area and perimeter of the rectangle. Also, demonstrate the use of these methods in a sample program.
How to answer
- Class definition showing data members `length` and `width`
- Constructor and member functions `calculateArea()` and `calculatePerimeter()`
- Main driver program creating an instance, setting dimensions, and displaying computed results
-
7 MarksaExplain the concept of encapsulation and data abstraction in Object-Oriented Programming. How do these concepts enhance software development?
How to answer
- Define Encapsulation (binding data and functions, data hiding)
- Define Abstraction (showing only essential features, hiding background details)
- Distinguish how abstraction is the design goal and encapsulation is the implementation mechanism
- Explain benefits to software development: modularity, maintainability, reduced complexity, security
-
7 MarksbExplain the role of access modifiers in class design. Compare public, private and protected access levels with examples.
How to answer
- Role of access specifiers in data encapsulation and access control
- Tabular comparison of accessibility (within class, derived class, outside world)
- Short illustrative code example showing the three specifiers in a base and derived class
-
7 MarksaExplain the purpose of inheritance in Object-Oriented Programming. Discuss the different types of inheritance with suitable examples.
How to answer
- Purpose of inheritance: code reusability, establishing 'is-a' relationships, extensibility
- Classification of types: Single, Multiple, Multilevel, Hierarchical, and Hybrid inheritance
- Brief code snippet or diagram for each type
-
7 MarksbDifferentiate between association, aggregation and composition in the context of OOP. Provide real-world examples for each type of relationship.
How to answer
- Define Association (general 'has-a' or 'uses-a' relationship, e.g., Teacher and Student)
- Define Aggregation (weak 'has-a', independent lifecycles, e.g., Department and Teacher)
- Define Composition (strong 'part-of', dependent lifecycle/ownership, e.g., House and Rooms)
- Comparative summary table including UML notation
-
7 MarksaWhat is polymorphism in Object-Oriented Programming? Discuss its significance and how it contributes to code reusability and flexibility.
How to answer
- Definition of Polymorphism ('many forms')
- Significance: uniform interface to entities of different types
- Contribution to code reusability (writing generic code that works with base types)
- Contribution to flexibility/extensibility (adding new derived classes without changing existing code)
-
7 MarksbCompare and contrast static polymorphism with runtime polymorphism. Provide illustrative examples for both types.
How to answer
- Definitions and mechanisms: compile-time (overloading/templates) vs run-time (virtual functions)
- Comparison table (binding time, performance, implementation)
- Code example of function overloading for static polymorphism
- Code example of virtual functions with base class pointer for dynamic polymorphism
-
7 MarksaExplain the architecture and functionalities of a Library Management System. Discuss how strings, exception handling, and collections can be utilized in its implementation.
How to answer
- Architecture of Library Management System (Entities: Book, Member, Transaction; modules: issue, return, search)
- Core functionalities: add book, issue book, search catalog, return & fine calculation
- Utilization of Strings (book titles, author names, ISBN handling)
- Utilization of Exception Handling (handling book unavailable, invalid member ID, overdue limits)
- Utilization of Collections (vector/list/map for catalog and user databases)
-
7 MarksbDescribe the concept of multi-threading. What are the advantages of using multi-threading in applications?
How to answer
- Definition of multithreading and thread vs process
- How multithreading enables concurrent execution of multiple parts of a program
- Advantages: improved responsiveness, better resource sharing, CPU utilization, high throughput
-
7 MarksaDiscuss the merits and demerits of Object-Oriented Methodology. Provide real-world scenarios where OOP is beneficial and where it may not be ideal.
How to answer
- Merits: modularity, code reuse, easy debugging, data protection, clear model mapping
- Demerits: higher memory overhead, larger compiled code, execution overhead, complex design curve
- Ideal real-world scenarios: GUI applications, simulation software, enterprise ERP systems
- Non-ideal scenarios: simple low-level device drivers, highly constrained embedded systems, pure mathematical computations
-
7 MarksbDiscuss the concepts of message passing in OOP. How does message passing facilitate communication between objects?
How to answer
- Definition of message passing (sender, receiver, message/method name, arguments)
- Mechanism: an object requests another object to invoke a specific behavior
- How it facilitates loose coupling, encapsulation preservation, and dynamic polymorphism
- Syntax/representation in OOP languages
-
7 MarksaWhat are classes in OOP? Discuss how to identify classes. Create a class student with attributes like name, roll_number, and marks. Write methods to calculate the average marks and display student information. Demonstrate its use in a sample program.
How to answer
- Definition of a class as a blueprint/template for creating objects
- Methods to identify classes in domain analysis (e.g., noun-verb analysis, CRC cards)
- C++ implementation of class `Student` with attributes: name, roll_number, marks
- Methods `calculateAverage()` and `displayInfo()`
- Driver `main()` code creating an instance and calling the methods
-
7 MarksbExplain the concept of interfaces in OOP. How do interfaces differ from abstract classes? Discuss the use of both in software development.
How to answer
- Concept of Interface as a contract specifying 'what' to do without 'how'
- Detailed comparison between Interface and Abstract Class (implementation, variables, inheritance)
- When to use each in software development (abstract class for sharing code among related classes; interface for unrelated classes sharing behavior)
-
7 MarksaExplain how interfaces in Object-Oriented Programming can facilitate polymorphism. Provide code examples to illustrate the use of interfaces in C++.
How to answer
- Explain how interfaces enable polymorphism by decoupling the definition of methods from their implementation
- C++ implementation of an interface using a class containing only pure virtual functions (`= 0`) and a virtual destructor
- Two derived classes overriding the pure virtual functions
- Polymorphic execution via base class pointer
-
7 MarksbDiscuss various data collections available in C++. How do these collections differ in terms of performance and use cases?
How to answer
- Overview of C++ STL containers (Sequence, Associative, Unordered, Container adaptors)
- Key collections: std::vector, std::list, std::map, std::unordered_map
- Performance comparison table (Access, Insertion, Deletion time complexities: O(1), O(log n), O(n))
- Typical use cases for each collection type
Go to where you left off?
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel