Tag: programming languages

Questions Related to programming languages

What is the signature of the constructor of a thread class?

  1. Thread(Runnable threadob,String threadName)

  2. Thread(String threadob, Runnable threadName)

  3. Thread(Runnable threadob,ArrayList threadName)

  4. Thread(ArrayList threadob,String threadName


Correct Option: A
Explanation:

To solve this question, the user needs to know the syntax and signature of the constructor of the Thread class in Java.

The constructor signature for the Thread class is:

Thread(Runnable threadob, String threadName)

This constructor creates a new thread object with the specified name and the given runnable object.

Now, let's go through each option and explain why it is right or wrong:

A. Thread(Runnable threadob, String threadName): This option is correct as it matches the signature of the Thread class constructor.

B. Thread(String threadob, Runnable threadName): This option is incorrect because the order of the parameters is reversed, and the first parameter is of type String, which is not valid for the Thread constructor.

C. Thread(Runnable threadob, ArrayList threadName): This option is incorrect because the second parameter should be of type String, not ArrayList.

D. Thread(ArrayList threadob, String threadName): This option is incorrect because the first parameter should be of type Runnable, not ArrayList.

Therefore, the answer is:

The Answer is: A

Which of the following are true about the Error and Exception classes?

  1. Both classes extend Throwable.

  2. The Error class is final and the Exception class is not.

  3. The Exception class is final and the Error is not.

  4. Both classes implement Throwable.


Correct Option: A

The run() method should necessary exists in class created as subclass of thread?

  1. True

  2. False


Correct Option: A
Explanation:

To solve this question, the user needs to have knowledge about the Thread class and its methods.

The Thread class is a built-in class in Python that is used to create new threads of execution. A thread is a lightweight process that runs concurrently with other threads in a process.

When creating a subclass of the Thread class, the run() method is the method that is executed when the start() method is called on an instance of the class. The run() method contains the code that will be executed in the new thread.

Therefore, the run() method is necessary in a class created as a subclass of Thread class.

The answer is: A. True.

Which of the following is not a wrapper class?

  1. String

  2. Integer

  3. Boolean

  4. Character


Correct Option: A
  1. JOB

  2. EXEC

  3. STEP

  4. PROC

  5. None of the above


Correct Option: A
Explanation:

To solve this question, the user needs to know the basics of JCL (Job Control Language) used in Mainframe systems.

The statement used to mark the beginning of a job and assign a name to the job is the JOB statement.

A. JOB: This option is correct. The JOB statement is used to mark the beginning of a job and assign a name to the job.

B. EXEC: The EXEC statement is used to execute a program or procedure within a job, not to mark the beginning of the job.

C. STEP: The STEP statement is used to define a unit of work within a job, not to mark the beginning of the job.

D. PROC: The PROC statement is used to define a procedure, which can be called from within a job using the EXEC statement, but it is not used to mark the beginning of the job.

E. None of the above: This option is incorrect because the correct answer is A.

Therefore, the answer is: A. JOB