Interview FAQs


FAQs of level

Reflection is a generic term that describes the ability to inspect and dmanipulate program elements at runtime. For example, reflection allows you to:

1. Enumrate the members of a type
2. Instantiate a new object
3. Execute the member of an object
4. Find out the information about a type
5. Find out the information about a assembly
6. Inspect the custom attributes applies to a type.
7. Create and compile new assembly

A thread is an independent stream of instructions in a program.


You can say - A thread is the basic unit to which the operating system alocates the processor time.

Threads are manipulated using the class "Thread", which can be found in the "System.Threading" namespace. An instance of thread represents one thred, or one sequence of execution. You can create another thread by simply instantiating another instance of thread object.

Threads execution can be paused by calling the "Thread.Sleep()" method. This method takes an integer value as its parameter that determines how long the thread should pause. the thread will simply not run for the specified time period, which also means it will not take up any processor time while it is in sleep. It will immediatly place a thread in wait state.
If a thread is aborted by using "Thread.Abort()" method, it will stop running altogether. Windows will permanently destroy all data that it maintains relating to that thread, so the thread subsequently cannot be restarted after it is aborted.
Thread.Suspend() block a thread until another thread call Thread.Resume().
Multithreading is a technique that can be used to perform time consuming tasks in a separate additional thread other than the main application thread.

When you, for example, have a time-consuming function, you may need to call this function as a response of a button click. Now, instead of freezing all your application waiting for this function to return / to finish, you can create a new thread and assign this function to. When you do this, your application interface will not be blocked and you can use it to perform other tasks. At the same time, your time-consuming task is being carried out in the background.

You can think of it as the two threads: the main one, and the newly created one. Both are running in parallel, and this improves the performance and responsiveness of your application.

Deadlock is a famous problem you can avoid simply by careful programming. To first explain what is deadlock, let us assume that we have two threads, thread 1, and thread 2. Let us assume, as well, that we have two objects, object x, and object y. If thread 1 holds a lock on object x and waits for a lock on object y, and thread 2 holds a lock on object y, and waits for a lock on object x then threads will be waiting forever! and this is what we call a deadlock situation.

To solve this, use methods for synchronization that provides a timeout ability. You can for example use "Monitor.TryEnter" with a timeout parameter, to try to obtain a lock on a certain object within a certain time interval.

Place a colon and then the name of the base class. Notice that it’s double colon in C++.
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.
PreviousDisplaying 4 of 25Next
Need Help? Contact Us.

Log in


Forgot password?


New User