Page 357 - CA_Blue( J )_Class10
P. 357

4.  What is private access specifier?
                   Ans.  The private access specifier allows the data members and member methods to be accessed only within the class.
                    5.  What is public access specifier?
                   Ans.  The public access specifier allows the data members and member methods to be accessed from anywhere within the class or
                       outside the class.
                    6.  What is protected access specifier?
                   Ans.  The protected access specifier allows the data members and member methods to be accessed within the package and in the class
                       that inherits this class.
                    7.  What is the meaning of scope of variables?
                   Ans.  Variables are name given to a memory location to store values. The use of these variables in the program code can be restricted
                       using the concept of scope.
                    8.  Name the different types of variables.
                   Ans.  The different types of variables are:
                       a.  Local Variables                             b.  Class variables
                       c.  Instance variables                          d.  Argument variables
                    9.  Define Inheritance.
                   Ans.  Inheritance in Java is the method which allows one class to inherit the properties (data members and member methods) of
                       another class.
                    10.  Define base class and derived class?
                   Ans.  The class from which the data is inherited is called base class or superclass and the class which inherits the data is called derived
                       class or subclass.
                    11.  Name the different types of inheritance.
                   Ans.  •  Single Inheritance                         •   Multiple Inheritance
                        •  Multilevel Inheritance                      •   Hierarchical Inheritance
                        •  Hybrid Inheritance
                    12.  What is the need for inheritance?
                   Ans.  Inheritance is mainly required to reuse the properties (Data Members and Methods) of one class within another class.

                 D.  Assertion and Reasoning based questions.
                       The following questions consist of two statements – Assertion (A) and Reason (R). Answer these questions by selecting the appro-
                       priate option given below:
                       a.  Both A and R are true, and R is the correct explanation of A.
                       b.  Both A and R are true, but R is not the correct explanation of A.
                       c.  A is true, but R is false.
                       d.  A is false, but R is true.
                    1.  Assertion (A): Primitive data types in Java are the fundamental data types used to store simple values.
                        Reason (R): Primitive data types directly hold their values and are not objects. They are predefined by the language and are not
                       composed of other data types.
                    2.  Assertion (A): Primitive data types are null.
                        Reason (R): Primitive data types cannot have a null value. They always hold a valid value.
                   Ans.  1. a    2. d
                                                                                                  21 st
                 E.  Case-based questions.                                                      Century   #Experiential Learning
                                                                                                 Skills
                    1.  Autoboxing simplifies the process of converting primitive data types into objects by allowing the compiler to insert the necessary
                       code automatically. Unboxing simplifies the process of extracting primitive values from objects by allowing the compiler to insert
                       the necessary code automatically.
                     i.  What does unboxing in Java refer to?
                       a.  Converting objects into primitive data types
                       b.  Converting primitive data types into objects automatically






                                                                                                                       355
                                                                                           Encapsulation and Inheritance   355
   352   353   354   355   356   357   358   359   360   361   362