QuizzesCallable and Future — Concept Check
intermediate
java

Callable and Future — Concept Check

Questions on Callable and Future. Callable returns a result and can throw checked exceptions; Future represents the pending result of an async computation.

8 minutes 8 questions Pass at 70%
Time Limit
8 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

8 questions on Callable and Future — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer submits a Callable task to an ExecutorService but the task takes too long to complete. What should they do to handle this situation?

    • ARely on ExecutorService to automatically cancel long tasks
    • BInvoke Future.cancel() immediately after submission
    • CUse Future.get() without a timeout and wait indefinitely
    • DUse Future.get() with a timeout and cancel if it exceeds
  2. 2.You have a Callable task that throws an exception during execution. What happens when you call Future.get()?

    • AIt silently fails without any indication
    • BIt throws an ExecutionException wrapping the original exception
    • CIt returns null indicating an error occurred
    • DIt retries the task until it succeeds
  3. 3.A FutureTask is used to wrap a Callable and is run on a new Thread. What is a key benefit of this approach?

    • AIt allows the task to be both Runnable and Future
    • BIt automatically retries the task if it fails
    • CIt guarantees the task will run faster
    • DIt prevents the task from being cancelled
  4. 4.You use invokeAll() with a list of Callables, but one task throws an exception. What is the result?

    • AinvokeAll() retries the failed task automatically
    • BAll tasks complete, and you handle exceptions individually
    • COnly the successful tasks return results
    • DAll tasks stop executing immediately
  5. 5.A developer uses invokeAny() with multiple Callables. What result do they get?

    • AThe result of the first successfully completed Callable
    • BThe result of the last Callable to complete
    • CAn exception if any Callable fails
    • DThe combined results of all Callables
  6. 6.What happens if you call Future.get() on a cancelled task?

    • AIt returns null
    • BIt waits indefinitely for a result
    • CIt throws a CancellationException
    • DIt retries the task automatically
  7. 7.You submit a Callable to an ExecutorService and immediately call Future.get(). What is a potential issue?

    • AThe result is always null
    • BThe call blocks until the result is available
    • CThe task is cancelled before it starts
    • DThe task runs twice
  8. 8.What is a key difference between Callable and Runnable?

    • ARunnable can throw checked exceptions
    • BCallable can return a value and throw checked exceptions
    • CCallable cannot be used with ExecutorService
    • DRunnable can return a value but not throw exceptions