Question 1 of 25
Hints left: 3
Q1
Which of this package is used for analyzing code during run-time?
Q2
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); } }
Q3
Which of these is a mechanism for naming and visibility control of a class and its content?
Q4
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)); } }
Q5
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); } }
Q6
Java system properties can be set at runtime.
Q7
Which of these class is used to read and write bytes in a file?
Q8
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(); } } }
Q9
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); } }
Q10
Which of these class defines how the classes are loaded?
Q11
Which of these exceptions is thrown by compareTo() method defined in a double wrapper?
Q12
What is true about the setProperties method?
Q13
Which of the following is the correct way of implementing an interface salary by class manager?
Q14
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); } }
Q15
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()); } }
Q16
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); } }
Q17
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()); } }
Q18
Which of these class is a superclass of all other classes?
Q19
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()); } }
Q20
Which of these methods returns the class of an object?
Q21
Which of these method returns the remainder of dividend / divisor?
Q22
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()); } }
Q23
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)); } }
Q24
Which of these methods is used to check for infinitely large and small values?
Q25
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); } }