Question 1 of 25
Hints left: 3
Q1
What happens when we access the same variable defined in two interfaces implemented by the same class?
Q2
Which of these class is not related to input and output stream in terms of functioning?
Q3
Which of these method is a rounding function of Math class?
Q4
Which of these exceptions will be thrown if we declare an array with negative size?
Q5
What will be the output of the following Java program? class newthread implements Runnable { Thread t; newthread() { t = new Thread(this,"My Thread"); t.start(); } public void run() { System.out.println(t.getName()); } } class multithreaded_programing { public static void main(String args[]) { new newthread(); } }
Q6
What is the length of the application box made in the following Java program? import java.awt.*; import java.applet.*; public class myapplet extends Applet { Graphic g; g.drawString("A Simple Applet",20,20); }
Q7
Which of these values are returns under the case of normal termination of a program?
Q8
Which of these methods calls update() method?
Q9
Which method is used to generate boolean random values in java?
Q10
What will be the output of the following Java program? import java.io.*; public class filesinputoutput { public static void main(String[] args) { String obj = "abc"; byte b[] = obj.getBytes(); ByteArrayInputStream obj1 = new ByteArrayInputStream(b); for (int i = 0; i < 2; ++ i) { int c; while ((c = obj1.read()) != -1) { if(i == 0) { System.out.print((char)c); } } } } }
Q11
Which of these methods is used to know whether a string contains "true"?
Q12
What will be the output of the following Java program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while ((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Q13
What will be the output of the following Java program? interface calculate { void cal(int item); } class display implements calculate { int x; public void cal(int item) { x = item * item; } } class interfaces { public static void main(String args[]) { display arr = new display; arr.x = 0; arr.cal(2); System.out.print(arr.x); } }
Q14
What will be the output of the following Java program? class exception_handling { public static void main(String args[]) { try { int a = args.length; int b = 10 / a; System.out.print(a); try { if (a == 1) a = a / a - a; if (a == 2) { int c = {1}; c[8] = 9; } } catch (ArrayIndexOutOfBoundException e) { System.out.println("TypeA"); } catch (ArithmeticException e) { System.out.println("TypeB"); } } } Note: Execution command line: $ java exception_handling one two
Q15
What will be the output of the following Java program? class X { int a; double b; } class Y extends X { int c; } class Output { public static void main(String args[]) { X a = new X(); Y b = new Y(); Class obj; obj = b.getClass(); System.out.print(obj.getSuperclass()); } }
Q16
What is the value of double consonant 'E' defined in Math class?
Q17
What is the Java 8 update of PermGen?
Q18
Which of the interface contains all the methods used for handling thread related operations in Java?
Q19
What does an interface contain?
Q20
What will be the output of the following Java program? class Output { public static void main(String args[]) { int x = 3.14; int y = (int) Math.abs(x); System.out.print(y); } }
Q21
Which of these class have only one field 'TYPE'?
Q22
Which of these methods is not defined in both Byte and Short wrappers?
Q23
Which of these classes can schedule task for execution in future?
Q24
Which of these is method for testing whether the specified element is a file or a directory?
Q25
Which of the following method of Process class can terminate a process?