Você está na página 1de 14

DotNet Generic

Number: 1
Heading: .NET Generic
Question: What is CLR?
Answer: The CLR is the execution engine for .NET framework applications.
Comments:
Level: SE/SSE/TL

Number: 2
Heading: .NET Generic
Question: What are the services provided by CLR?
Answer: Code Management, Application Memory Isolation, Verification of type
safety, Native code conversion, Managing memory for objects, Enforcement
of CAS (Code Access Security), Exception handling, Interop (COM and
Win32), Profiling, Debugging
Comments: Answer may not necessarily contain all the info.

Level: SE/SSE/TL

Number: 3
Heading: .NET Generic
Question: What is CTS?
Answer: Commom Type System. This is the range of types that .NET runtime (CLR)
understands.
Comments:
Level: SE/SSE/TL

Number: 4
Heading: .NET Generic
Question: What is CLS?
Answer: Commom Language Specification. This is the subset of CTS, which all .NET
languages must support.
Comments:
Level: SE/SSE/TL

Number: 5
Heading: .NET Generic
Question: What is advantage of CLS?

Compiled By rsonidotnet@yahoo.com Page 1 of 14


DotNet Generic

Answer: The idea is that any program which uses CLS complaint can interoperate
with any .NET program written in any other language. For example,
allowing a VB.NET class to derive from a C# class.
Comments:
Level: SE/SSE/TL

Number: 6
Heading: .NET Generic
Question: What is MSIL?
Answer: Microsoft Intermediate Language. All .NET source code is converted to IL
code after compilation. The IL is converted to native code at the point where
the software is installed, or runtime by Just-In-Time Compiler.
Comments:
Level: SE/SSE/TL

Number: 7
Heading: .NET Generic
Question: What is “managed”code?
Answer: All the code that target CLR is mananged code i.e instance (or) object
management is taken care by the CLR through Garbage Collection.
Comments:
Level: SE/SSE/TL

Number: 8
Heading: .NET Generic
Question: What is an Assembly?
Answer: An assembly is described as logical unit, which can be DLL or EXE, consists
.NET Framework types as well as resources(bitmaps, etc). Assemblies can be
static or dynamic.
Comments:
Level: SE/SSE/TL

Number: 9

Heading: .NET Generic

Question: What is Metadata?

Compiled By rsonidotnet@yahoo.com Page 2 of 14


DotNet Generic

Answer: Apart from containing Types, an assembly also contains information about
the types itself such as name, fields and methods and its parameters of the
types. This is called metadata.
Comments:
Level: SE/SSE/TL

Number: 10
Heading: .NET Generic
Question: What is Manifest?
Answer: An assembly may also contain references to their assemblies. These
resources, types and references are described in a block called manifest.
Comments:
Level: SE/SSE/TL

Number: 11
Heading: .NET Generic
Question: What is an AppDomain?
Answer: An AppDomain can be thought of as a lightweight process. Multiple
Appdomains can coexist inside a Win32 Process. The primary purpose of the
Appdomain is to isolate an application from other application.
Comments:
Level: SE/SSE/TL

Number: 12
Heading: .NET Generic
Question: What is Garbage Collection?
Answer: Garbage Collection is a service provided by CLR, which take responsibility
for managing lifetime of objects, and heap memory they occupy.
Comments:
Level: SE/SSE/TL

Number: 13
Heading: .NET Generic
Question: What is tool provided by MS to view IL?
Answer: ILDASM can be used to view the metadata and IL for an assembly.
Comments:

Compiled By rsonidotnet@yahoo.com Page 3 of 14


DotNet Generic

Level: SE/SSE/TL

Number: 14
Heading: .NET Generic
Question: How can I access the Win32 API from .NET Framwork?
Answer: We can access using P/Invode (Process Invoke) machanism.
Comments:
Level: SE/SSE/TL

Number: 15
Heading: .NET Generic
Question: Can we access COM components from .NET Framwork?
Answer: Yes, we can access COM from .NET using RCW (Runtime Callable Wrapper).
Comments: Answer may not necessarily contain the word “RCW”.
Level: SE/SSE/TL

Number: 16
Heading: .NET Generic
Question: Can we access .NET components from COM?
Answer: Yes, we can access .NET from COM using CCW (COM Callable Wrapper).
Comments: Answer may not necessarily contain the word “CCW”.
Level: SE/SSE/TL

Number: 17
Heading: .NET Generic
Question: Can we access COM components from .NET Framwork?
Answer: Yes, we can access COM using RCW (Runtime Callable Wrapper).
Comments: Answer may not necessarily contain the word “RCW”.
Level: SE/SSE/TL

Number: 18
Heading: .NET Generic
Question: What is Side-by-Side execution?
Answer: It is the ability to run multiple versions of the same assembly
simultaneously on the same machine or even in the same process.
Comments:
Level: SE/SSE/TL

Compiled By rsonidotnet@yahoo.com Page 4 of 14


DotNet Generic

Number: 19
Heading: .NET Generic
Question: What are the different CLR hosts provided .NET Framework?
Answer: ASP.NET, MS Internet Explorer, Shell Executables
Comments:
Level: SE/SSE/TL

Number: 20
Heading: .NET Generic
Question: What are the different Security mechanisms available in .NET?
Answer: ASP.NET Web Application Security, Code Access Security and Role
Based Security
Comments:
Level: SE/SSE/TL

Number: 21
Heading: .NET Generic
Question: What is non-deterministic destruction?
Answer: GC offers no guarantees about the time when an object will be destroyed
and managed heap will be reclaimed.
Comments:
Level: SE/SSE/TL

Number: 22
Heading: .NET Generic
Question: Is the lack of deterministic destruction problem in .NET?
Answer: Its definitely a problem that affects component design. If you have
objects that maintain expensive or scarce resources (ex: file handles, db
conn, etc), we need to provide some way for the client to inform the
object to release the resources. IDispose can be used for this purpose.
Comments:
Level: SE/SSE/TL

Number: 23
Heading: .NET Generic
Question: What is the default namespace that gets imported in every .NET
program? & Why?

Compiled By rsonidotnet@yahoo.com Page 5 of 14


DotNet Generic

Answer: System namespace. This is where the root class System.Object of .NET
BCL is present. All user defined classes implicitly derived from this
class.
Comments:
Level: SE/SSE/TL

Number: 24
Heading: .NET Generic
Question: What are the different common namespaces available in .NET
Framework?
Answer: System, System.Text, System.Collections, System.IO, System.Diagnostics,
System.Xml, System.Reflection, etc.
Comments:
Level: SE/SSE/TL

Number: 25
Heading: .NET Generic
Question: What is Serialization?
Answer: It is a process of converting an object into a stream of bytes.
Deserialization is the opposite process of creating an object from the
stream of bytes.
Comments:
Level: SE/SSE/TL

Number: 26
Heading: .NET Generic
Question: Does the .NET have built-in support for serialization?
Answer: There are two separate mechanisms provided by .NET class library,
XmlSerializer for XML based serialization and
SoapFormatter/BinaryFormatter for run-time based serialization.
Comments:
Level: SE/SSE/TL

Number: 27
Heading: .NET Generic
Question: I want to serialize my class. Which should I use? XmlSerializer,
Soap/Binary formatter?

Compiled By rsonidotnet@yahoo.com Page 6 of 14


DotNet Generic

Answer: It depends. XmlSerializer has severe limitations such as the requirement


that the target class has a parameterless constructor, and only public
read/write fields can be serialized. Xml Serialization is most suitable for
cross-platform work.

Soap/Binary formatters have fewer limitations like they can serialize


private fields. There are some issues like when deserialization the target
class’s constructer wont get invoked.
Comments:
Level: SE/SSE/TL

Number: 28
Heading: .NET Generic
Question: What are attributes?
Answer: There are two types of attributes. The first is metadata attribute; it allows
some data to be attached to the method/class/field. This data becomes
part of metadata for the type and can be accessed via reflection.

The other type is context attribute. Context attributes provide an


interception machanism whereby intance activation and method calls
can be pre/post processed.
Comments:
Level: SE/SSE/TL
Number: 29
Heading: .NET Generic
Question: What are the types of assemblies?
Answer: Private Assemblies, Shared Assemblies and Satellite assemblies
Comments:
Level: SE/SSE/TL

Number: 30
Heading: .NET Generic
Question: What are the differences between private and shared assemblies?
Answer: A private assembly is normally used by a single application and is stored
in the application’s directory, or a sub-directory beneath. A shared
assembly is normally stored in Global Assembly Cache.

The runtime enforces versioning constraints only on shared assemblies


and not on private assemblies.
Comments:
Level: SE/SSE/TL

Compiled By rsonidotnet@yahoo.com Page 7 of 14


DotNet Generic

Number: 31
Heading: .NET Generic
Question: What are requirements for an assembly to store in GAC?
Answer: The assembly should be a strongly named assembly. A strong name
consists of assembly’s identity – its simple name with out extension,
four-part version number, culture info if provided, plus a public key and
digital signature.
Comments:
Level: SE/SSE/TL

Number: 32
Heading: .NET Generic
Question: What are the ways to install an assembly into GAC?
Answer: One is to use Windows Installer. It is recommened way of doing on the
production environments. Other way is to use “gacutil” provided by
.NET framework. “gacutil” should not be used in production
environments.
Comments:
Level: SE/SSE/TL
Number: 33
Heading: .NET Generic
Question: What is Code Access Security?
Answer: CAS is a part of .NET Security model that determines whether or not a
piece of code is allowed to run, and what resources it can use when
running.
Comments:
Level: SE/SSE/TL

Number: 34
Heading: .NET Generic
Question: How does CAS work??
Answer: The CAS 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 permissions specified in named
permission set.
Comments:
Level: SE/SSE/TL

Compiled By rsonidotnet@yahoo.com Page 8 of 14


DotNet Generic

Number: 35
Heading: .NET Generic
Question: Who defines CAS code groups??
Answer: Microsoft defines some default ones, but we can modify and even create
our own. To see the code groups defined on your system, run “caspol
–lg” from command prompt.
Comments:
Level: SE/SSE/TL

Number: 36
Heading: .NET Generic
Question: Who defines CAS code groups??
Answer: Microsoft defines some default ones, but we can modify and even create
our own. To see the code groups defined on your system, run “caspol
–lg” from command prompt.
Comments:
Level: SE/SSE/TL

Number: 37
Heading: .NET Generic
Question: How do I read from a Text file?
Answer: First use System.IO.FileStream to open a file. Then we can use
StreamReader class to read the file line by line. Finally close the stream.
Comments:
Level: SE/SSE/TL

Number: 38
Heading: .NET Generic
Question: How do I write to a Text file?
Answer: We can write to a file using StreamWriter.
Comments:
Level: SE/SSE/TL

Number: 38
Heading: .NET Generic
Question: How do I read/write binary files?
Answer: Similar to text files, except wrap the FileStream object with
BinaryReader/BinaryWriter object.

Compiled By rsonidotnet@yahoo.com Page 9 of 14


DotNet Generic

Comments:
Level: SE/SSE/TL

Number: 39
Heading: .NET Generic
Question: Are Regular Expression supported in .NET? What is the namespace of
Regular Expressions?
Answer: Yes. We have to use System.Text.RegularExpressions namespace.
Comments:
Level: SE/SSE/TL

Number: 40
Heading: .NET Generic
Question: What types of arrays supported by .NET? How do you declare an array?
Answer: Single-dimentional, Multi-dimentional and Jagged Arrays
System.Int32[] ints; //declare
Ints = new System.Int32(100); //create
Comments:
Level: SE/SSE/TL

Number: 41
Heading: .NET Generic
Question: What types of arrays supported by .NET? How do you declare an array?
Answer: Single-dimentional, Multi-dimentional and Jagged Arrays
System.Int32 [] ints; //declare
Ints = new System.Int32 (100); //create
Comments:
Level: SE/SSE/TL

Number: 42
Heading: .NET Generic
Question: If you define a method that is to return a reference to an array and that
array has no elements in it, then would you return “null” or a reference
to array with zero elements in it??
Answer: Return zero-length array, because it simpliflies code that a developer
calling must write. Ex:
Appts [] appts = GetAppts ();
for(Int32 i = 0; i = appts.Length; i < 1)
{}
Comments:
Level: SSE/TL

Compiled By rsonidotnet@yahoo.com Page 10 of 14


DotNet Generic

Number: 42
Heading: What are Delegates? How to use them?
Question: Delagtes is a way to implement callback machanism in .NET. The
advantage of .NET Delegates is that it is type-safe.

public void delegate add(int a, intb);


Answer:
Comments:
Level: SE/SSE/TL

Number: 43
Heading: How do I spawn a thread?
Question: Create an instance of System.Threading.Thread object, passing it an
instance of ThreadStart delegate that will be executed on a new thread.

Thread thrd = new Thread ( new ThreadStart(somefnref) );


rhrd.Start();

Answer:
Comments:
Level: SSE/TL

Number: 44
Heading: How do I use the thread pool?
Question: By passing an instance of a WaitCallback delegate to the
ThreadPool.QueueUserWorkItem method:

ThreadPool.QueueUserWorkItem (new WaitCallback (somefunref));


Answer:
Comments:
Level: SSE/TL

Compiled By rsonidotnet@yahoo.com Page 11 of 14


DotNet Generic

Number: 45
Heading: How do I prevent concurrent access to my data?
Question: Each object has a concurrency lock (critical section) associated with it.
The System.Threading.Monitor.Enter/Exit methods are used to acquire
and release the lock.
Class c
{
public void f()
{
try
{
Monitor.Enter(this);
}
finally
{
Monitor.Exit(this);
}
}
(OR) simply you could use the “lock” keyword.
Class c
{
public void f()
{
lock(this)
{
}
}
}
Answer:
Comments:
Level: SSE/TL

Number: 46
Heading:
Question: What is a collection? What are the generic collections available in .NET?
Answer: A collection is a set of similarly typed objects grouped together. The
Array, ArrayList, Hashtable, SortedList, Queue, Stack are the generic
collections available in .NET.
Comments:
Level: SSE/TL

Compiled By rsonidotnet@yahoo.com Page 12 of 14


DotNet Generic

Number: 47
Heading:
Question: What is an enumerator? How to use them?
Answer: It is an object that iterates through its associated collection. An
enumerator can be associated with only one collection, but a collection
can have multiple enumerators.

You can use either use “IEnumerable.GetEnumerator” or simple can use


“foreach” to loop through collection.
Comments:
Level: SSE/TL

Number: 48
Heading:
Question: What is boxing and unboxing?
Answer: Boxing is the process of converting a value type to a reference type. It has
some overhead. Unboxing is the reverse process of converting reference
type to value type.
Comments:
Level: SE/SSE/TL

Number: 49
Heading:
Question: What is Reflection and its purpose?
Answer: Reflection namespace allow you to obtain information about loaded
assemblies and types within them, such as classes, interfaces and value
types. You can also create type instances at runtime using reflection and
also can invoke and access them.
Comments:
Level: SSE/TL

Number: 50

Compiled By rsonidotnet@yahoo.com Page 13 of 14


DotNet Generic

Heading:
Question: An instance of System.Text.String is immutable? What does it mean?
Answer: It is immutable because its value can’t be modified once it has been
created. Methods that modify instances of String actually return new
String instances.

We have to use StringBuilder class if it is necessary to actually modify


the contents of a string like object.
Comments:
Level: SE/SSE/TL

Compiled By rsonidotnet@yahoo.com Page 14 of 14

Você também pode gostar