Skip to content

Commit 9c67b40

Browse files
author
Amogh Singhal
authored
Update Python_Programming_Quiz.md
1 parent 19527a7 commit 9c67b40

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Python_Programming_Quiz.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,18 @@ Methods | Description |
102102
- Extensive Libraries
103103
- Integration with other languages
104104
- Databases Connectivity interfaces to all commercial databases
105+
106+
#### 6. How do you remove a duplicate from a Python list ? <br>
107+
Convert the `list()` to `set()`
108+
109+
#### 7. What is the life cycle of a thread in Python ? <br>
110+
A Thread is defined in computer science as the smallest unit that can be scheduled in an operating system
111+
112+
- To create a thread, we create a class that we make override the `run` method of the thread class. Then, we instantiate it.
113+
- A thread that we just created is in the new state. When we make a call to `start()` on it, it forwards the threads for scheduling. These are in the ready state.
114+
- When execution begins, the thread is in the running state.
115+
- Calls to methods like `sleep()` and `wait()` make a thread wait. Such a thread is in the waiting/blocked state.
116+
- When a thread is done waiting or executing, other waiting threads are sent for scheduling.
117+
- A running thread that is done executing terminates and is in the dead state
118+
119+
![Life cycle of a thread](https://www.tutorialspoint.com/java/images/Thread_Life_Cycle.jpg)

0 commit comments

Comments
 (0)