1.What is lambda expression?
ans:representing method defination by using simple expression is called as lambda expression
2.What are the different types of lambda expressions?
ans:there are two types of lambda expressions
a)predicate:a lambda expression which is designed to return either true or false
b)Projection:a lambda expression which is designed to return other than true and false
3.where we can find use of lambda expression?
ans:While working with LINQ(Language integrated Query)
4.What is delegate?
ans:-delegate is reference type which can represent a method
-delegate object can contain reference of method
-we can get reference of method by using method name
5.what is the use of delegate?
ans:-by using delegate we can invoke a method dynamically with the help of reference of method
-delegate is usefull to attach eventhandler to event
-delegate is required while working with lambda expressions
6.What is an event?
ans:it is action done by user that can be identified by OS or application
7.What is EventHandler?
ans:it is piece of code that is executed for an event
8.How to attach an eventHandler to event?
ans:EventHandler can be attached to event by using delegate
9.What is var keyword?
ans:it is introduced from C# 3.0.with the help of var keyword we can declare a local variable or method variable
-Var type variable can not be passed as parameter to a Method
-Var type variable must be initialized during declaration itself
-var type variable should not be initialized with null but it can contain reference of object
10.What is the advantage of var type variable?
-no burden of boxing and unboxing
-Type safty can be achived
11.Where can we find useage of var type variable?
-We can find usage of var type variable while working with LINQ
12.Can We create an object with out defining class?
-yes.From c# 3.0,we can find this fecility.According to object initialization appropriate class be generated by compiler which is called as annonymous type
13.What is an extension method?
-a method which is defined to extend functionality of existing datatype is called as extension method
-it is introduced from c#3.0
14.What are the rules need to be followed to define extension method?
-Method must be defined as static
-it must be defined in static class
-parameter passed must be of respective datatype
-parameter must be preceded by this keyword
15.what is AppDomain?
-it is temporary memory block maintained by CLR for .net application
-By default one appdomain will be maintained which is called as default appdomain
-Programmer can define his own appdomain according to requirements
16.What is advantage of appdomain?
-Appdomains are programmable
-Independent of Operating System
17.Is it possible to have direct communication between appdomains?
-no,each appdomain is maintained by CLR in locked mode
-to have communication between two application domains we need to make use of remoting or WCF
18.What is Thread?
-Thread is a piece of code that can be executed parallely with another piece of code with in same process
19.Difference b/w out and ref parameters?
-out parameter is write only variable inside method
-out parameter must be preceded by out keyword
-out parameter need not be initialized while passing it method
ref:
-it is read/write variable inside method
-it must be preceded by ref keyword
-it must be initialized while passing it to method
20.What is property and its advantage?
-it is member of class or struct which provides fexible mechnism to read or write from and to a variable of class or structure
-it encapsulate process of read and write from and to the variable of class or structure
21.What perpose of params keyword?
-params keyword is used specify array of parameters to method
-we can overload a method for same type of parameters with the help single method defination
22.Can we pass default values to arguments to the method?
-yes ,it is possible from c#3.0
23.Difference between abstract class and interface?
Abstract class:
------------------
-it is partially unimplemented
-complete abstraction not possible
-Constructors are allowed
-Datamembers are allowed
-Object can not be created
-access modifiers are allowed in abstract class,by default private will be considered
Interface
-----------
-it is fully unimplemented
-Complete abstraction is possible
-Constructors are not allowed
-Datamembers are not allowed
-Access modifiers are not allowed for members of interface,by default each member will be public
-Object can not be created for interface
24.What is th base keyword?
-base keyword is used to access base class members in derived class
-base keyword is used to invoke base class constructors from derived class constructor
25.What is difference b/w struct and class?
structure:
--------------
-struct is valuetype
-struct does not all default constructor
-struct does not allow protected access modifier
-struct does not allow destructor
-Inheritance is not possible in struct
-Virtual and abstract methods are not allowed in structure
class:
-----------
-class is reference type
-all access modifiers are allowed
-inheritance is possible
-all constructors are allowed
-any type of method is allowed
-Destructor is allowed
26.what is static constructor and when it will be invoked?
-We can define constructor as static
-It must be parameterless
-Access modifiers are not allowed
-only static variables can be initialized
-static constructor is invoked one only once when class has been loaded into appdomain by class loader
27.Where u find the implementation of inheritance ?
-we need to make use of inheritance in each and every implementation of .net applications.Every class will be derived from System.Object
28.what is the this?
-this is a predefined reference variable which can contain reference of current object
-when formal parameter names and instance variable names are same then instance variables can be differed from parameters by using this
29.Is the filesystem is part of CLR or not?
-no ,clr is not responsible for file system management.
- it is the responsibility of OS to deal with filesystem management
30.What is the serialization?
-serialiazation is the process of converting object content into required form with out distrubing state of object
31.What is the deserialization?
-It is process of constructing object back from given format with distrubing state of object
32.What is the formatter?
-Formatter is a program which provide fecility to perform serialization and deserialization
33.What are different formatter available with .net framework?
-.net framework provides different predefined formatters
a)Soap formatter
b)Binary formatter
c)XmlFormatter
34.Where can u find usage of serialization and deserialization concept?
-we find usage of serialization and deserialization while working with distributed technologies like remoting,wcf and webservices
35.Can we use this in static method?
-no,this can not be used with static method
36.Why Main() must be defined as static method?
-we can start the programm execution with out creating object of class where Main() is defined.Since global objects are not allowed in c#
37.Can we define Main() with in struct?
- yes,we can define main method with in structure
38.Is IL language is OO language?
-no
39.What is the assembly?
-it is self described,language independent,portable,reusable software component which is created based on CLI Specifications
40.What is PE file?
-An assembly with win32 header which is independent of processor is called as PE file
41.How to convert assembly into PE file?
-it can be done by using a tool called ilasm.exe
42.What is the difference between Encapsulation and class?
-Encapsulation is OO concept,where as class is feature of c# languge by which we can implement encapsulation
43.What is abstraction and how to implement complete abstraction in C#?
-abstrction is nothing but hiding complete implementation details
-in c# we can implement complete abstraction by using interface
44.What is dll hell problem?How to avoid it?
-In Win32 programming all dlls of all applications are copied to System32 folder of OS.So that dll of one application may be overwritten by dll of another application if dlls are with same name
-Due to uninstallation one application may effect dlls of another application when shared dlls are used
-We can overcome this problem by using assemblies and GAC
45.What strong name key?
-it is private /public key pair which is created based on RSA algorithm
46.What is the perpose of privte key of strong name key file?
-Private key usefull to form digital signature which required while installing assembly in GAC
47.What is the perpose of public key of strong name key file?
-Public key token is usefull to identify assembly in GAC
48.What are the different types of assemblies?
-There are two categories of assemblies
-private assembly:An assembly with out strong name key is treated as private assembly
-public assembly:an assembly with stong name key and installed to GAC is called as public assembly
49.How to generate stongname key file?
-by using a tool called sn.exe
50.What is digital signature?
-Digital signature is combination of private key and Hash algorithm value
51.What are the disadvantages of private assembly?
-Memory will be wasted
-it is maintained as integral part application,so that changes made to assembly will not be reflected to application until recompilation
52.What are the advantages of public assembly?
-There is no memory wastage
-Assembly is refered by application dynamically ,if changes are made to assembly automatically those changes are reflected with out recompilation
53.What is the manifest?
-it provides complete metadata of assembly
54.What are the different parts of asembly?
-Win32 header
-CLR Header
-Manifest
-ILCode
-Other options
55.How to see the header information of assembly?
-By using a tool called dumpbin.exe
56.What are the different parts of version number?
<Major>:
<Minor>:
<Build>:
<revision>:
57.What is new operator?
-new operator will allocate memory dynamically on managed heap.if allocation of memory is successfull then it will return reference of memory block,otherwise it will return null
-if base class member and derived class member is same then derived class member can be precceded by new
58.What is managed heap?
-The part of heap which is under the control of clr is called as managed heap
59.What is the difference between managed code and unmanaged code?
-A piece of code which can make use services provided by clr is called as managed code or safe code
-A piece of code that can make use of services provided by os directly is unmanaged code or unsafe code
60.What are the differences between array and arraylist?
-Array
--------
-Array is typed collection
-size of array is fixed
-it is represented by using System.Array
-No burden of boxing and unboxing
-ArrayList:
------------
-it is untyped collection
-Size is dynamically increased
-it is represented by System.Collections.ArrayList
-Extra burden of boxing and unboxing
61.What are the differences between arraylist and List?
ArrayList:
------------
-It is non generic collection
-Extra burden of boxing and unboxing
List:
-------
-it is a generic collection
-No burden of boxing and unboxing
62.What is difference between hashtable and sorted list?
-Both collections are used to maintain disctionary,where data is stored in the form of key,value pairs.
-In hash table keys are taken randomly where in sorted list key will be ascending order
0 comments:
Post a Comment