Description: programming languages Online Quiz - 209 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Identify the correct examples of Exception
Java's exception handling mechanism keeps error-processing code in the main line of a program's code to improve program clarity.
Handling an exception allows a program to terminate execution
Why does an Assert class that checks program assertions need several implementations of its assert method?
The StringBuffer class supports what type of strings?
Reflection (introspection) is querying a class about its properties, and operating on methods and fields by the name for a given object instance. Why is reflection possible in the Java language?
Vertical and horizontal scroll bar increments are how many units by default?
What is an interface class?
What is the purpose of the toolkit in the Abstract Window Toolkit (AWT)?
Identify whether the following statement is true or false.
The run () method should necessary exist in classes created as subclass of Thread
Identify whether the following statement is true or false.
The keyword synchronized can be used with only a method
ZZZ (Duplicate) - What is the output of the following, StringBuffer sb1 = new StringBuffer("Debopam"); StringBuffer sb2= new StringBuffer("Debopam "); String ss1 = " Debopam "; System.out.println(sb1==sb2); System.out.println(sb1.equals(sb2)); System.out.println(sb1.equals(ss1)); System.out.println("Poddar".substring(3));
ZZZ (Duplicate) - Identify whether the following statement is true or false. The finally block is executed when an exception is thrown, even if no catch matches it.
What is the value of d that will be printed out. public class Test { public final static void main(String[] args) { double d = - 22.22222; System.out.println(Math.ceil(d)); } }
What will happen if you try to compile and run this ? public class Test{ static{ print(10); } static void print(int x){ System.out.println(x); System.exit(0); } }
What is the result that will be printed out ? void aMethod() { float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); }
What is the result that will be printed out ? void aMethod() { float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); }
What is the result of trying to compile and run the following code. public final static void main(String[] args){ double d = 10.0 / -0; if(d == Double.POSITIVE_INFINITY) System.out.println("Positive infinity"); else System.out.println("Negative infinity"); }
Any class that implements the Runnable interface has to provide the implementation for the following methods public void start(); public void run();
How long does the following code run? for(int x=0; x=3; x++)