0 comments

.Net Interview Questions Part-3

                                          .Net Interview Questions

41.What are value types and reference types?

Value types are stored in the Stack.
Examples : bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short, strut, uint, ulong, ushort.

Reference types are stored in the Heap.
Examples : class, delegate, interface, object, string.

42. What is the difference between string keyword and System.String class?

String keyword is an alias for Syste.String class. Therefore, System.String and string keyword are the same, and you can use whichever naming convention you prefer. The String class provides many methods for safely creating, manipulating, and comparing strings.

43. What are the two data types available in C#?

Value type
Reference type

44. What are the different types of Caching?

There are three types of Caching:

Output Caching: stores the responses from an asp.net page.

Fragment Caching: Only caches/stores the portion of page (User Control)

Data Caching: is Programmatic way to Cache objects for performance.

45. What is the difference between Custom Control and User Control?

Custom Controls are compiled code (Dlls), easier to use, difficult to create, and can be placed in toolbox. Drag and Drop controls.

Attributes can be set visually at design time. Can be used by Multiple Applications (If Shared Dlls), Even if Private can copy to bin directory of web application add reference and use. Normally designed to provide common functionality independent of consuming Application.

User Controls are similar to those of ASP include files, easy to create, can not be placed in the toolbox and dragged - dropped from it. A User Control is shared among the single application files.

46. What is methods?

A method is a member that implements a computation or action that can be performed by an object or class. Static methods are accessed through the class. Instance methods are accessed through instances of the class.

47. What is fields?

A field is a variable that is associated with a class or with an instance of a class.

48. What is events?

An event is a member that enables a class or object to provide notifications. An event is declared like a field except that the declaration includes an event keyword and the type must be a delegate type.

49. What is literals and their types?

Literals are value constants assigned to variables in a program. C# supports several types of literals are

Integer literals
Real literals
Boolean literals
Single character literals
String literals
Backslash character literals

50. What is the difference between value type and reference type?

Value types are stored on the stack and when a value of a variable is assigned to another variable.

Reference types are stored on the heap, and when an assignment between two reference variables occurs.

51. What are the features of c#?

C# is a simple and powerful programming language for writing enterprise edition applications.
This is a hybrid of C++ and VB. It retains many C++ features in the area statements,expressions, and operators and incorporated the productivity of VB.

C# helps the developers to easily build the web services that can be used across the Internet through any language, on any platform.

C# helps the developers accomplishing with fewer lines of code that will lead to the fewer errors in the code.

C# introduces the considerable improvement and innovations in areas such as type safety,versioning. events and garbage collections.

52. What are the types of errors?

Syntax error
Logic error
Runtime error

53. What is the difference between break and continue statement?

The break statement is used to terminate the current enclosing loop or conditional statements in which it appears. We have already used the break statement to come out of switch statements.

The continue statement is used to alter the sequence of execution. Instead of coming out of the loop like the break statement did, the continue statement stops the current iteration and simply returns control back to the top of the loop.

54. Define namespace?

The namespace are known as containers which will be used to organize the hierarchical set of .Net classes.

55. What is a code group?

A code group is a set of assemblies that share a security context.

56. What are sealed classes in C#?

The sealed modifier is used to prevent derivation from a class. A compile-time error occurs if a sealed class is specified as the base class of another class.

57. What is the difference between static and instance methods?

A method declared with a static modifier is a static method. A static method does not operate on a specific instance and can only access static members.

A method declared without a static modifier is an instance method. An instance method operates on a specific instance and can access both static and instance members. The instance on which an instance method was invoked can be explicitly accessed as this. It is an error to refer to this in a static method.

58. What are the different types of variables in C#?

Different types of variables used in C# are :

static variables
instance variable
value parameters
reference parameters
array elements
output parameters
local variables

59. What is meant by method overloading?

Method overloading permits multiple methods in the same class to have the same name as long as they have unique signatures. When compiling an invocation of an overloaded method, the compiler uses overload resolution to determine the specific method to invoke.

60. What is parameters?

Parameters are used to pass values or variable references to methods. The parameters of a method get their actual values from the arguments that are specified when the method is invoked. There are four kinds of parameters: value parameters, reference parameters, output parameters, and parameter arrays.

                                   .Net Interview Questions Part-2
 
Toggle Footer
Top