CS-305 · Object Oriented Programming & Methodology/Unsolved PYQ Paper
CS-305 Object Oriented Programming and Methodology - Jun 2023 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 the object-oriented programming language with procedure programming language.
How to answer
- Definition of procedural programming vs OOP
- Key differences: focus on functions vs data/objects
- Access specifiers and data security differences
- Reusability features (inheritance) vs top-down structure
- Tabular comparison summarizing key points
-
7 MarksbExplain features of object-oriented programming with giving suitable examples.
How to answer
- List main features: Classes, Objects, Data Abstraction, Encapsulation, Inheritance, Polymorphism, Dynamic Binding
- Detailed explanation of each feature
- Suitable real-world and code examples for each feature
-
7 MarksaExplain the concept of Encapsulation and data abstraction in detail. Write a C++ program to show these concepts in object-oriented programming methodology. Define scope and life of any variable.
How to answer
- Definition and detailed explanation of Encapsulation and Data Abstraction
- C++ program illustrating private members and public getters/setters
- Definition of scope (local, global, block, class scope)
- Definition of variable lifetime/storage duration
-
7 MarksbWhat is Message Passing? How it can be achieved in C++ Programming language?
How to answer
- Definition of message passing in OOP context
- Mechanics: Object name, method name, and arguments passed
- Syntax and code example in C++ demonstrating an object invoking a function
-
7 MarksaWhat is Association? Explain different types of association with example.
How to answer
- Definition of Association between classes/objects
- Types: One-to-One, One-to-Many, Many-to-Many; Aggregation (weak 'has-a') and Composition (strong 'has-a')
- Examples and diagrams illustrating the relationships
-
7 MarksbDescribe the role of Inheritance in object-oriented programming. Give different types of inheritance.
How to answer
- Role/advantages of inheritance (reusability, extensibility, establishing 'is-a' relationship)
- Types: Single, Multiple, Multilevel, Hierarchical, Hybrid inheritance
- Brief diagram or syntax for each type
-
7 MarksaDiscuss Polymorphism in detail. What are the different ways to implement Polymorphism in C++, discuss them in brief. Give differences between function overloading and function overriding (or method overriding) by writing its syntax.
How to answer
- Definition of Polymorphism (compile-time vs runtime)
- Ways to implement in C++: function overloading, operator overloading, virtual functions
- Differences between overloading and overriding with syntax snippets
-
7 MarksbWrite a C++ program to calculate the area using method overloading that accepts input from the user and then shows the desired result.
How to answer
- Define overloaded area functions (e.g., area(float r) for circle, area(float l, float b) for rectangle)
- Prompt user input in main() using cin
- Invoke corresponding overloaded function and display result using cout
-
7 MarksaExplain the concept of multithreading in object-oriented programming approach? Write its benefits. Discuss the collection and its type. What is a collection class?
How to answer
- Concept of multithreading in OOP
- Benefits: responsiveness, resource sharing, throughput
- Discussion of Collections and common types (lists, sets, maps/dictionaries)
- Definition and purpose of a collection class
-
7 MarksbExplain library management system using object-oriented diagram.
How to answer
- Overview of Library Management System entities (Book, Member, Librarian, Transaction)
- Neat Class Diagram / Object-Oriented diagram showing classes, attributes, methods, and relationships
- Explanation of the workflow and interactions between objects
-
7 MarksaWhat is exception? Write a program to read three numbers $x$, $y$ and $z$ and evaluate $R$ given by $R = z / (x - y)$. Use exception handling to throw an exception in case division by zero is attempted.
How to answer
- Definition of exception and exception handling mechanism
- C++ program with inputs for x, y, and z
- Check condition (x - y == 0) inside try block and throw exception
- Catch block handling division by zero and printing appropriate error message
- Compute and display R otherwise
-
7 MarksbDiscuss the methods of passing an argument in C++. Explain with suitable program.
How to answer
- Explain Pass by Value
- Explain Pass by Reference
- Explain Pass by Pointer/Address
- Sample C++ code illustrating swapping or modifying values using each method
-
7 MarksaWrite a program to create a file called Emp.dat with employee number, name, salary, department, deductions, and allowances as per record fields. Open a file, read the record. Calculate the net salary and write it back to the same file.
How to answer
- Define an Employee class or struct with specified fields and net_salary
- Create and write record(s) to 'Emp.dat' using ofstream/fstream
- Open file in read/write mode (ios::in | ios::out | ios::binary)
- Read employee record, calculate net salary = salary + allowances - deductions
- Seek back to appropriate position and write updated record
-
7 MarksbWhat are the functions supported by file stream classes for performing I/O operations?
How to answer
- Overview of file stream classes (ifstream, ofstream, fstream)
- Functions: open(), close(), read(), write()
- Character/line I/O: get(), put(), getline()
- Stream pointer manipulation: seekg(), seekp(), tellg(), tellp()
- Status checking functions: eof(), fail(), bad(), good()
-
14 MarksWrite short note on (any two) a) Ambiguity in Multiple inheritance b) Object Model c) Access specifier in C++
How to answer
- Ambiguity in Multiple inheritance: Diamond problem, scope resolution operator, virtual base classes
- Object Model: Principles including abstraction, encapsulation, modularity, hierarchy, typing, concurrency, persistence
- Access Specifiers in C++: public, private, protected access modes and inheritance visibility rules
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