Question 1 of 25
Hints left: 3
Q1
Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.
Q2
Which of these method of Locale class can be used to obtain country of operation?
Q3
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()); } }
Q4
Which of these type parameters is used for a generic class to return and accept any type of object?
Q5
What will be the output of the following Java code snippet? int a = random.nextInt(15) + 1;
Q6
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); } }
Q7
Which of these methods can be used to check whether the given value is a number or not?
Q8
Which of the following constant are defined in Boolean wrapper?
Q9
Which of these class can encapsulate an entire executing program?
Q10
What is the range of numbers returned by Math.random() method?
Q11
Which of these stream contains the classes which can work on character stream?
Q12
Which of these is a super class of wrappers Double and Float?
Q13
Why are generics used?
Q14
Which of these methods loads the specified dynamic library?
Q15
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); } }
Q16
Which of the following is the correct way of importing an entire package 'pkg'?
Q17
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); } }
Q18
Which of these method can set the out stream to OutputStream?
Q19
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"); } } }
Q20
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(); } }
Q21
Which class is used to generate random number?
Q22
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); } }
Q23
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); } }
Q24
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;
Q25
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); } }