Dd3

44 Questions | Attempts: 739
Share

SettingsSettingsSettings
Software Quizzes & Trivia

Questions and Answers
  • 1. 

    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?

    • A.

      Greek f = (Beta)(Alpha)x;

    • B.

      Alpha a = x;

    • C.

      Greek f = (Alpha)x;

    • D.

      Beta b = (Beta)(Alpha)x;

    • E.

      Greek f = (Delta)x;

    Correct Answer
    E. Greek f = (Delta)x;
  • 2. 

    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)

    • A.

      Node1.node = new Node();

    • B.

      Node1 = null;

    • C.

      Node1.node = null;

    • D.

      Node1 = node1.node;

    • E.

      Node1 = new Node();

    Correct Answer(s)
    B. Node1 = null;
    E. Node1 = new Node();
  • 3. 

    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.

    • A.

      Public void run()

    • B.

      Public void start()

    • C.

      Public void stop()

    • D.

      Public void suspend()

    Correct Answer
    A. Public void run()
  • 4. 

    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)

    • A.

      Container.setComponent(component); component=newComponent(); component.setParam(100);

    • B.

      Component = new Component(); component.setParam(100);container.setComponent(component);

    • C.

      Component.setParam(100);

    • D.

      Component = new Component(); component.setParam(100);

    • E.

      Container.getComponent().setParam(100);

    Correct Answer(s)
    B. Component = new Component(); component.setParam(100);container.setComponent(component);
    C. Component.setParam(100);
    E. Container.getComponent().setParam(100);
  • 5. 

    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?

    • A.

      Prints: 1, true

    • B.

      Prints 2, false

    • C.

      Prints: 2, true

    • D.

      Prints: 1, false

    Correct Answer
    C. Prints: 2, true
  • 6. 

    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?

    • A.

      Welcome Planet

    • B.

      Compilation Error

    • C.

      Compiles and Executes with no output

    • D.

      Planet

    • E.

      Planet Welcome

    Correct Answer
    E. Planet Welcome
  • 7. 

    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?

    • A.

      Prints: T1T2T2

    • B.

      Prints: T1T2T3

    • C.

      Prints: T1T1T2

    • D.

      Prints: T1T1T3

    • E.

      Prints: T1T1T1

    Correct Answer
    D. Prints: T1T1T3
  • 8. 

    From JDK 1.6, which of the following interfaces is also implemented by java.util.TreeSet class?

    • A.

      NavigableSet

    • B.

      Deque

    • C.

      NavigableMap

    • D.

      NavigableList

    Correct Answer
    A. NavigableSet
  • 9. 

    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?

    • A.

      Cloneable interface

    • B.

      Serializable interface

    • C.

      Readable interface

    • D.

      Externalizable interface

    • E.

      Writable interface

    Correct Answer
    D. Externalizable interface
  • 10. 

    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)

    • A.

      Color treeColor = Color.GREEN;

    • B.

      Color purple = new Color( 0xff00ff);

    • C.

      Color skyColor = BLUE;

    • D.

      If( RED.getRGB() < BLUE.getRGB() ) {}

    • E.

      If( Color.RED.ordinal() < Color.BLUE.ordinal() ) {}

    Correct Answer(s)
    A. Color treeColor = Color.GREEN;
    E. If( Color.RED.ordinal() < Color.BLUE.ordinal() ) {}
  • 11. 

    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)

    • A.

      Public class Circle extends Shape {private int radius;public void setRadius(int radius) { this.radius = radius; }public int getRadius() { return radius; }public void draw() {/* code here */}}

    • B.

      Public class Circle extends Shape {private int radius;public void draw();}

    • C.

      Public abstract class Circle extends Shape {private int radius;}

    • D.

      Public class Circle implements Shape {private int radius;}

    • E.

      Public class Circle extends Shape {public int radius;private void draw() {/* code here */}}

    Correct Answer(s)
    A. Public class Circle extends Shape {private int radius;public void setRadius(int radius) { this.radius = radius; }public int getRadius() { return radius; }public void draw() {/* code here */}}
    C. Public abstract class Circle extends Shape {private int radius;}
  • 12. 

    Which of the following flow control features does Java support? (Choose 2)

    • A.

      Labeled continue

    • B.

      Labeled goto

    • C.

      Labeled throw

    • D.

      Labeled catch

    • E.

      Labeled break

    Correct Answer(s)
    A. Labeled continue
    E. Labeled break
  • 13. 

    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?

    • A.

      Runtime Error "IllegalThreadStateException"

    • B.

      Prints the following output 2 times: Planet(waits for 1000 milli seconds)Earth

    • C.

      Compile-time Error

    • D.

      Prints the following output 1 time: Planet(waits for 1000 milli seconds)Earth

    • E.

      Prints the following output:PlanetPlanet(get into long wait. Never ends)

    Correct Answer
    E. Prints the following output:PlanetPlanet(get into long wait. Never ends)
  • 14. 

    Consider the following code:   class Alpha { protected Beta b; }   class Gamma extends Alpha { }   class Beta { }   Which of the following statement is True?

    • A.

      Beta has-a Gamma and Gamma is-a Alpha.

    • B.

      Gamma has-a Beta and Gamma is-a Alpha

    • C.

      Alpha is-a Gamma and has-a Beta.

    • D.

      Gamma is-a Beta and has-a Alpha.

    • E.

      Alpha has-a Beta and Alpha is-a Gamma.

    Correct Answer
    B. Gamma has-a Beta and Gamma is-a Alpha
  • 15. 

    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)

    • A.

      Public void eatMe() throws BitterException, SourException

    • B.

      Public void eatMe() throws Throwable

    • C.

      Public void eatMe() throw BadTasteException

    • D.

      Public void eatMe() throws BadTasteException

    • E.

      Public void eatMe() throws RuntimeException

    Correct Answer(s)
    A. Public void eatMe() throws BitterException, SourException
    C. Public void eatMe() throw BadTasteException
    D. Public void eatMe() throws BadTasteException
  • 16. 

    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?

    • A.

      CharAt(13)

    • B.

      CharAt(15)

    • C.

      CharAt(12)

    • D.

      CharAt(16)

    • E.

      CharAt(14)

    Correct Answer
    B. CharAt(15)
  • 17. 

    Which of the following codes will compile and run properly?

    • A.

      Public class Test2 {static public void main(String[] in) {System.out.println("Test2");}}

    • B.

      Public class Test4 {static int main(String args[]) {System.out.println("Test4");}}

    • C.

      Public class Test1 {public static void main() {System.out.println("Test1");}}

    • D.

      Public class Test3 {public static void main(String args) {System.out.println("Test3");}}

    • E.

      Public class Test5 {static void main(String[] data) {System.out.println("Test5");}}

    Correct Answer
    A. Public class Test2 {static public void main(String[] in) {System.out.println("Test2");}}
  • 18. 

    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?

    • A.

      Reads the text from keyboard and prints the same to theconsole on pressing Ctrl Z, flushes (erases) the same from theconsole.

    • B.

      Reads the text from keyboard character by character andprints the same to the console on typing every character.

    • C.

      Reads the text from keyboard line by line and prints the sameto the console on pressing ENTER key at the end of every line

    • D.

      Reads the text from keyboard line by line and prints the sameto the console on pressing ENTER key at the end of every line,then the same is flushed (erased) from the console.

    • E.

      Reads the text from keyboard and prints the same to theconsole on pressing Ctrl Z

    Correct Answer
    C. Reads the text from keyboard line by line and prints the sameto the console on pressing ENTER key at the end of every line
  • 19. 

    Which of the following options gives the relationship between a Pilot class and Plane class?

    • A.

      Inheritance

    • B.

      Polymorphism

    • C.

      Persistence

    • D.

      Aggregation

    • E.

      Association

    Correct Answer
    E. Association
  • 20. 

    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.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
  • 21. 

    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?

    • A.

      DateFormat df = new SimpleDateFormat("dd/MM/yyyy");try {Date d = df.parse(dob);} catch(ParseException pe) { }

    • B.

      GregorianCalendar g = new GregorianCalendar(dob);Date d = g.getDate();

    • C.

      Calendar c = new Calendar(dob);Date d = g.getDate();

    • D.

      Date d = new Date(dob);

    • E.

      CalendarFormat cf = newSimpleCalendarFormat("dd/MM/yyyy");try {Date d = cf.parse(dob);} catch(ParseException pe) { }

    Correct Answer
    A. DateFormat df = new SimpleDateFormat("dd/MM/yyyy");try {Date d = df.parse(dob);} catch(ParseException pe) { }
  • 22. 

    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?

    • A.

      Welcomeclass two

    • B.

      Throws a compile time exception as overridden method a()does not throw exception smile

    • C.

      Class two

    • D.

      Throws a compile time exception as overridden method z()does not throw exception smile

    • E.

      Two

    Correct Answer
    B. Throws a compile time exception as overridden method a()does not throw exception smile
  • 23. 

    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?

    • A.

      Compile-time error: Wrapper types cannot be comparedusing equals

    • B.

      Compile-time error: Integer wrapper cannot accept char type

    • C.

      Prints: equals

    • D.

      Prints: EQ

    • E.

      Prints: equals EQ

    Correct Answer
    D. Prints: EQ
  • 24. 

    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?

    • A.

      HelloolleH55

    • B.

      HelloolleH44

    • C.

      HelloHello44

    • D.

      HelloHello33

    • E.

      HelloHello55

    Correct Answer
    A. HelloolleH55
  • 25. 

    The purpose of Soft Reference Type object is ______________.

    • A.

      To automatically delete objects from a container as soonclients stop referencing them

    • B.

      To allow clean up after finalization but before the space isreclaimed

    • C.

      To keep objects alive provided there is enough memory

    • D.

      To keep objects alive only while they are in use (reachable) byclients

    Correct Answer
    C. To keep objects alive provided there is enough memory
  • 26. 

    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?

    • A.

      Compile-time error

    • B.

      Runtime Error

    • C.

      NO

    • D.

      False

    • E.

      True

    Correct Answer
    A. Compile-time error
  • 27. 

    Which of the following methods are defined in Object class? (Choose 3)

    • A.

      ToString()

    • B.

      CompareTo(Object)

    • C.

      HashCode()

    • D.

      Equals(Object)

    • E.

      Run()

    Correct Answer(s)
    A. ToString()
    C. HashCode()
    D. Equals(Object)
  • 28. 

    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?

    • A.

      Throws a Runtime error 'Illegal forward reference'

    • B.

      1000

    • C.

      Compiler complains about forward referencing of membervariables first and second

    • D.

      Compiler complains about private memebers is notaccessible from main() method

    Correct Answer
    C. Compiler complains about forward referencing of membervariables first and second
  • 29. 

    Which of the following are true about inheritance?(Choose 3)

    • A.

      Inheritance enables adding new features and functionality toan existing class without modifying the existing class

    • B.

      In an inheritance hierarchy, a superclass can also act as a subclass

    • C.

      Inheritance is a kind of Encapsulation

    • D.

      Inheritance does not allow sharing data and methods amongmultiple classes

    • E.

      In an inheritance hierarchy, a subclass can also act as a superclass

    Correct Answer(s)
    A. Inheritance enables adding new features and functionality toan existing class without modifying the existing class
    B. In an inheritance hierarchy, a superclass can also act as a subclass
    E. In an inheritance hierarchy, a subclass can also act as a superclass
  • 30. 

    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?

    • A.

      Welcome Planet

    • B.

      The code runs with no output

    • C.

      Compilation fails

    • D.

      Welcome 5

    • E.

      Welcome Planet 5

    Correct Answer
    D. Welcome 5
  • 31. 

    Which of the following are characteristics of Annotations?(Choose 2)

    • A.

      Annotations are not part of a program.

    • B.

      Annotations are predefined classes.

    • C.

      Annotations are data about program.

    • D.

      Annotations are static methods.

    Correct Answer(s)
    A. Annotations are not part of a program.
    C. Annotations are data about program.
  • 32. 

    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?

    • A.

      Prints: 21 21

    • B.

      Prints: 20 21

    • C.

      Compilation Error: Non-static method methodB() cannot be referenced from static context methodA()

    • D.

      Prints: 20 20

    • E.

      Prints: 21 20

    Correct Answer
    C. Compilation Error: Non-static method methodB() cannot be referenced from static context methodA()
  • 33. 

    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?

    • A.

      ArrayList< Double > a = new ArrayList < Double >();

    • B.

      ArrayList< Integer > a = new ArrayList< Double >();

    • C.

      ArrayList< WrapperType > a = new ArrayList< WrapperType >();

    • D.

      ArrayList< Number > a = new ArrayList< Number >();

    • E.

      ArrayList< Integer > a = new ArrayList< Integer >();

    Correct Answer
    D. ArrayList< Number > a = new ArrayList< Number >();
  • 34. 

    Which of the following statements are true? (Choose 2)

    • A.

      All exceptions are thrown programmatically from the code or API

    • B.

      All exceptions are thrown by JVM

    • C.

      JVM cannot throw user-defined exceptions

    • D.

      JVM thrown exceptions can be thrown programmatically

    • E.

      All RuntimeException are thrown by JVM

    Correct Answer(s)
    C. JVM cannot throw user-defined exceptions
    D. JVM thrown exceptions can be thrown programmatically
  • 35. 

    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)

    • A.

      Default (blank), that is, the method declaration would readvoid setWidth( int n )

    • B.

      Final

    • C.

      Private

    • D.

      Protected

    • E.

      Public

    Correct Answer(s)
    D. Protected
    E. Public
  • 36. 

    Consider s1 and s2 are sets.   Which of the following options gives the exact meaning of the method call s1.retainAll(s2)?

    • A.

      Transforms s1 into the union of s1 and s2

    • B.

      Transforms s1 into the (asymmetric) set difference of s1 ands2

    • C.

      Transforms s1 into the intersection of s1 and s2.

    • D.

      Copies elements from s2 to s1

    • E.

      Returns true if s2 is a subset of s1

    Correct Answer
    C. Transforms s1 into the intersection of s1 and s2.
  • 37. 

    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?

    • A.

      Since widgetCount is private, only methods in the Widgetclass can access it.

    • B.

      If another class tries to access widgetCount, a runtimeexception will be thrown.

    • C.

      Since widgetCount is private, only the addWidget method canaccess it.

    • D.

      Since widgetCount is private, only methods in the Widgetclass and any derived classes can access it.

    Correct Answer
    A. Since widgetCount is private, only methods in the Widgetclass can access it.
  • 38. 

    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?

    • A.

      Null pointer exceptionCatchable caughtnull pointer exception

    • B.

      Runtime error

    • C.

      Catchable caughtnull pointer exceptionnull pointer exception

    • D.

      Compile-time error

    • E.

      Null pointer exceptionnull pointer exceptionCatchable caught

    Correct Answer
    A. Null pointer exceptionCatchable caughtnull pointer exception
  • 39. 

    Which of the following statement is true?

    • A.

      To call the join() method, a thread must own the lock of theobject on which the call is to be made

    • B.

      To call the yield() method, a thread must own the lock of theobject on which the call is to be made.

    • C.

      To call the wait() method, a thread must own the lock of theobject on which the call is to be made.

    • D.

      To call the wait() method, a thread must own the lock of thecurrent thread.

    • E.

      To call the sleep() method, a thread must own the lock of theobject which the call is to be made.

    Correct Answer
    C. To call the wait() method, a thread must own the lock of theobject on which the call is to be made.
  • 40. 

    Which of the following methods is used to check whether ResultSet object contains records?

    • A.

      Last()

    • B.

      HasRecords()

    • C.

      Previous()

    • D.

      Next()

    • E.

      First()

    Correct Answer
    D. Next()
  • 41. 

    Which of the following are true about SQLWarning class in JDBC API?

    • A.

      SQLWarning is the subclass of SQLException

    • B.

      SQLWarning and SQLException can be used interchangeably

    • C.

      SQLWarning affects the normal program execution

    • D.

      SQLWarning messages are accessible through the Statementobject

    • E.

      SQLWarning can be caught and handled using try-catch

    Correct Answer(s)
    A. SQLWarning is the subclass of SQLException
    D. SQLWarning messages are accessible through the Statementobject
  • 42. 

    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?  

    • A.

      Author(name = "Deepak",date = "02/04/2008")class MyClass() { }

    • B.

      @Author(name = "Deepak",)class MyClass() { }

    • C.

      @Author("Deepak","02/04/2008")class MyClass() { }

    • D.

      SELECT * BULK COLLECT INTO emp_details_t from emp;

    • E.

      @Author(name = "Deepak",date = "02/04/2008")class MyClass() { }

    Correct Answer
    E. @Author(name = "Deepak",date = "02/04/2008")class MyClass() { }
  • 43. 

    Delimiters themselves be considered as tokens. State True or False.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
  • 44. 

    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"?

    • A.

      If (x != y[0].toString()) {

    • B.

      If (x & y[0]) {

    • C.

      If (x.equals(y[0])) {

    • D.

      If (!x.equals(y[0])) {

    Correct Answer
    D. If (!x.equals(y[0])) {

Quiz Review Timeline +

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
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.