# 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>
