Question 1 of 25
Hints left: 3
Q1
Which of the following is method of System class is used to find how long a program takes to execute?
Q2
What will be the output of the following Java program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdef"; 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, 0, 3); int i; try { while ((i = input2.read()) != -1) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Q3
What is the signature of Math.random() method?
Q4
Standard output variable 'out' is defined in which class?
Q5
What happens when a constructor is defined for an interface?
Q6
Which of the following is not a memory classification in java?
Q7
Which of these classes encapsulate runtime state of an object?
Q8
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(Character.toUpperCase((char)c)); obj2.write(1); } } System.out.print(obj2); } } }
Q9
Which of these class contains only floating point functions?
Q10
What will be the output of the following Java program? class Output { public static void main(String args[]) { Double i = new Double(257.578123456789); float x = i.floatValue(); System.out.print(x); } }
Q11
What will be the output of the following Java program? class Output { public static void main(String args[]) { char a[] = {'a', '5', 'A', ' '}; System.out.print(Character.isDigit(a[0])+ " "); System.out.print(Character.isWhitespace(a[3])+ " "); System.out.print(Character.isUpperCase(a[2])); } }
Q12
What will be the output of the following Java code? class binary { public static void main(String args[]) { int num = 17; System.out.print(Integer.toBinaryString(num)); } }
Q13
Which of these class produce objects with respect to geographical locations?
Q14
Which of the following is an incorrect statement about packages?
Q15
Which of these class allows us to get real time data about private and protected member of a class?
Q16
Which of these data type is returned by every method of OutputStream?
Q17
Which of these methods is called when observed object has changed?
Q18
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()); } }
Q19
Which of these is a wrapper for data type int?
Q20
How many bits are used for generating random numbers?
Q21
Which class loader loads jar files from JDK directory?
Q22
What will be the output of the following Java program? public class BoxDemo { public static <U> void addBox(U u, java.util.List<Box<U>> boxes) { Box<U> box = new Box<>(); box.set(u); boxes.add(box); } public static <U> void outputBoxes(java.util.List<Box<U>> boxes) { int counter = 0; for (Box<U> box: boxes) { U boxContents = box.get(); System.out.println("Box #" + counter + " contains [" + boxContents.toString() + "]"); counter++; } } public static void main(String[] args) { java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>(); BoxDemo.<Integer>addBox(Integer.valueOf(10), listOfIntegerBoxes); BoxDemo.outputBoxes(listOfIntegerBoxes); } }
Q23
Which of these classes can return more than one character to be returned to input stream?
Q24
Which of these methods of Character wrapper can be used to obtain the char value contained in Character object.
Q25
Which of these classes is used for input and output operation when working with bytes?