Object Oriented Programming
CSE · Quiz · Summer 25
Section 66_K
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Quiz 1
Section: 66_K
Course code: CSE 221
Course name: Object Oriented Programming
Full marks: 15
Time: 40 minutes
1. Explain the concept of classes and objects in Object-Oriented Programming (OOP). How do they relate to each other, and why are they fundamental to OOP? Provide examples to illustrate your explanation. 4
2. Find out area of rectangle, triangle, and circle (Take values from user) 4
3. Create a class Product with the following:
Data Members:
- title - to store the title of the book
- author - to store the author's name
- copiesAvailable - to store the number of available copies
Methods:
1. inputDetails()
-> Ask the user to enter the book title, author name, and number of available copies using a Scanner.
2. borrowBook()
-> Ask the user how many copies they want to borrow.
-> Directly reduce the number of available copies (no need to check if enough copies are available).
-> Show how many copies were borrowed.
3. displayBookDetails()
-> Display the book title, author name, and remaining copies available.
Tasks:
1. Create one Book object
2. Call inputDetails() to input values
3. Call displayBookDetails()
4. Call borrowBook()
5. Call displayBookDetails() again to show updated available copies 7