Dd3

44 Questions | Attempts: 739
Share
Please wait...
Question 1 / 44
0 %
0/100
Score 0/100
1. Which of the following methods is used to check whether ResultSet object contains records?
Submit
Please wait...
About This Quiz
Software Quizzes & Trivia

Tell us your name to personalize your report, certificate & get on the leaderboard!
2. Consider the following program:   class A implements Runnable { public void run() { System.out.print(Thread.currentThread().getName()); } }   class B implements Runnable { public void run() { new A().run(); new Thread(new A(),"T2").run(); new Thread(new A(),"T3").start(); } }   class C { public static void main (String[] args) { new Thread(new B(),"T1").start(); } }   What will be the output of the above program?
Submit
3. Consider the following code snippet:   import java.util.*; import java.text.*;   public class TestCol5 { public static void main(String[] args) { String dob = "17/03/1981"; // Insert Code here } }   Which of the following code snippets, when substituted to (//Insert Code here) in the above program, will convert the dob from String to Date type?
Submit
4. Consider the following code:   public class WrapIt { public static void main(String[] args) { new WrapIt().testC('a'); }   public void testC(char ch) { Integer ss = new Integer(ch); Character cc = new Character(ch); if(ss.equals(cc)) System.out.print("equals "); if(ss.intValue()==cc.charValue()) { System.out.println("EQ"); } } }   Which of the following gives the valid output for the above code?
Submit
5. Consider s1 and s2 are sets.   Which of the following options gives the exact meaning of the method call s1.retainAll(s2)?
Submit
6. You need to create a class that implements the Runnable interface to do background image processing. Out of the following list of method declarations, select the method that must satisfy the requirements.
Submit
7. Consider the following code snippet:   String deepak = "Did Deepak see bees? Deepak did.";   Which of the following method calls would refer to the letter b in the string referred by the variable deepak?
Submit
8. Consider the following code snippet:   class TestString3 { public static void main(String args[]) { String s1 = "Hello"; StringBuffer sb = new StringBuffer(s1); sb.reverse(); s1.concat(sb.toString());   System.out.println(s1 + sb + s1.length() + sb.length()); } }   What will be the output of the above code snippet?
Submit
9. Which of the following are true about inheritance?(Choose 3)
Submit
10. Consider the following code snippet:   public class Welcome { String title; int value;   public Welcome() { title += " Planet"; }   public void Welcome() { System.out.println(title + " " + value); }   public Welcome(int value) { this.value = value; title = "Welcome"; Welcome(); }   public static void main(String args[]) { Welcome t = new Welcome(5); } }   Which of the following option will be the output for the above code snippet?
Submit
11. Which of the following options gives the relationship between a Pilot class and Plane class?
Submit
12. Consider the following code snippet:   import java.io.*;   public class IOCode1 { public static void main(String args[]) throws IOException { BufferedReader br1 = new BufferedReader( new InputStreamReader(System.in)); BufferedWriter br2 = new BufferedWriter( new OutputStreamWriter(System.out));   String line = null; while( (line = br1.readLine()) != null ) { br2.write(line); br2.flush(); } br1.close(); br2.close(); } }   What will be the output for the above code snippet?
Submit
13. Both TYPE_SCROLL_SENSITIVE and TYPE_SCROLL_INSENSITIVE types ResultSets will make changes visible if they are closed and then reopened. State True or False.
Submit
14. From JDK 1.6, which of the following interfaces is also implemented by java.util.TreeSet class?
Submit
15. Which of the following flow control features does Java support? (Choose 2)
Submit
16. Consider the following code:   public class Key1 { public boolean testAns( String ans, int n ) { boolean rslt; if (ans.equalsIgnoreCase("YES") & n > 5) rslt = true;   return rslt; }   public static void main(String args[]) { System.out.println(new Key1().testAns("no", 5)); } }   Which of the following will be the output of the above program?
Submit
17. Which of the following statement is true?
Submit
18. Delimiters themselves be considered as tokens. State True or False.
Submit
19. Consider the following code:   public class ExampleSeven { public static void main(String [] args) { String[] y = new String[1]; String x = "hello"; y[0] = x;   // Code here System.out.println("match"); } else { System.out.println("no match"); } } }   Which of the following code snippet when substituted at the commented line (// Code here) in the above code will make the program to print "no match"?
Submit
20. Consider the following code:   interface Greek { }   class Alpha implements Greek { }   class Beta extends Alpha {}   class Delta extends Beta { public static void main( String[] args ) { Beta x = new Beta(); // insert code here } }   Which of the following code snippet when inserted individual at the commented line (// insert code here), will cause a java.lang.ClassCastException?
Submit
21. Consider the following code:   public class Code17 { public static void main(String args[]) { new Code17(); } { System.out.print("Planet "); } { System.out.print("Welcome "); } } Which of the following will be the valid output for the above code?
Submit
22. Consider the following code:   class Alpha { protected Beta b; }   class Gamma extends Alpha { }   class Beta { }   Which of the following statement is True?
Submit
23. Consider the following scenario:   Mr.Ram is working for a Software Company. He needs to save and reload objects from a Java application. For security reasons, the default Sun Microsystem's implementation of saving and loading of Java Objects is not used. He needs to write his own module for the same.   Which of the following options can be used to accomplish the above requirement?
Submit
24. Which of the following codes will compile and run properly?
Submit
25. Consider the following program:   class joy extends Exception { } class smile extends joy { } interface happy { void a() throws smile; void z() throws smile; }   class one extends Exception { } class two extends one { } abstract class test { public void a()throws one { } public void b() throws one { } }   public class check extends test { public void a() throws smile { System.out.println("welcome"); throw new smile(); } public void b() throws one { throw new two(); }   public void z() throws smile { throw new smile(); }   public static void main(String args[]) { try { check obj=new check(); obj.b(); obj.a(); obj.z(); } catch(smile s) { System.out.println(s); }catch(two t) { System.out.println(t.getClass()); }catch(one o) { System.out.println(o); }catch(Exception e) { System.out.println(e); } } }   What will be the output of the above program?
Submit
26. Consider the following code:   @interface Author { String name(); String date(); }   Which of the following is the correct way of implementing the above declared annotation type?  
Submit
27. Consider the following code:   public class TestOne { public static void main(String args[]) { byte x = 3; byte y = 5; System.out.print((y%x) + ", "); System.out.println(y == ((y/x) *x +(y%x))); } }   Which of the following gives the valid output for above?
Submit
28. Consider the following code snippet:   import java.util.*;   public class TestCol6 { public static void main(String args[] ){ ArrayList a = new ArrayList(); // Line 1 a.add(new Integer(10)); a.add(new String("Hello")); a.add(new Double(34.9)); } }   Which of the following code snippets when replaced at the line marked //Line 1, will make the ArrayList a to accept only Wrapper types of primitive numerics?
Submit
29. Consider the following code:   public class Code4 { private int second = first; private int first = 1000;   public static void main(String args[]) { System.out.println(new Code4().second); } }   Which of the following will be the output for the above code?
Submit
30. Consider the following code snippet:   class Node { Node node; }   class NodeChain { public static void main(String a[]) { Node node1 = new Node(); // Line 1 node1.node = node1; // Code here } }   Which of the following code snippets when replaced at the comment line (// Code Here) in the above code will make the object created at Line 1, eligible for garbage collection? (Choose 2)
Submit
31. Consider the following code:   1. public class Garment { 2. public enum Color { 3. RED(0xff0000), GREEN(0x00ff00), BLUE(0x0000ff); 4. private final int rgb; 5. Color( int rgb) { this.rgb = rgb; } 6. public int getRGB() { return rgb; } 7. }; 8. public static void main( String[] argv) { 9. // insert code here 10. } 11.}   Which of the following code snippets, when inserted independently at line 9, allow the Garment class to compile? (Choose 2)
Submit
32. The purpose of Soft Reference Type object is ______________.
Submit
33. Which of the following are characteristics of Annotations?(Choose 2)
Submit
34. Which of the following methods are defined in Object class? (Choose 3)
Submit
35. Consider the following code:   public class ObParam{ public int b = 20;   public static void main(String argv[]){ ObParam o = new ObParam(); methodA(o); }   public static void methodA(ObParam a) { a.b++; System.out.println(a.b); methodB(a); System.out.println(a.b); }   public void methodB(ObParam b) { b.b--; } }   Which of the following gives the correct output for the above code?
Submit
36. The following class definitions are in separate files. Note that the Widget and BigWidget classes are in different packages:   1. package conglomo; 2. public class Widget extends Object{ 3. private int myWidth; 4. XXXXXX void setWidth( int n ) { 5. myWidth = n; 6. } 7. }   // the following is in a separate file and in separate package 8. package conglomo.widgets; 9. import conglomo.Widget ; 10. public class BigWidget extends Widget { 11. BigWidget() { 12. setWidth( 204 ); 13. } 14. }   Which of the following modifiers, used in line 4 instead of XXXXXX, would allow the BigWidget class to access the setWidth method (as in line 12)? (Choose 2)
Submit
37. Consider the following code:   public abstract class Shape { private int x; private int y;   public abstract void draw();   public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which of the following implementations use the Shape class correctly? (Choose 2)
Submit
38. Which of the following statements are true? (Choose 2)
Submit
39. Consider the following code:   class Resource { } class UserThread extends Thread { public Resource res; public void run() { try { synchronized(res) { System.out.println("Planet"); res.wait(); Thread.sleep(1000); res.notify(); System.out.println("Earth"); } } catch(InterruptedException e) { } } }   public class StartUserThreads { public static void main(String[] args) { Resource r = new Resource(); UserThread ut1 = new UserThread(); ut1.res = r; UserThread ut2 = new UserThread(); ut2.res = r; ut1.start(); ut2.start(); } }   Which of the following will give the correct output for the above code?
Submit
40. Consider the following partial listing of the Widget class:   1. class Widget extends Thingee { 2. static private int widgetCount = 0; 3. static synchronized int addWidget() { widgetCount++; 4. return widgetCount; 5. } 6. String wName; 7. public Widget( int mx, String T ) { 8. wName = "I am Widget #" + addWidget(); 9. } 10. // more methods follow 11. } Which of the following gives the significance of the word "private" in line 2?
Submit
41. Consider the following program:   class CatchableException extends Throwable { }   class ThrowableException extends CatchableException { }   public class ThrowCatchable { public static void main(String args[]) { try { tryThrowing(); } catch(CatchableException c) { System.out.println("Catchable caught"); } finally { tryCatching(); } }   static void tryThrowing() throws CatchableException { try { tryCatching(); throw new ThrowableException(); } catch(NullPointerException re) { throw re; } }   static void tryCatching() { System.out.println(null + " pointer exception"); } }   What will be the output of the above program?
Submit
42. Consider the following code:   class Component { private int param; public void setParam(int param) { this.param = param; } public int getParam() { return param; } }   class Container { private Component component; public void setComponent(Component component) { this.component = component; } public Component getComponent() { return component; } }   public class TestContainerComponent { public static void main(String args[]) { Container container = new Container(); Component component = new Component();   int j = 10; component.setParam(j); container.setComponent(component);   // Insert code here System.out.println(container.getComponent().getParam()); } }   Which of the following code snippets when individually repalced at the commented line (// Insert code here) in the above code will produce the output 100? (Choose 3)
Submit
43. Which of the following are true about SQLWarning class in JDBC API?
Submit
44. Consider the following scenario:   You are writing a set of classes related to cooking and have created your own exception hierarchy derived from java.lang.Exception as follows:   Exception +-Bad TasteException +-Bitter Exception +-Sour Excpetion   BadTasteException is defined as an abstract class. You have a method eatMe that may throw a BitterException or a SourException.   Which of the following method declarations are acceptable to the compiler? (Choose 3)
Submit
View My Results

Quiz Review Timeline (Updated): Jul 30, 2011 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 30, 2011
    Quiz Edited by
    ProProfs Editorial Team
  • Apr 26, 2011
    Quiz Created by
    Unrealvicky
Cancel
  • All
    All (44)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Which of the following methods is used to check whether ResultSet...
Consider the following program:...
Consider the following code snippet:...
Consider the following code:...
Consider s1 and s2 are sets....
You need to create a class that implements the Runnable interface to...
Consider the following code snippet:...
Consider the following code snippet:...
Which of the following are true about inheritance?(Choose 3)
Consider the following code snippet:...
Which of the following options gives the relationship between a Pilot...
Consider the following code snippet:...
Both TYPE_SCROLL_SENSITIVE and TYPE_SCROLL_INSENSITIVE types...
From JDK 1.6, which of the following interfaces is also implemented by...
Which of the following flow control features does Java support?...
Consider the following code:...
Which of the following statement is true?
Delimiters themselves be considered as tokens. State True or False.
Consider the following code:...
Consider the following code:...
Consider the following code:...
Consider the following code:...
Consider the following scenario:...
Which of the following codes will compile and run properly?
Consider the following program:...
Consider the following code:...
Consider the following code:...
Consider the following code snippet:...
Consider the following code:...
Consider the following code snippet:...
Consider the following code:...
The purpose of Soft Reference Type object is ______________.
Which of the following are characteristics of Annotations?(Choose 2)
Which of the following methods are defined in Object class? (Choose 3)
Consider the following code:...
The following class definitions are in separate files. Note that the...
Consider the following code:...
Which of the following statements are true? (Choose 2)
Consider the following code:...
Consider the following partial listing of the Widget class:...
Consider the following program:...
Consider the following code:...
Which of the following are true about SQLWarning class in JDBC API?
Consider the following scenario:...
Alert!

Advertisement