Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

1. What is the main advantage of using an Executor service in Java?

View

2. Which of the following is used to create a thread pool in Java?

View

3. Which of the following is the correct way to synchronize a method?

View

4. What is the purpose of the wait() method in Java?

View

5. What does the notify() method do in synchronization?

View

6. Which keyword is used to define a critical section in Java?

View

7.What does the invokeAll() method of ExecutorService do?

View

8. Which method would you use to submit multiple tasks and wait for all to complete?

View

9. Which is the best approach for scheduling tasks to run periodically?

View

10. What does the shutdownNow() method do in the ExecutorService?

View

1. What is the main advantage of using an Executor service in Java?

It makes thread creation simpler
It provides automatic thread pooling and management
It removes the need for synchronization
It guarantees thread safety

2. Which of the following is used to create a thread pool in Java?

ExecutorService
ThreadPoolExecutor
Executor
All of the Above

3. Which of the following is the correct way to synchronize a method?

synchronized public void methodName() {}
public synchronized void methodName() {}
synchronized method void methodName() {}
public method synchronized void methodName() {}

4. What is the purpose of the wait() method in Java?

To pause the execution of a thread
To allow a thread to wait for a condition to be true before proceeding
To release the lock on a synchronized object
All of the Above

5. What does the notify() method do in synchronization?

Wakes up all waiting threads
Wakes up a single thread that is waiting on the object’s monitor
Stops the current thread
It notifies the JVM to stop all threads

6. Which keyword is used to define a critical section in Java?

volatile
synchronized
atomic
concurrent

7.What does the invokeAll() method of ExecutorService do?

Executes all tasks concurrently
Executes the tasks sequentially and waits for all to finish
Returns a list of futures for asynchronous task execution
Cancels all tasks in the queue

8. Which method would you use to submit multiple tasks and wait for all to complete?

invokeAny()
submitAll()
invokeAll()
executeAll()

9. Which is the best approach for scheduling tasks to run periodically?

Using ExecutorService
Using ThreadPoolExecutor
Using ScheduledExecutorService
Using Executor

10. What does the shutdownNow() method do in the ExecutorService?

It gracefully shuts down the executor and cancels all pending tasks
It cancels all tasks, including currently executing ones
It immediately terminates the executor
It does nothing