Top Most .net Interview Questions Part – 6
How Can We Make A Thread Sleep For Infinite Period ?
You can also place a thread into the sleep state for an indeterminate amount of time by calling Thread.Sleep (System.Threading.Timeout.Infinite). To interrupt this sleep you can call the Thread.Interrupt method
In Which Format You Can Pass The Value In The Sleep Function?
In milliseconds
What’s Thread.sleep() In Threading ?
Thread’s execution can be paused by calling the Thread.Sleep method. This method takes an integer value that determines how long the thread should sleep. Example Thread.CurrentThread.Sleep(2000). it will paused for 2 second.
How Can You Reference Current Thread Of The Method ?
“Thread.CurrentThread” refers to the current thread running in the method.”CurrentThread” is a public static property.
What Does Addressof Operator Do In Background ?
The AddressOf operator creates a delegate object to the BackgroundProcess method. A delegate within VB.NET is a type-safe, object-oriented function pointer. After the thread has been instantiated, you begin the execution of the code by calling the Start() method of the thread
Different Levels Of Priority Provided By .net.
i)ThreadPriority.Highest
ii)ThreadPriority.AboveNormal
iii)ThreadPriority.Normal
iv)ThreadPriority.BelowNormal
v)ThreadPriority.Lowest
Is There Any Thread In Our .net Programs?
.NET program always has at least two threads running one is the main program and second is the garbage collector.
Namespace For The Thread Class?
All threading classes are defined in System.Threading namespace
Can We Have Multiple Threads In One App Domain ?
One or more threads run in an AppDomain. An AppDomain is a runtime representation of a logical process within a physical process. Each AppDomain is started with a single thread, but can create additional threads from any of its threads.
Did Vb6 Support Multi-threading ?
While VB6 supports multiple single-threaded apartments, it does not support a freethreading model, which allows multiple threads to run against the same set of data.
What Is A Thread ?
A thread is the basic unit to which the operating system allocates processor time
What Is Multi-threading ?
Multi-threading forms subset of Multi-tasking. Instead of having to switch between programs this feature switches between different parts of the same program. Example you are writing in word and at the same time word is doing a spell check in background.
What Is Multi-tasking ?
It’s a feature of modern operating systems with which we can run multiple programs at same time example Word, Excel etc.
What Is Equivalent For Regsvr32 Exe In .net ?
Regasm
How Do We Create Dcom Object In Vb6?
Using the CreateObject method you can create a DCOM object. You have to put the server name in the registry.
Can You Explain What Is Dcom ?
DCOM differs from COM in that it allows for creating objects distributed across a network, a protocol for invoking that object’s methods, and secures access to the object. DCOM provides a wrapper around COM, hence it is a backwards compatible extension.
DCOM uses Remote Procedural Calls (RPC) using Open Software Foundation’s Distributed Computing Environment.
What Is Satellite Assembly? And Steps To Create Satellite Assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
Steps to Create Satellite Assembly
a. Set the paths for resgen and al.exe:
b. Create a .resources file.
c. Create the satellite assembly.
d. The assembly should have the naming convention for .NET to be able to search for it.
e. Specify the settings for culture.
f. Put the satellite assembly in the appropriate folder.
g. Once the satellite assembly is created, physically copy it to the appropriate directory.
h. Repeat the process for each language in which you are creating an assembly.
How To Exclude A Property From Xml Serialization?
[XmlIgnore]
(use attribute on the property)
Eg:
[XmlIgnore]
public string Name
{
..
}
What Is Garbage Collector ?
Garbage collection consists of the following steps:
The garbage collector searches for managed objects that are referenced in managed code.
The garbage collector attempts to finalize objects that are not referenced.
The garbage collector frees objects that are not referenced and reclaims their memory.
What Is Difference Between Code Access And Role Based Security?
Code security is the approach of using permissions and permission sets for a given code to run. The admin, for example, can disable running executables off the Internet or restrict access to corporate database to only few applications.
Role security most of the time involves the code running with the privileges of the current user. This way the code cannot supposedly do more harm than mess up a single user account.
Neither is better. It depends on the nature of the application; both code-based and role-based security could be implemented to an extent.
What Is Cas?
The CAS security policy revolves around two key concepts-code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.
See CAS objects — Run ‘caspol -lg’ from command line.
Add CAS objects — caspol -ag 1.3
Change CAS obj — caspol -cg 1.3 FullTrust
Turn Off — caspol -s off
Can We Customize The Serialization Process?
Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field.
Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer’s [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.