Questions Related to technology

Multiple choice technology programming languages
  1. Line 46 will compile if the enclosing method throws a TestException.

  2. Class A will not compile.

  3. Line 46 will compile if enclosed in a try block, where TestException is caught

  4. Line 45 can throw the unchecked exception TestException.

Reveal answer Fill a bubble to check yourself
A,C Correct answer
Multiple choice technology programming languages
  1. The default constructor initializes method variables.

  2. The default constructor has the same access as its class.

  3. The default constructor invoked the no-arg constructor of the superclass.

  4. If a class lacks a no-arg constructor, the compiler always creates a default constructor.

  5. The compiler creates a default constructor only when there are no other constructors for the class.

Reveal answer Fill a bubble to check yourself
B,C,E Correct answer
Multiple choice technology programming languages
  1. Explicitly setting myA to null marks that instance to be eligible for garbage collection

  2. Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.

  3. Any call on tryIt() causes the private instance of A to be marked for garbage collection.

  4. There are no instanced of A that will become eligible for garbage collection.

Reveal answer Fill a bubble to check yourself
A,B Correct answer