You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Question 7. Write difference between Process and Thread.
161
161
162
-
A process is an instance of a program that is being executed by one or many threads. A thread is a lightweight, independent unit of execution that exists within a process. Each thread has its own program counter, stack, and local variables. Threads within the same process share the same memory space and can communicate with each other easily, while threads in different processes have separate memory spaces and must use inter-process communication (IPC) mechanisms to communicate. In short, a process is a program in execution, while a thread is a single execution sequence within that process.
162
+
A process is an instance of a program that is being executed by one or many threads.
163
+
164
+
A thread is a lightweight, independent unit of execution that exists within a process. Each thread has its own program counter, stack, and local variables. Threads within the same process share the same memory space and can communicate with each other easily, while threads in different processes have separate memory spaces and must use inter-process communication (IPC) mechanisms to communicate.
165
+
166
+
In short, a process is a program in execution, while a thread is a single execution sequence within that process.
163
167
164
168
### Question 8. Write differences between let, const and var.
165
169
166
170
In JavaScript, var, let, and const are used to declare variables.
167
171
172
+
#### var
173
+
168
174
var is the oldest way to declare a variable in JavaScript. It is function-scoped, which means that a variable declared with var is only accessible within the function it was declared in, or if it is declared outside of any function, it is accessible throughout the entire script. Variables declared with var can be reassigned new values.
169
175
176
+
### let
177
+
170
178
let is similar to var, but it is block-scoped. This means that a variable declared with let is only accessible within the block it was declared in. Variables declared with let can be reassigned new values.
171
179
180
+
### const
181
+
172
182
const is also similar to let, but it is used to declare variables that cannot be reassigned new values after they are initialized. A variable declared with const is also block-scoped, so it can only be accessed within the block it was declared in.
173
183
174
184
In summary, var is function scoped, let and const are block scoped, let can be reassigned and const can not be reassigned.
175
185
176
-
### Question 9. Give 1 example of each operator with expected output
186
+
### Question 9. Give one example of each operator with expected output
0 commit comments