Page 359 - CA_Blue( J )_Class10
P. 359

6.  Which method is used to determine whether a character is a digit in Java?
                       a.  isDigit(char ch)                            b.  isLetter(char ch)
                       c.  isLowerCase(char ch)                        d.  isUpperCase(char ch)
                    7.  What does the Character.isLetter(char ch) method return?
                       a.  true if the character is a lowercase letter
                       b.  true if the character is an uppercase letter
                       c.  true if the character is a letter (either lowercase or uppercase)
                       d.  false if the character is not a letter
                    8.  Which method is used to convert the character argument to lowercase?
                       a.  toLowerCase(char ch)                        b.  toUpperCase(char ch)
                       c.  toLower(char ch)                            d.  toLowercase(char ch)
                    9.  What is autoboxing in Java?
                       a.  Converting a primitive type to its corresponding wrapper class object
                       b.  Converting a wrapper class object to its corresponding primitive type
                       c.  Converting between different primitive types
                       d.  Converting between different wrapper classes
                   10.  Which of the following statements is true regarding autoboxing and unboxing?
                       a.  Autoboxing is the process of converting a wrapper class object to its corresponding primitive type.
                       b.  Unboxing is the process of converting a wrapper class object to its corresponding primitive type.
                       c.  Autoboxing and unboxing are the same processes.
                       d.  Autoboxing and unboxing are not related.
                 B.  Fill in the blanks.

                    1.  The protected members of a class can be accesses outside the package by using the ………………….
                    2.  ………………… helps to reduce the program code and makes easier to debug any error in the program.
                    3.  When the derive class is inherited from more than one superclass, then the type of inheritance is termed as ………………….
                    4.  Derived class is also known as ………………… class.
                 C.  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): Character.isLetter() : It is a Character wrapper class method.
                          Reason (R): It checks whether a character 'n' is a digit or not.
                    2.  Assertion (A): Character.toUpperCase(ch) : It converts a character "ch" to Upper Case.
                          Reason (R): If the character is in UpperCase, then there will be no change.
                    3.  Assertion (A): Integer.parseInt(String) : Converts an integer to string
                          Reason (R): Integer is a wrapper class.
                                                                                                  21 st
                 D.  Case-based questions.                                                     Century   #Experiential Learning
                                                                                                 Skills
                    1.  The String.valueOf() method converts different types of values, including primitive data types, to their string representations.
                       int num = 20;
                       String str = String.valueOf(num); // Convert int to String
                       Wrapper classes for primitive data types provide toString() methods to convert values
                       to strings.







                                                                                                                       357
                                                                                           Encapsulation and Inheritance   357
   354   355   356   357   358   359   360   361   362   363   364