# Interview Questions

**What is the difference between the process and thread?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What are the benefits of Multi-Threaded Programming?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**How can we create a thread in Java?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What is context-switching in Multi-Threading?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Can `main()` finishes before starting other threads?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What are the different states in the life cycle of a thread?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Can we call `run()` of thread class?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What do you understand about thread priority?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**You have thread T1, T2, and T3, how will you ensure that thread T2 runs after T1 and thread T3 runs after T2?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Can you restart a thread?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Describe synchronization in respect to multithreading?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What are memory consistency errors?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What is a deadlock?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What is liveness in concurrent programming?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What are atomic operations?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Explain different ways of using a thread?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Why would you use a synchronized block instead of a synchronized method?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What is the difference between the methods `sleep()` and `wait()`?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**How would you describe Producer-Consumer problem in Java?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**What is the difference between Callable and Runnable?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>

**Explain what is a thread pool? What are the advantages of thread pools?**

<details>

<summary>Click here to view answer</summary>

*To be updated*

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.sunilgudivada.dev/notebook/concurrency-and-multithreading/interview-questions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
