Page 133 - ComputerScience_Class_11
P. 133

B.  Fill in the blanks.

                    1.  The …………………. are the physical existence of the class.
                    2.  Except …………………, all exceptions are known as the checked exceptions as they are checked by the compiler.
                    3.  [class_name] [space] [object_name] = new [space][constructor]; this is the syntax to create an ………………… .
                    4.  InputMismatchException is thrown when try to enter one type of ………………… to another which is not there.
                    5.  When Java source code is compiled by the Java compiler, the resultant code is called ………………… .
                 C.  Answer the following questions:
                    1.  Write the features of Java Virtual Machine.
                    2.  What is bytecode?
                    3.  Mention the steps to use a Scanner class.
                    4.  What do you mean by the “throws” keyword in Java?
                    5.  Define Input/Output exceptions and explain their types.
                    6.  Differentiate between a Class and an Object.
                    7.  What is the purpose of a try-catch block? Write its syntax.
                    8.  Explain the properties of a class and an object.

                 D.  Higher Order Thinking Skills (HOTS)
                    1.  You are developing a dynamic method invocation feature for a banking application that uses reflection to allow customers to
                       check their account balance, withdraw and deposit money. However, the system encounters a NoSuchMethodException when
                       a user tries to perform an operation that doesn't exist. How would you handle the NoSuchMethodException in this banking
                       application to ensure that the program continues to function smoothly?
                    2.  You are tasked with building a cross-platform financial application that calculates and displays the balance of multiple accounts.
                       The application is written in Java and once the source code is compiled by the Java compiler (JAVAC), it generates bytecode. The
                       bytecode needs to be executed on various devices, including mobile phones, desktops and servers. How does the bytecode in
                       your financial application contribute to its platform independence?

                 E.  Case study-based questions.
                         A Java program is being developed to divide two numbers inputted by the user. However, there is a risk that the user may input a
                       zero as the divisor, leading to an ArithmeticException (divide by zero). To handle this error, the program uses a try-catch block to
                       ensure smooth execution even when an exception occurs.
                        Based on the given case, answer the following questions:
                        1.  What will happen if the user tries to divide by zero in this case?
                           a.   The program will run without errors.
                           b.  The program will stop with an exception message.
                           c.  The program will display a "division by zero" message and continue.
                           d.  The program will display no message and continue.
                        2.  What is the purpose of the try-catch block in this case study?
                           a.  To handle exceptions and continue the program execution smoothly.
                           b.  To calculate the result before the exception occurs.
                           c.  To display a default error message.
                           d.  To throw an exception manually.
                        3.  What type of exception is being handled in the program?
                          a.  NullPointerException                     b.  ArrayIndexOutOfBoundsException
                          c.  ArithmeticException                      d.  FileNotFoundException







                                                                                                          Objects  131
   128   129   130   131   132   133   134   135   136   137   138