0

programming languages Online Quiz - 194

Description: programming languages Online Quiz - 194
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

finalize method is used to release system resources.

  1. True

  2. False


Correct Option: A
  1. PreparedStatement

  2. ) ParameterizedStatement

  3. ) ParameterizedStatement and CallableStatement

  4. All the above


Correct Option: A

Constructors can have a return type.

  1. True

  2. False


Correct Option: B

Any class that implements the Runnable interface has to provide the implementation for the following methods public void start(); public void run();

  1. True

  2. False


Correct Option: B

A thread that has called the wait() method of an object still owns the lock of the object.

  1. True

  2. False


Correct Option: B

If you call the interrupted() method of a thread object twice the second call will always return false.

  1. True

  2. False


Correct Option: B
  1. The thread that has been waiting the longest.

  2. The thread that was the last one to to exit the monitor.

  3. You can never be sure which thread will get to run first.

  4. The the first thread that called the wait() method


Correct Option: C
  1. public Thread(Object obj)

  2. public Thread(String name)

  3. public Thread(Runnable trgt)

  4. public Thread(ThreadGroup grp, Runnable trgt, String name)

  5. public Thread(ThreadGroup grp, Object ob)


Correct Option: B,C,D

class Line { Line 1. public class Point { public int x,y; } Line 2. public Point getPoint() { return new Point(); } Line 3. } Line 4. class Triangle { Line 5. public Triangle() { Line 6. // insert code here Line 7. } 18. } Which code, inserted at line Line 6, correctly retrieves a local instance of a Point object? A. Point p = Line.getPoint(); B. Line.Point p = Line.getPoint(); C. Point p = (new Line()).getPoint(); D. Line.Point p = (new Line()).getPoint();

  1. A

  2. B

  3. C

  4. D


Correct Option: D

public class test { Line 1. public static void main(String [] a) { Line 2. assert a.length == 1; Line 3. } Line 4. } Which two will produce an AssertionError? (Choose two.) A. java test B. java -ea test C. java test file1 D. java -ea test file1 E. java -ea test file1 file2 F. java -ea:test test file1

  1. AB

  2. BC

  3. AE

  4. BE


Correct Option: D

Given a method that must ensue that its parameter is not null: Line 1. public void someMethod(Object value) { Line 2. // check for null value Line 3. System.out.println(value.getClass()); Line 4. } What, inserted at line 2, is the appropriate way to handle a null value? A. assert value == null; B. assert value !null, “value is null”; C. if (value == null) { throw new AssertionException(”value is null”); D. if (value == null) { throw new IllegalArgumentException(”value is null”);

  1. A

  2. B

  3. C

  4. D


Correct Option: D
  1. public abstract class Canine { public Bark speak(); }

  2. public abstract class Canine { public Bark speak() { } }

  3. public class Canine { public abstract Bark speak(); }

  4. public class Canine abstract { public abstract Bark speak(); }


Correct Option: B
  1. X extends Y is correct if and only if X is a class and Y is an interface.

  2. X extends Y is correct if and only if X is an interface and Y is a class.

  3. X extends Y is correct if X and Y are either both classes or both interfaces.

  4. X extends Y is correct for all combinations of X and Y being classes and/or interfaces.


Correct Option: C
- Hide questions