Dd5

45 Questions | Attempts: 573
Share

SettingsSettingsSettings
Dd5 - Quiz

Questions and Answers
  • 1. 

    Consider the following code: 1. public class GetArray2 { 2. public static void main(String [] args) { 3. int [][] holdit = new int[6][]; 4. for(int x = 0;x<6;x++) { 5. holdit[x] = new int[3]; 6. holdit[x][0] = (x + 0); 7. holdit[x][1] = (x + 1); 8. holdit[x][2] = (x + 2); 9. System.out.println(holdit[x][0]+" "+holdit[x][1]+" "+holdit[x][2]); 10. } 11. } 12. } Which of the following gives the valid output for above?

    • A.

      Compilation fails because of an error on line 5

    • B.

      Compilation succeeds and the program prints: 0 1 2 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7

    • C.

      Compilation fails because of an error on line 3

    • D.

      Compilation succeeds and the program prints: 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6

    Correct Answer
    B. Compilation succeeds and the program prints: 0 1 2 1 2 3 2 3 4 3 4 5 4 5 6 5 6 7
  • 2. 

    Consider the following scenario: An application needs to write a log file on the sequence of actions it takes while running. Which of the following stream classes can be used to implement the above requirement?

    • A.

      FileOutputStream

    • B.

      LogWriter

    • C.

      PrintWriter

    • D.

      OutputStream

    • E.

      Writer

    Correct Answer
    C. PrintWriter
  • 3. 

    Consider the following code: public class Code9 { public static void main(String args[]) { System.out.println(Math.abs(Integer.MIN_VALUE)); } } Which of the following will be the output for the above given program? (Choose 2)

    • A.

      Compilation Error

    • B.

      Compiles successfully and prints a value which is less than zero

    • C.

      Compiles successfully and prints a value which is equal to Integer.MIN_VALUE

    • D.

      Compiles successfully and prints a value which is equal to - Integer.MAX_VALUE

    • E.

      Compiles successfully and prints a value which is equal to Integer.MIN_VALUE + 1

    Correct Answer(s)
    B. Compiles successfully and prints a value which is less than zero
    C. Compiles successfully and prints a value which is equal to Integer.MIN_VALUE
  • 4. 

    Consider the following program: import java.io.*; public class SteppedTryCatch { public static void main(String[] args) { try { try { try { // Line 1 } catch(Exception e3) { System.out.println("Exception 1"); // Line 2 } } catch(IOException e2) { System.out.println("Exception 2"); // Line 3 } } catch(FileNotFoundException e1) { System.out.println("Exception 3"); } } } You need to make the above program to print the output as Exception 1 Exception 2 Exception 3 Which of the following when substituted in place of commented lines (// Line 1, Line 2 and Line 3) produce the desired output?

    • A.

      Line 1 : throw new IOException(); Line 2 : throw new FileNotFoundException(); Line 3 : throw new Exception();

    • B.

      Line 1 : throw new Exception(); Line 2 : throw new IOException(); Line 3 : throw new FileNotFoundException();

    • C.

      The code is wrong. Exceptions should be caught in reversed hierarchy order.

    • D.

      Line 1 : throw new IOException(); Line 2 : throw new IOException(); Line 3 : throw new IOException();

    • E.

      Line 1 : throw new FileNotFoundException(); Line 2 : throw new IOException(); Line 3 : throw new Exception();

    Correct Answer
    B. Line 1 : throw new Exception(); Line 2 : throw new IOException(); Line 3 : throw new FileNotFoundException();
  • 5. 

    What of the following is the default Scroll type for a ResultSet object?

    • A.

      ResultSet.TYPE_SCROLL_SENSITIVE

    • B.

      ResultSet.TYPE_SCROLLABLE

    • C.

      ResultSet.TYPE_SCROLL_INSENSITIVE

    • D.

      ResultSet.TYPE_FORWARD_ONLY

    • E.

      ResultSet.TYPE_SCROLL_BIDIRECTIONAL

    Correct Answer
    D. ResultSet.TYPE_FORWARD_ONLY
  • 6. 

    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 character by character and prints the same to the console on typing every character.

    • B.

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

    • C.

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

    • D.

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

    • E.

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

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

    A monitor called 'mon' has 5 threads in its waiting pool; all these waiting threads have the same priority. One of the threads is thread1. How can you notify thread1 so that it alone moves from Waiting state to Ready State?

    • A.

      Execute mon.notify(thread1); from synchronized code of any object

    • B.

      Execute notify(thread1); from within synchronized code of mon

    • C.

      You cannot specify which thread will get notified

    • D.

      Execute thread1.notify(); from synchronized code of any object

    • E.

      Execute thread1.notify(); from any code(synchronized or not) of any object

    Correct Answer
    C. You cannot specify which thread will get notified
  • 8. 

    Which of the following options are true about Associations?(choose 2)

    • A.

      Association refers to a class reuses the properties and methods of another class

    • B.

      Association refers to an object composed of set of other objects

    • C.

      Association refers to binding of related data and behaviours into a single entity

    • D.

      Associations are bi-directional

    • E.

      In Associations, cardinality refers to the number of related objects

    Correct Answer(s)
    D. Associations are bi-directional
    E. In Associations, cardinality refers to the number of related objects
  • 9. 

    Consider the following code snippet: import java.util.*; public class TestCol3 { public static void main(String[] args) { List l = new ArrayList(); l.add("One"); l.add("Two"); l.add("Three"); l.add("Four"); l.add("One"); l.add("Four");  Set h = new HashSet(); h.addAll(l); System.out.println("Size:" + l.size() + h.size()); } } What will be the output of the following code snippet?

    • A.

      Size: 64

    • B.

      Size: 44

    • C.

      Size: 66

    • D.

      Compilation error

    • E.

      Size: 46

    Correct Answer
    A. Size: 64
  • 10. 

    Consider the following code snippets: class GC2 { public GC2 getIt(GC2 gc2) { return gc2; } public static void main(String a[]) { GC2 g = GC2(); GC2 c = GC2(); c = g.getIt(c); } } How many objects are eligible for Garbage Collection?

    • A.

      Two

    • B.

      None of the objects are eligible

    • C.

      Three

    • D.

      Four

    • E.

      One

    Correct Answer
    B. None of the objects are eligible
  • 11. 

    Which of the following gives the correct sequence of execution of callback methods in a JUnit TestCase?

    • A.

      1. setUp() method 2. testXXX() method 3. tearDown() method Above sequence is for every testXXX() method in the TestCase

    • B.

      1. setUp() method 2. tearDown() method 3. All testXXX() methods

    • C.

      1. All testXXX() methods 2. setUp() method 3. tearDown() method

    • D.

      1. setUp() method 2. All testXXX() methods 3. tearDown() method

    Correct Answer
    A. 1. setUp() method 2. testXXX() method 3. tearDown() method Above sequence is for every testXXX() method in the TestCase
  • 12. 

    Consider the following code: class TM { public static void main(String a[]) { System.out.println(a[0]+a[0].length()+a.length); } } Select the valid inputs and outputs. (Choose 2)

    • A.

      Input : java TM "Trick1"+"Trick2" "Trick3" Output: Trick1+Trick2132

    • B.

      Input : java TM 'J2SE', 'J2EE', 'J2ME' Output: J2SE43

    • C.

      Input : java TM 123+456 "abc" "Tricky" Output: 57933

    • D.

      Input : java TM 'This is really tricky' Output: This is really tricky211

    • E.

      Input : java TM "123", abc+234 Output: 123,42

    Correct Answer(s)
    A. Input : java TM "Trick1"+"Trick2" "Trick3" Output: Trick1+Trick2132
    E. Input : java TM "123", abc+234 Output: 123,42
  • 13. 

    Consider the following partial code: public class CreditCard { private String cardID; private Integer limit; public String ownerName; public void setCardInformation(String cardID, String ownerName, Integer limit) { this.cardID = cardID; this.ownerName = ownerName; this.limit = limit; } } Which of the following statement is True regarding the above given code?

    • A.

      The class is fully encapsulated

    • B.

      The ownerName variable breaks encapsulation

    • C.

      The setCardInformation method breaks encapsulation

    • D.

      The cardID and limit variables break polymorphism

    • E.

      The code demonstrates polymorphism

    Correct Answer
    B. The ownerName variable breaks encapsulation
  • 14. 

    State which of the following are default delimiters?(Choose 3)

    • A.

      Form feed character

    • B.

      Tab character

    • C.

      The dollar character

    • D.

      Space character

    • E.

      The underscore character

    Correct Answer(s)
    A. Form feed character
    B. Tab character
    D. Space character
  • 15. 

    Consider the following code snippet: public class Demo extends Object { String Title; public Demo( String t ){ Title = t; } public void showTitle() { System.out.println( "Title is " + Title ); } } class DerivedDemo extends Demo { public void setTitle( String tt ) { Title = tt ; } } public class TasteIt { public static void main(String args[]) { DerivedDemo dd = new DerivedDemo(); dd.showTitle(); Which of the following option will be the output for the above code snippet?

    • A.

      Prints: "Title is null" to standard output.

    • B.

      A NullPointerException is thrown at Runtime

    • C.

      A ClassCastException is thrown at Runtime

    • D.

      Compilation Error

    Correct Answer
    D. Compilation Error
  • 16. 

    Consider the following code: package com.java.test; public class A { public void m1() {System.out.print("A.m1, ");} protected void m2() {System.out.print("A.m2, ");} private void m3() {System.out.print("A.m3, ");} void m4() {System.out.print("A.m4, ");} } class B { public static void main(String[] args) { A a = new A(); a.m1(); // 1 a.m2(); // 2 a.m3(); // 3 a.m4(); // 4 } } Assume that both of the above classes are stored in a single source file called 'A.java'. Which of the following gives the valid output of the above code?

    • A.

      Prints: A.m1, A.m2, A.m3, A.m4,

    • B.

      Compile-time error at 4.

    • C.

      Compile-time error at 3.

    • D.

      Compile-time error at 2.

    • E.

      Compile-time error at 1.

    Correct Answer
    C. Compile-time error at 3.
  • 17. 

    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[Integer] a = new ArrayList[Integer]();

    • B.

      ArrayList[WrapperType] a = new ArrayList[WrapperType]();

    • C.

      ArrayList[Integer] a = new ArrayList[Double]();

    • D.

      ArrayList[Double] a = new ArrayList[Double]();

    • E.

      ArrayList[Number] a = new ArrayList[Number]();

    Correct Answer
    E. ArrayList[Number] a = new ArrayList[Number]();
  • 18. 

    Which of the following types of driver provides maximum decoupling between database and Java application?

    • A.

      Type IV driver

    • B.

      Type II driver

    • C.

      Type I driver

    • D.

      Type III driver

    Correct Answer
    D. Type III driver
  • 19. 

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

    • A.

      Array index can be a negative value

    • B.

      String[][] s;

    • C.

      Array decaration: String[6] strarray;

    • D.

      String[][] s = new String[5][];

    • E.

      Array index can be a long value

    Correct Answer(s)
    B. String[][] s;
    D. String[][] s = new String[5][];
  • 20. 

    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.

      Prints: EQ

    • B.

      Prints: equals

    • C.

      Compile-time error: Wrapper types cannot be compared using equals

    • D.

      Prints: equals EQ

    • E.

      Compile-time error: Integer wrapper cannot accept char type

    Correct Answer
    A. Prints: EQ
  • 21. 

    Consider the following code: class One { public One() { System.out.print(1); } } class Two extends One { public Two() { System.out.print(2); } } class Three extends Two { public Three() { System.out.print(3); } } public class Numbers { public static void main(String[] argv) { new Three(); } } Which of the following will be the output for the above program?

    • A.

      3

    • B.

      No output

    • C.

      321

    • D.

      32

    • E.

      123

    Correct Answer
    E. 123
  • 22. 

    Consider the following code: public class Pass { static int j=20; public static void main(String argv[]) { int i=10; Pass p = new Pass(); p.amethod(i); System.out.println(i); System.out.println(j); } public void amethod(int x) { x=x*2; j=j*2; } } Which of the following gives the correct output for the above code?

    • A.

      Prints: 10, 40

    • B.

      Prints: 20, 40

    • C.

      Compile time Error: Method parameter does not match variable

    • D.

      Prints: 10,20

    Correct Answer
    A. Prints: 10, 40
  • 23. 

    Consider the following code: public class TH2 { public static synchronized void main(String[] args) throws InterruptedException { Thread t = new Thread(); t.start(); System.out.print("keep"); t.wait(10000); System.out.print("Smiling"); } } Which of the following gives the valid ouptut for the above code?

    • A.

      It prints keepSmiling with a 10000-second delay between keep and Smiling.

    • B.

      It prints keepSmiling with a 10-second delay between keep and Smiling

    • C.

      An exception is thrown at runtime

    • D.

      It prints keep and never exits

    • E.

      It prints keepSmiling and exits almost immeditately

    Correct Answer
    C. An exception is thrown at runtime
  • 24. 

    Consider the following program: class TestThread extends Thread { public static void main(String apps[]) { Thread t = null; TestThread tc = new TestThread(); for (int i =0;i<5;i++) { t = new Thread(tc); // Insert Code Here } } public void run() { System.out.println("Hello"); } } Which of the following code when substituted to the commented line (//Insert Code) will make the program to execute properly?

    • A.

      T.join()

    • B.

      t.start()

    • C.

      No additional code required

    • D.

      T.run()

    • E.

      T.sleep(1000)

    Correct Answer
    B. t.start()
  • 25. 

    Which of the following options give the names of the data structures that can be used for Range-View operations, but no nulls?(choose 2)

    • A.

      SortedSet

    • B.

      List

    • C.

      Map

    • D.

      Vector

    Correct Answer(s)
    A. SortedSet
    B. List
  • 26. 

    Consider the following code: class A is defined in packageone as follows: package com.packageone; public class A { private int x; public A(int x) { this(); this.x = x; } abstract void print(); } And class B is defined in packagetwo as follows: package com.packagetwo; import com.packageone.A; class B extends A { B(int x) { super(x); } void print() { System.out.println(x); } } class C { public static void main(String args[]) { A a = new B(10); } } Which of the following changes will make the code to run properly? (Choose 3)

    • A.

      Class B should be declared public abstract

    • B.

      Class A should be declared public abstract

    • C.

      The print method in class B should refer the x as super.x

    • D.

      The member x in class A should be declared as protected

    • E.

      This() method call should be removed from the class A constructor

    Correct Answer(s)
    B. Class A should be declared public abstract
    D. The member x in class A should be declared as protected
    E. This() method call should be removed from the class A constructor
  • 27. 

    Which of the following classes is used to handle the abnormal situation that may occur during database calls using JDBC API?

    • A.

      SQLException

    • B.

      Driver

    • C.

      Connection

    • D.

      DriverManager

    • E.

      Statement

    Correct Answer
    A. SQLException
  • 28. 

    Consider the following code: public class ThrowsException { static void throwMethod() { System.out.println("Inside throwMethod."); throw new IllegalAccessException("exception"); } public static void main(String args[]) { try { throwMethod(); } catch (IllegalAccessException e) { System.out.println("Caught " + e); } } } Which of the following gives the output for the above given code?

    • A.

      Compiles successfully, nothing is printed

    • B.

      Compilation Error

    • C.

      Runtime Error

    • D.

      d. Inside showMethod. followed by caught: java.lang.IllegalAccessException: exception

    Correct Answer
    B. Compilation Error
  • 29. 

    To which of the following elements, annotations can be applied? (Choose 3)

    • A.

      Classes

    • B.

      Fields

    • C.

      Jar files

    • D.

      Class files

    • E.

      Methods

    Correct Answer(s)
    A. Classes
    B. Fields
    E. Methods
  • 30. 

    Consider the following: Class A contains the following: i. Instance Block ii. main() method iii. Static Block iv. Default Constructor of A Assume an instance of class A is created in the main() method. Which of the following gives the correct sequence of execution of above mentioned elements?

    • A.

      Iii, ii, i, iv

    • B.

      Iii, i, ii, iv

    • C.

      Ii, i, iv, iii

    • D.

      I, iv, iii, ii

    • E.

      Iv, iii, ii, i

    Correct Answer
    A. Iii, ii, i, iv
  • 31. 

    Consider the following code snippet: interface InterfaceOne { int ID = 10; int getAccess(); } interface InterfaceTwo { int ID = 20; int getAccess(); } class InterfaceImpl implements InterfaceOne, InterfaceTwo { public int getAccess() { if (this instanceof InterfaceOne) { return InterfaceOne.ID; } else { return InterfaceTwo.ID; } } } public class Code { public static void main(String args[]) { InterfaceOne i1 = new InterfaceImpl(); System.out.println(i1.getAccess());  InterfaceTwo i2 = (InterfaceTwo) i1; System.out.println(i2.getAccess()); } } Which of the following will be the output for the above code snippet?

    • A.

      10 10

    • B.

      10 20

    • C.

      Compile time error. Incompatible Type conversion.

    • D.

      20 10

    • E.

      20 20

    Correct Answer
    A. 10 10
  • 32. 

    Which of the following statements is true about NavigableSet interface?

    • A.

      A SortedSet extended with navigation methods for Maps.

    • B.

      A SortedSet extended with navigation methods for Lists.

    • C.

      A new class implementation of Set which can navigate the ResultSet object

    • D.

      A SortedSet extended with navigation methods reporting closest matches for given search targets.

    Correct Answer
    D. A SortedSet extended with navigation methods reporting closest matches for given search targets.
  • 33. 

    Consider the following code: class Planet { } class Earth extends Planet { } public class WelcomePlanet { public static void welcomePlanet(Planet planet) { if (planet instanceof Earth) { System.out.println("Welcome!"); } else if (planet instanceof Planet) { System.out.println("Planet!"); } else { System.exit(0); } }  public static void main(String args[]) { WelcomePlanet wp = new WelcomePlanet(); Planet planet = new Earth(); welcomePlanet(planet); } } Which of the following will be the output of the above program?

    • A.

      The code runs with no output

    • B.

      Compilation fails

    • C.

      Welcome!

    • D.

      Planet!

    • E.

      An exception is thrown at runtime

    Correct Answer
    C. Welcome!
  • 34. 

    Consider the following code: 1. public class Boxer1{ 2. Integer i; 3. int x; 4. 5. public Boxer1(int y) { 6. x = i+y; 7. System.out.println(x); 8. } 9. 10. public static void main(String[] args) { 11. new Boxer1(new Integer(4)); 12. } 13. } Which of the following will be the output of the above program?

    • A.

      Compilation fails because of an error in line 11

    • B.

      A NullPointerException occurs at runtime

    • C.

      Prints: 4

    • D.

      A NumberFormatException occurs at runtime

    Correct Answer
    B. A NullPointerException occurs at runtime
  • 35. 

    Consider the following program: 1. class CheckedException extends RuntimeException { } 2. class UncheckedException extends Exception { } 3. public class Check { 4. public static void main(String args[]) { 5. generateException1(); 6. generateException2(); 7. } 8. 9. private static void generateException1() { 10. throw new CheckedException(); 11. } 12. 13. private static void generateException2() { 14. throw new UncheckedException(); 15. } 16. } Which of the following is true regarding the above given program?

    • A.

      No compilation error but throws RuntimeException on running the code

    • B.

      Compilation error at line 10

    • C.

      Compilation error at line 14

    • D.

      Compilation error at line 5

    • E.

      Compilation error at line 6

    Correct Answer
    C. Compilation error at line 14
  • 36. 

    Consider the following code snippet: public class TestString10{ public void print() { String s = "Hello"; StringBuffer sb = new StringBuffer("Hello"); concatinateStrings(s, sb); System.out.println(s+" "+sb); } public void concatinateStrings(String str, StringBuffer strBuff){ StringBuffer sk = strBuff; str = str + " world"; sk.append(" world"); } public static void main (String[] args) { TestString10 t = new TestString10(); t.print(); } } What will be the output of the above code snippet?

    • A.

      Hello Hello Hello

    • B.

      World Hello Hello

    • C.

      Hello Hello world

    • D.

      Hello world Hello

    • E.

      World world world

    Correct Answer
    C. Hello Hello world
  • 37. 

    Consider the following code: package test; class Target { String name = "hello"; } Which of the following options are valid that can directly access and change the value of the variable 'name' in the above code? (Choose 2)

    • A.

      Any class in the test package

    • B.

      Any class that extends Target outside the test package

    • C.

      Any class

    • D.

      Only the Target class

    • E.

      Any class that extends Target within the test package

    Correct Answer(s)
    A. Any class in the test package
    E. Any class that extends Target within the test package
  • 38. 

    Which of the following is the process of creating a new class from an existing class?

    • A.

      Polymorphism

    • B.

      Inheritance

    • C.

      Abstraction

    • D.

      Reusability

    Correct Answer
    B. Inheritance
  • 39. 

    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 intersection of s1 and s2.

    • C.

      Copies elements from s2 to s1

    • D.

      Returns true if s2 is a subset of s1

    Correct Answer
    B. Transforms s1 into the intersection of s1 and s2.
  • 40. 

    Consider the following code segment: public class ExampleThree { public static void main(String args[]) { int i = 1; // Line 1 short s = 1; // Line 2 long l = 1; // Line 3 i = l + i; // Line 4 l = s + i; // Line 5 } } Which of the following gives the line in the above program that will result in error?

    • A.

      Line 4

    • B.

      Line 7

    • C.

      Line 6

    • D.

      Line 3

    • E.

      Line 5

    Correct Answer
    A. Line 4
  • 41. 

    Which of the following pre-defined annotations requires that an annotation type should itself annotate with, in order to make the information in an user- defined annotation type appear in Javadoc-generated documentation?

    • A.

      @Override

    • B.

      @Documented

    • C.

      @Comment

    • D.

      @Deprecated

    Correct Answer
    B. @Documented
  • 42. 

    Consider there are two threads, "Thread A" and "Thread B". "Thread A" holds a lock on "Object X". "Thread B" is blocked inside a wait call on Object X. Which of the following will make the "Thread B" runnable?

    • A.

      Thread A's wait() times out.

    • B.

      Thread A releases the lock on B by calling the notifyAll()

    • C.

      Thread A is interrupted.

    • D.

      Thread B is interrupted.

    • E.

      Thread B releases the lock on object X and calls the notify() method on thread

    Correct Answer
    B. Thread A releases the lock on B by calling the notifyAll()
  • 43. 

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

    • A.

      Error objects are thrown only by JVM

    • B.

      Errors can be thrown programmatically

    • C.

      A class can extend Error class and can be used as user-defined Error class

    • D.

      Errors are handled only by JVM

    • E.

      Errors cannot be handled programmatically using try-catch blocks.

    Correct Answer(s)
    B. Errors can be thrown programmatically
    C. A class can extend Error class and can be used as user-defined Error class
  • 44. 

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

    • A.

      An object becomes eligible for garbage collection when all references denoting it are set to null

    • B.

      The automatic garbage collection of the JVM prevents programs from ever running out of memory

    • C.

      A program can suggest that garbage collection be performed but not force it

    • D.

      None of the listed options

    • E.

      Garbage collection is platform independent

    Correct Answer(s)
    A. An object becomes eligible for garbage collection when all references denoting it are set to null
    C. A program can suggest that garbage collection be performed but not force it
  • 45. 

    Which of the following statements are true regarding equals() method?(Choose 3)

    • A.

      Defined in the Object class

    • B.

      Essential for inheriting a class

    • C.

      Used for object's content comparison

    • D.

      It is polymorphic

    • E.

      Declared in the Object class

    Correct Answer(s)
    A. Defined in the Object class
    C. Used for object's content comparison
    D. It is polymorphic

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 27, 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.