Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Java program? class Output { public static void main(String args[]) { String str = "true"; boolean x = Boolean.valueOf(str); System.out.print(x); } }
Q2
Which of these methods returns the class of an object?
Q3
Which of these exceptions is thrown by compareTo() method defined in a double wrapper?
Q4
What is true about the setProperties method?
Q5
Which of these methods is used to check for infinitely large and small values?
Q6
What will be the output of the following Java program? import java.util.*; class LOCALE_CLASS { public static void main(String args[]) { Locale obj = new Locale("HINDI", "INDIA") ; System.out.print(obj.getDisplayLanguage()); } }
Q7
Which of the following is the correct way of implementing an interface salary by class manager?
Q8
Which of these class defines how the classes are loaded?
Q9
What will be the output of the following Java program? import java.lang.System; class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 0, b, 3, a.length - 3); System.out.print(new String(a) + " " + new String(b)); } }
Q10
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("[" + boxContents.toString() + "]"); counter++; } } public static void main(String[] args) { java.util.ArrayList<Box<Integer>> listOfIntegerBoxes = new java.util.ArrayList<>(); BoxDemo.<Integer>addBox(Integer.valueOf(0), listOfIntegerBoxes); BoxDemo.outputBoxes(listOfIntegerBoxes); } }
Q11
What will be the output of the following Java program? (Note: file is made in c drive.) import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.canWrite()); System.out.print(" " + obj.canRead()); } }
Q12
What will be the output of the following Java program? class Output { public static void main(String args[]) { Integer i = new Integer(257); float x = i.floatValue(); System.out.print(x); } }
Q13
Which of these is a mechanism for naming and visibility control of a class and its content?
Q14
Java system properties can be set at runtime.
Q15
What will be the output of the following Java program? class Output { public static void main(String args[]) { char a = '@'; boolean x = Character.isLetter(a); System.out.print(x); } }
Q16
Which of these method returns the remainder of dividend / divisor?
Q17
Which of these class is used to read and write bytes in a file?
Q18
What will be the output of the following Java code? class Output { public static void main(String args[]) { byte a[] = { 65, 66, 67, 68, 69, 70 }; byte b[] = { 71, 72, 73, 74, 75, 76 }; System.arraycopy(a, 2, b, 1, a.length-2); System.out.print(new String(a) + " " + new String(b)); } }
Q19
Which of these class is a superclass of all other classes?
Q20
What will be the output of the following Java program? import java.util.*; class LOCALE_CLASS { public static void main(String args[]) { Locale obj = new Locale("HINDI") ; System.out.print(obj.getDisplayLanguage()); } }
Q21
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 = input1.read()) != -1) { System.out.print((char)i); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Q22
What will be the output of the following Java program? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.toRadians(x); System.out.print(y); } }
Q23
What will be the output of the following Java code? class Output { public static void main(String args[]) { double x = 3.14; int y = (int) Math.floor(x); System.out.print(y); } }
Q24
What will be the output of the following Java program? (Note: file is made in c drive.) import java.io.*; class files { public static void main(String args[]) { File obj = new File("/java/system"); System.out.print(obj.getAbsolutePath()); } }
Q25
Which of this package is used for analyzing code during run-time?