Question 1 of 25
Hints left: 3
Q1
Which of these method of Double wrapper can be used to check whether a given value is infinite or not?
Q2
Which of the following package stores all the standard java classes?
Q3
What will be the output for the below code? public interface TestInf{ int i =10; } public class Test{ public static void main(String... args){ TestInf.i=12; System.out.println(TestInf.i); } }
Q4
What will be the output of the following Java program? import java.lang.reflect.*; class Additional_packages { public static void main(String args[]) { try { Class c = Class.forName("java.awt.Dimension"); Constructor constructors[] = c.getConstructors(); for (int i = 0; i < constructors.length; i++) System.out.println(constructors[i]); } catch (Exception e) { System.out.print("Exception"); } } }
Q5
What will be the output of the following Java program? import java.lang.System; class Output { public static void main(String args[]) { System.exit(5); } }
Q6
What happens if the following program is compiled and executed? interface MyInterface{ void display(); } interface MySubInterface extends MyInterface{ void display(); } public class Test implements MySubInterface{ public void display(){ System.out.print("Welcome to Examveda."); } public static void main(String args[]){ Test t = new Test(); t.display(); } }
Q8
Which of these access specifiers can be used for an interface?
Q9
What will be the output of the following Java program? interface calculate { int VAR = 0; void cal(int item); } class display implements calculate { int x; public void cal(int item) { if (item<2) x = VAR; else x = item * item; } } class interfaces { public static void main(String args[]) { display[] arr=new display[3]; for(int i=0;i<3;i++) arr[i]=new display(); arr[0].cal(0); arr[1].cal(1); arr[2].cal(2); System.out.print(arr[0].x+" " + arr[1].x + " " + arr[2].x); } }
Q10
What will be the output of the following Java program? class Output { public static void main(String args[]) { String str = "true false"; boolean x = Boolean.parseBoolean(str); System.out.print(x); } }
Q11
Which of these is a super class of wrappers Byte and short wrappers?
Q12
What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 5; ++i) System.out.print(a[i]); int x = 1/0; } catch(ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } } }
Q13
What will be the output? public interface InfA{ protected String getName(); } public class Test implements InfA{ public String getName(){ return "test-name"; } public static void main (String[] args){ Test t = new Test(); System.out.println(t.getName()); } }
Q14
What type of variable can be defined in an interface?
Q15
How to use environment properties in the class?
Q16
What is the output for the below code? interface A{ public void printValue(); } public class Test{ public static void main (String[] args){ A a1 = new A(){ public void printValue(){ System.out.println("A"); } }; a1.printValue(); } }
Q17
What will be the output when the following program is compiled and executed? abstract class TestAbstract{ String my_name; String myName(){ my_name = "Examveda"; return my_name; } abstract void display(); } public class Test extends TestAbstract{ void display(){ String n = myName(); System.out.print("My name is "+ n); } public static void main(String args[]){ Test t = new Test(); t.display(); } }
Q18
What type of methods an interface contain by default?
Q19
What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a = 1; int b = 10 / a; try { if (a == 1) a = a / a - a; if (a == 2) { int c[] = {1}; c[8] = 9; } finally { System.out.print("A"); } } catch (NullPointerException e) { System.out.println("B"); } } }
Q20
The same import package/class be called twice in java?
Q21
Which of these method of InputStream is used to read integer representation of next available byte input?
Q22
Which object Java application uses to create a new process?
Q23
What will be the output of the following Java code? import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.getName()); } }
Q24
Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?
Q25
What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 7; ++i) System.out.print(a[i]); } catch(ArrayIndexOutOfBoundsException e) { System.out.print("0"); } } }