Tag: programming languages

Questions Related to programming languages

  1. Thread class

  2. Runnable Interface

  3. Applet

  4. Throwable


Correct Option: A,B
  1. String

  2. Thread object

  3. Primitive data type variables

  4. object of a class which implements Runnable


Correct Option: A,D
  1. A thread gets a default priority

  2. cause the currently running thread to move back to runnable so that a thread of the same priority can have a chance.

  3. Guaranteed to cause the current thread to stop executing for at least the specified sleep duration

  4. Guaranteed to cause the current thread to stop executing until the thread it joins with completes


Correct Option: D
  1. A thread can acquire more than one lock

  2. Each object has just one lock.

  3. all methods in a class must be synchronized

  4. methods,variables can be synchronized,


Correct Option: A,B
  1. Obtain a thread's priority.

  2. A thread can voluntarily relinquish control.

  3. A thread can be preempted by a higher-priority thread.

  4. none of these


Correct Option: C
  1. I am a constructor of A,I am a destructor of A,I am a constructor of B,I am a destructor of B

  2. I am a constructor of A,I am a constructor of B,I am a destructor of A,I am a destructor of B

  3. I am a constructor of A,I am a constructor of B,I am a destructor of B,I am a destructor of A

  4. I am a destructor of B,I am a constructor of A,I am a destructor of A,I am a constructor of B


Correct Option: C
  1. k will display garbage values

  2. k will print 0, as default constructor is called.

  3. Error as no constructor is defined.

  4. Error, as main should precede with int and should return 0.


Correct Option: C
  1. To initialize the data members.

  2. To allocate memory for object.

  3. To initialize the member functions.

  4. To initialize the object.


Correct Option: B