Question 1 of 25
Hints left: 3
Q1
Which of these method of Locale class can be used to obtain country of operation?
Q2
Why are generics used?
Q3
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = Character.MIN_VALUE; System.out.print((char)a); } }
Q4
Which of the following is the correct way of importing an entire package 'pkg'?
Q5
What will be the output of the following Java program? class Output { public static void main(String args[]) { int a = Character.MAX_VALUE; System.out.print((char)a); } }
Q6
Which of these methods loads the specified dynamic library?
Q7
What will be the output of the following Java program? class Output { public static void main(String args[]) { Double i = new Double(257.5); Double x = i.MIN_VALUE; System.out.print(x); } }
Q8
Which of the following constant are defined in Boolean wrapper?
Q9
What will be the output of the following Java code? class isNaN_output { public static void main(String args[]) { Double d = new Double(1 / 0.); boolean x = d.isNaN(); System.out.print(x); } }
Q10
What will be the output of the following Java program? class newthread implements Runnable { Thread t1,t2; newthread() { t1 = new Thread(this,"Thread_1"); t2 = new Thread(this,"Thread_2"); t1.start(); t2.start(); } public void run() { t2.setPriority(Thread.MAX_PRIORITY); System.out.print(t1.equals(t2)); } } class multithreaded_programing { public static void main(String args[]) { new newthread(); } }
Q11
Which class is used to generate random number?
Q12
What will be the output of the following Java program? package pkg; class display { int x; void show() { if (x > 1) System.out.print(x + " "); } } class packages { public static void main(String args[]) { display[] arr=new display[3]; for(int i=0;i<3;i++) arr[i]=new display(); arr[0].x = 0; arr[1].x = 1; arr[2].x = 2; for (int i = 0; i < 3; ++i) arr[i].show(); } } Note : packages.class file is in directory pkg;
Q13
Which of these is a super class of wrappers Double and Float?
Q14
Which of these type parameters is used for a generic class to return and accept any type of object?
Q15
What will be the output of the following Java code? class Output { public static void main(String args[]) { Double i = new Double(257.5); boolean x = i.isNaN(); System.out.print(x); } }
Q16
Which of these method can set the out stream to OutputStream?
Q17
Which of these stream contains the classes which can work on character stream?
Q18
Which of these class can encapsulate an entire executing program?
Q19
What will be the output of the following Java program? import java.util.*; public class genericstack { Stack stk = new Stack (); public void push(E obj) { stk.push(obj); } public E pop() { E obj = stk.pop(); return obj; } } class Output { public static void main(String args[]) { genericstack gs = new genericstack(); gs.push("Hello"); System.out.print(gs.pop() + " "); genericstack gs = new genericstack(); gs.push(36); System.out.println(gs.pop()); } }
Q20
What is the range of numbers returned by Math.random() method?
Q21
Which of these methods can be used to check whether the given value is a number or not?
Q22
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"); Method methods[] = c.getMethods(); for (int i = 0; i < methods.length; i++) System.out.println(methods[i]); } catch (Exception e) { System.out.print("Exception"); } } }
Q23
What will be the output of the following Java code snippet? int a = random.nextInt(15) + 1;
Q24
Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.
Q25
What will be the output of the following Java program? import java.lang.System; class Output { public static void main(String args[]) { long start, end; start = System.currentTimeMillis(); for (int i = 0; i < 10000000; i++); end = System.currentTimeMillis(); System.out.print(end - start); } }