21. Describe the accessibility modifier “protected internal”.  

Protected Internal variables/methods are accessible within the same assembly and also from the classes that are derived from this parent class.

22. What is the difference between Finalize() and Dispose() methods?  

Dispose() is called when we want for an object to release any unmanaged resources with them. On the other hand Finalize() is used for the same purpose but it doesn’t assure the garbage collection of an object.

23. What are circular references?  

Circular reference is situation in which two or more resources are interdependent on each other causes the lock condition and make the resources unusable.

24. What is the difference between directcast and ctype?  

DirectCast is used to convert the type of an object that requires the run-time type to be the same as the specified type in DirectCast.

Ctype is used for conversion where the conversion is defined between the expression and the type.

25. What are the modifiers in C#?  


26. Define destructors.  

A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precised by a tilde(~).

27. What is difference between constants, readonly and, static ?  

Constants: The value can’t be changed.
Read-only: The value will be initialized only once from the constructor of the class.
Static: Value can be initialized once.

28. What are the different types of statements supported in C#?  

C# supports several different kinds of statements are
Block statements
Declaration statements
Expression statements
Selection statements
Iteration statements
Jump statements
Try catch statements
Checked and unchecked
Lock statement

29. 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

30. 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.

31. 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

32. 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.

33. What is the use of goto statement?  

The goto statement is also included in the C# language. This goto can be used to jump from inside a loop to outside. But jumping from outside to inside a loop is not allowed.

34. What is the use of return statement?  

The return statement is associated with procedures (methods or functions). On executing the return statement, the system passes the control from the called procedure to the calling procedure. This return statement is used for two purposes :
to return immediately to the caller of the currently executed code
to return some value to the caller of the currently executed code.

35. What is the difference between CONST and READONLY?  

Both are meant for constant values. A const field can only be initialized at the declaration of the field. A readonly field can be initialized either at the declaration or.

36. How does C# differ from C++?  

C# does not support #include statement. It uses only using statement.
In C# , class definition does not use a semicolon at the end.
C# does not support multiple code inheritance.
Casting in C# is much safer than in c++.
In C# switch can also be used on string values.
Command line parameters array behave differently in C# as compared to C++.

37. What is a basic difference between the while loop and do while loop in C#?  

The while loop tests its condition at the beginning, which means that the enclosed set of statements run for zero or more number of times if the condition evaluates to true. The do while loop iterates a set of statements at least once and then checks the condition at the end.

38. What is a New modifier?  

The new modifier hides a member of the base class. C# supports only hide by signature.

.Net Interview Question

PHP Interview Question

Java Interview Question

AngularJS Interview Questions