Page 54 - CA_Blue( J )_Class9
P. 54
21 st
E. Case Study. Century #Experiential Learning
Skills
1. A user-defined data type is a derived data type depending on some existing data types.
A Java program is made up of classes. And each class is made up of some attributes (Data members) which are of
predefined data types. And while creating an object of a class, we are basically defining a variable which has the size
of the total bytes of the predefined data types.
(i) A User-defined data type is same as
a. Primitive data type b. derived data type
c. explicit data d. implicit data
(ii) Each class is made up of
a. data members b. predefined data types
c. attributes d. all of these
2. In an Inventory Management System, you are tasked with creating a Product class to manage items in the store. The
class will represent various products with attributes such as name, price, and quantity. You will also use objects of this
class to manage specific products in the inventory.
Case Study Details
Class Definition:
Class: Product
Attributes: name (String), price (double), quantity (int)
Methods: displayProductDetails(), updateStock(int newQuantity)
Objects:
Object 1: product1 representing "Laptop", price Rs. 100000, quantity 10
Object 2: product2 representing "Smartphone", price Rs. 10000, quantity 20
(i) Which of the following best describes the role of the Product class in this Inventory Management System?
a. It represents an individual product's data and operations.
b. It serves as a blueprint or template to create multiple Product objects.
c. It stores the entire inventory of products.
d. It directly interacts with the database to manage product records.
(ii) What is the key difference between a class and an object in Java?
a. A class is a single instance of a data structure, while an object is a template for creating multiple data structures.
b. A class defines attributes and methods, while an object is an instance of that class with specific values for those
attributes.
c. A class represents an instance of a program, while an object is the entire program.
d. A class is a method, and an object is the result of calling that method.
(iii) Which of the following statements accurately describes the Product class and its objects?
a. The Product class contains actual data for each product, while objects define the class structure.
b. The Product class defines the structure and behavior for products, and objects represent specific products with
actual data.
c. The Product class performs operations on individual products, while objects only store data.
d. The Product class and its objects are the same, both storing and defining data.
F. Assertion and Reasoning based question.
Assertion(A): A Java program is made up of classes.
Reason(R): Each class is made up of some attributes (Data members) which are predefined data types.
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
(c) Assertion (A) is true and Reason (R) is false.
(d) Assertion (A) is false and Reason (R) is true.
52 Touchpad Computer Applications-IX

