Mention other ways in which java handles exceptions.

1 Answer

Answer :

A: Java can handle exception using the try-catch block, throws keyword and throw keyword.

Related questions

Description : Mention the two types of exceptions?

Last Answer : A: Checked Exceptions – Exceptions which are checked (handled) during compile time by the compiler. Example: IOException. Unchecked Exceptions – Exceptions which are not checked during compile time. Example: ArrayIndexOutOfBound.

Description : What are exceptions?

Last Answer : A: Exceptions are runtime errors which prevent the program from working normally.

Description : A CPU handles interrupt by executing interrupt service subroutine................. (A) by checking interrupt register after execution of each instruction (B) by checking interrupt register ... cycle (C) whenever an interrupt is registered (D) by checking interrupt register at regular time interval

Last Answer : (A) by checking interrupt register after execution of each instruction

Description : Which of the following statement(s) with regard to an abstract class in JAVA is/are TRUE? I. An abstract class is one that is not used to create objects. II. An abstract class is designed only to act as a base class ... by other classes. (1) Only l (2) Only II (3) Neither I nor II (4) Both l and II

Last Answer : Both l and II

Description : What is the default java package?

Last Answer : A: java.lang

Description : Name the primitive data-types in java.

Last Answer : A: byte, short, int, long, float, double, char and boolean

Description : Why did you write java.util package? (only if you use classes like Scanner or StringTokenizer)

Last Answer : A: To include the functions of the Scanner or StringTokenizer class from the java.util package.

Description : What is significance of import java.io.* in your program?

Last Answer : A: The line imports all the classes of the java.io package into the current program.

Description : What is Inheritance? How is it implemented in Java?

Last Answer : A: The ability of a class to adopt/share the properties (data and functions) completely or partially from another class is called Inheritance. In Java, it is implemented by the use of the keyword, extends.

Description : What is Polymorphism? How is it implemented in Java?

Last Answer : A: It literally means the ability to take ‘more than one forms’. The ability of a method to behave in more than one form is called polymorphism. In Java, it is implemented by method (function) overloading (compile time polymorphism) and method overriding (runtime polymorphism).

Description : What is Data Abstraction? How is it implemented in Java?

Last Answer : A: Act of representing only essential features without including its background details is called Abstraction. Data Abstraction can also be defined as the process of hiding the implementation details and showing ... Java, it is implemented by the use of interfaces or by making the class abstract.

Description : What is Encapsulation? How is it implemented in Java?

Last Answer : A: Binding up of data and associated functions together into a single unit called (class) is called Encapsulation. In Java, it is implemented by the use of a class.

Description : Is Java an Object Oriented language?

Last Answer : A: Yes.

Description : State true or false. i) comparisons precede logical operations in java ii) assignment operations succeed increment operations iii) arithmetic operations succeed comparisons iv) x precede + A) i-true, ii-true, iii-false, ... false, ii-true, iii-false, iv-false D) i-true, ii-false, iii-false, iv-true

Last Answer : A) i-true, ii-true, iii-false, iv-true

Description : Each method in a java class must have a unique name . A) Not necessary B) True C) False D) None of the above

Last Answer : A) Not necessary

Description : In java, string is a ............. A) primitive data type B) abstract data type C) combination of boolean D) None of the above

Last Answer : B) abstract data type

Description : Data input is A) an abstract class defined in java.io B) a class we can use to read primitive data types C) an interface that defines methods to open files. D) an interface that defines methods to read primitive data types.

Last Answer : D) an interface that defines methods to read primitive data types.

Description : The concept of multiple inheritance is implemented in Java by A) extending two or more classes B) extending one class and implementing one or more interfaces C) implementing two or more interfaces D) both B and C

Last Answer : D) both B and C

Description : Data input is A) an abstract class defined in java.io B) a class we can use to read primitive data types C) an interface that defines methods to open files. D) an interface that defines methods to read primitive data types.

Last Answer : D) an interface that defines methods to read primitive data types.

Description : The concept of multiple inheritance is implemented in Java by A) extending two or more classes B) extending one class and implementing one or more interfaces C) implementing two or more interfaces D) both B and C

Last Answer : D) both B and C

Description : State true or false. i) init() is called after start() in applet ii) applets are used for networking iii) inheritance is a part of Java Foundation Classes iv) final does not prevent inheritance A) i-true, ii- ... C) i-true, ii-true, iii-true, iv-true D) i-true, ii-false, iii-false, iv-false

Last Answer : B) i-false, ii-false, iii-false, iv-false

Description : Match the following. a) Java 1) is a tool for debugging java program b) Javah 2) is a tool for creating C-like header files c) Javap 3) runs java bytecode d) jdb 4) prints java code representation A) a-3, b-2,c-1 B) a-3, b-1, c-4, d-2 C) a-1, b-2, c-3, d-4 D) a-2, b-1, c-3, d-4

Last Answer : B) a-3, b-1, c-4, d-2

Description : State true or false for the following statements in Java. i) Java beans slow down software development process. ii) Java Servlets do not have built in multithreading feature. A) i-false, ii-false B) i-false, ii-true C) i-true, ii-false D) i-true, ii-true

Last Answer : A) i-false, ii-false

Description : ............... package is used by compiler itself. So it does not need to be imported for use. A) java.math B) java.awt C) java.applet D) java.lang

Last Answer : D) java.lang

Description : The class string belongs to ................... package. A) java.awt B) java.lang C) java.applet D) java.string

Last Answer : B) java.lang

Description : JSP embeds in ................ in ...................... A) Servlet, HTML B) HTML, Java C) HTML, Servlet D) Java, HTML

Last Answer : D) Java, HTML

Description : State true or false for Java Program. i) Data members of an interface are by default final ii) An abstract class has implementations of all methods defined inside it. A) i-false, ii-false B) i-false, ii-true C) i-true, ii-false D) i-true, ii-true

Last Answer : C) i-true, ii-false

Description : State true or false for Java Program. i) All class variables are instance variables ii) All protected methods are friendly methods A) i-false, ii-false B) i-false, ii-true

Last Answer : B) i-false, ii-true

Description : In Java servlet method init( ) is called ..................... times. A) 1 B) 2 C) 0 D) multiple

Last Answer : A) 1

Description : In JDBC ........................ imports all Java classes concerned with database connectivity. A) javax.sql.* B) java.mysql.* C) java.sql.* D) com.*

Last Answer : C) java.sql.*

Description : The compiled java program can run on any ..................... plateform having Java Virtual Machine (JVM) installed on it. A) program B) java C) hardware D) non java

Last Answer : C) hardware

Description : In the second type the information written in java after // is ignored by the ....................... A) Interpreter B) Compiler C) Programmer D) All of the above

Last Answer : B) Compiler

Description : The third type of comment is used by a tool called .................. for automatic generation of documentation. A) Java commenting B) Java generator C) Java doc D) Java loc

Last Answer : C) Java doc

Description : System.in.read() is being used, the program must specify the .................. clause. A) throws.java.out.IOException B) throws.java.in.IOException C) throws.java.io.IOException D) throws.java.io.InException

Last Answer : C) throws.java.io.IOException

Description : In java, ............. can only test for equality, where as ............ can evaluate any type of the Boolean expression. A) switch, if B) if, switch C) if, break D) continue, if

Last Answer : A) switch, if

Description : In Java variables, if first increment of the variable takes place and then the assignment occurs. This operation is also called ............................. . A) pre increment B) post increment C) incrementation D) pre incrementation

Last Answer : A) pre increment

Description : In order to run JSP .................... is required. A) Mail Server B) Applet viewer C) Java Web Server D) Database connection

Last Answer : C) Java Web Server

Description : The jdb is used to A) Create a jar archive B) Debug a java program C) Create C header file D) Generate java documentation

Last Answer : B) Debug a java program

Description : Java Servlet i) is key component of server side java development ii) is a small pluggable extension to a server that enhances functionality iii) runs only in Windows Operating System iv) allows developers to customize any java ... & iv are true C) ii, iii & iv are true D) i, ii & iv are true

Last Answer : D) i, ii & iv are true

Description : All java classes are derived from A) java.lang.Class B) java.util.Name C) java.lang.Object D) java.awt.Window

Last Answer : D) java.awt.Window

Description : Which of the following is not the java primitive type A) Byte B) Float C) Character D) Long double

Last Answer : D) Long double

Description : The command javac A) Converts a java program into binary code B) Converts a java program into bytecode C) Converts a java program into machine language D) None of the above.

Last Answer : B) Converts a java program into bytecode

Description : Which of the following is true about Java. A) Java does not support overloading. B) Java has replaced the destructor function of C++ C) There are no header files in Java. D) All of the above.

Last Answer : D) All of the above

Description : Native – protocol pure Java converts ……….. into the ………… used by DBMSs directly. A) JDBC calls, network protocol B) ODBC class, network protocol C) ODBC class, user call D) JDBC calls, user call

Last Answer : A) JDBC calls, network protocol

Description : Which is the root class of all AWT events A) java.awt.ActionEvent B) java.awt.AWTEvent C) java.awt.event.AWTEvent D) java.awt.event.Event

Last Answer : B) java.awt.AWTEvent

Description : Java servlets are an efficient and powerful solution for creating ………….. for the web. A) Dynamic content B) Static content C) Hardware D) Both a and b

Last Answer : A) Dynamic content

Description : The command javac is used to A) debug a java program B) compile a java program C) interpret a java program D) execute a java program

Last Answer : B) compile a java program

Description : Which one of the following is true for Java? A) Java is object oriented and interpreted B) Java is efficient and faster than C C) Java is the choice of everyone. D) Java is not robust.

Last Answer : A) Java is object oriented and interpreted

Description : Java has its origin in A) C programming language B) PERRL C) COBOL D) Oak programming language

Last Answer : D) Oak programming language