Page 276 - IT-802_class_12
P. 276

3.  The ……………………… blocks follow a try block. It contains the exception handler-specific code that is executed when the
             exception occurs.                                                                             [2023]
         Ans.  catch
          4.  What is a Compiler?                                                                          [2023]
         Ans.  A compiler is a software tool that translates high-level programming code into machine code or intermediate code, enabling
             the execution of programs on a computer.
          5.  Name any two Primitive datatypes in Java.                                                    [2023]
         Ans.  The two examples of primitive data types are Int and Boolean.
          6.  A ……………………… is a group of statements written to perform a specific task.                     [2023]
              (a)  Method                                  (b)  Class

              (c)  Comment                                 (d)  Variable
         Ans.  (a)  Method
          7.  Predict the output of the given Java code:                                                   [2023]
             String first_name = “Priyank”;

             String last_name = “Arora”
             System.out.println(first_name.length()+last_name.le
             ngth());
         Ans.  The combined length of “Priyank” (7 characters) and “Arora” (5 characters) is 12.

          8.  ……………………… members of a class cannot be accessed outside the class.                           [2023]
         Ans.  Private
          9.  ………………………… symbol replaces a single character while matching a pattern with LIKE keyword.    [2023]
         Ans.  underscore (_)
          10.  Name the method that is used to concatenate a string at the end of another string in Java.   [2023]
         Ans.  concat()
          11.  What is a Bytecode?                                                                         [2023]
         Ans.  Bytecode serves as an intermediary representation derived from a program’s source code, and it finds utility across diverse
             programming languages and platforms
          12.  Which of the following is/are not a keyword in JAVA?                                        [2023]
             break, While, for, switch, Display
         Ans.  Display
          13.  What is the purpose of using try and catch statements in JAVA?                              [2023]
         Ans.  In Java, try and catch statements are used to handle exceptions, which are unexpected events that can occur during the
             execution of a program.
          14.  ‘Java is a platform independent language.’ Justify the statements.                          [2023]
         Ans.  Java’s platform independence means that Java code can run on different computer systems without modification. It achieves
             this through an intermediate step: when you write Java code, it gets compiled into a special form called bytecode, which is
             not tied to any specific computer. Then, a program called the Java Virtual Machine (JVM) on each computer translates this
             bytecode into instructions that the computer can understand. Since the JVM is available on various platforms, Java programs
             work on Windows, macOS, Linux, and more.
          15.  What are the two ways to write comments in Java?                                            [2023]
         Ans.  In Java, there are two ways to write comments:

              (a)    Single-Line Comments: Single-line comments allow you to comment on a single line or a portion of a single line in
                 Java. They are created using //. Anything following // on the same line is treated as a comment and is ignored by the
                 compiler.
          274   Touchpad Information Technology-XII
   271   272   273   274   275   276   277   278   279   280   281