Loading...

Dot Net Interview Questions and Answers

by GangBoard Admin, December 6, 2018

In case you’re searching for Dot Net  Interview Questions and answers for Experienced or Freshers, you are at the correct place. There is parcel of chances from many presumed organizations on the planet. The Dot Net advertise is relied upon to develop to more than $5 billion by 2020, from just $180 million, as per Dot Net industry gauges. In this way, despite everything you have the chance to push forward in your vocation in Dot Net Development. Gangboard offers Advanced Dot Net  Interview Questions and answers that assist you in splitting your Dot Net interview and procure dream vocation as Dot Net Developer.

Best Dot Net Interview Questions and Answers

Do you believe that you have the right stuff to be a section in the advancement of future Dot Net, the GangBoard is here to control you to sustain your vocation. Various fortune 1000 organizations around the world are utilizing the innovation of Dot Net to meet the necessities of their customers. Dot Net is being utilized as a part of numerous businesses. To have a great development in Dot Net work, our page furnishes you with nitty-gritty data as Dot Net prospective employee meeting questions and answers. Dot Net  Interview Questions and answers are prepared by 10+ years experienced industry experts. Dot Net Interview Questions and answers are very useful to the Fresher or Experienced person who is looking for the new challenging job from the reputed company. Our Dot Net Questions and answers are very simple and have more examples for your better understanding.

By this Dot Net Interview Questions and answers, many students are got placed in many reputed companies with high package salary. So utilize our Dot Net Interview Questions and answers to grow in your career.

Q1)What is Inheritance?

Derived class inherits the member of  base class is called inheritance. Its one object have all the properties and behaviors of its parent object. Using inheritance we can reuse the code.  We can achive single level and multi level inheritance.

public class Employee
{
public float salary = 400;
}
public class Programmer: Employee
{
public float bonus = 100;
}
class TestInheritance{
public static void Main(string[] args)
{
Programmer p1 = new Programmer();
Console.WriteLine("Salary: " + p1.salary);
Console.WriteLine("Bonus: " + p1.bonus);
}
}

Q2)What is the Generic and non generic collections?

Two types of collections is there one is generic collection another one is non generic collection.

Generic Collection:

We can group one type of object in single collection is called generic collection. Here we dont need to convert particular type like string, int, etc.

Non Generic Collection:

We can group any type of object in single collection is called non generic collection. Here we need to convert particular type like string, int,etc., otherwise we will face issue in run time.

Q3)What are the non generic collections?

  • Array List
  • Sorted List
  • Stack
  • Queue
  • Hashtable
  • Bit Array

Q4) What is a Constructor?

It’s a method which have same name as class or struct name.  It’s called automatically at the time of object creation.

Q5) What are the types of constructors?

  • Default Constructor
  • Parameterized Constructor
  • Copy Constructor
  • Static Constructor
  • Private Constructor

Q6) What is String Builder? Which one Preferable string or String Builder?

String Builder is a dynamic object. Its allow number of characters in string. Its does not create a new object in memory.

StringBuilder sb = new StringBuilder(“Hi Team!!”);

We can prefer StringBuilder. Beacuse it performs faster than string when appending multiple string values.

Q7) What is Anonymous Functions?

Function without name is called Anonymous functions. Two types of anonymous functions.

  • Lambda Expressions
  • Anonymous Methods

Q8) What is Reflection?

It is a process to get metadata of a type at runtime. Few classes for reflection are below,

  1. Type
  2. Assembly
  3. Assembly Name

Q9) What is Abstract Class?

Its declared as abstract. It can have abstract and non-abstract methods. It cannot be instantiated. Its implementation must be provided by derived classes.

Q10) What is Sealed?

Its a restrictions of class and methods. Sealed class cannot be derived and Sealed method cannot be overridden.

Q11) What is Method overriding?

Derived class define same method as defined in base class. Its need to use virtual keyword with base class method and override keyword with derived class method.

public class Sample{
public virtual void message(){
Console.WriteLine("Hi Welcome");
}
}
public class SampleTwo: Sample
{
public override void message()
{
Console.WriteLine("Hello");
}
}
public class TestOverriding
{
public static void Main()
{
SampleTwo d = new SampleTwo();
d.message();
}
}

Q12) What is Encapsulation?

Its wrapping data into a single unit.

class Employee
{
public string ID { get; set; }
public string Name { get; set; }
}
class example
{
static void Main(string[] args)
{
Employee employee = new Employee();
employee .ID = "1";
employee .Name = "Anbu";
Console.WriteLine("ID = "+employee .ID );
Console.WriteLine("Name = "+employee .Name );         }
}

Q13) What are the filters in MVC?

  • Authentication
  • Authorization
  • Result
  • Action
  • Exception 

Q14) How we can use multiple model in Single view?

We can use multiple model in Single view using below things,

  • View Data
  • View Bag
  • Tuple
  • Dynamic Model
  • View Model

Q15) Major reasons to select dotnet framework to develop software?

It has rich GUI controls, secured, integrated with many Microsoft applications, scalability and stability, support many programming languages, rich SOLID principals, portable, it supports various architectures and design patterns, easy to maintain and deploy.

Q16) Reasons behind the top Enterprise applications are built on dotnet framework?

Easiest way to code with a powerful IDE (Visual studio), with better flexibility, rich development community, no compromise with the security, top deploying solution with Microsoft azure cloud integration.

Q17)Ways to achieve redirection from one page to other page in webforms

Page processing can be transferred from one page  to other page with the help of server.transfer without making a post back to the browser. Redirection of the page from another page can be achieved with the help of response.redirect which perform a post-back to the client browser.

Q18)How to make thread safe with collections.

By using the SynchronizedCollection<T> has a built-in synchronization object which can be used to make collection thread-safe, and this can be used for specific requirement.

Q19)What is the best approach to use collections in multi-threaded applications?

Immutable collection take a different approach in making collections thread-safe. As concurrent collections use synchronization locks instead, immutable collections can’t be changed after they are created. Automatically it makes them safe to use in multi-threaded scenarios since there’s no way for another thread to modify them and make the state inconsistent. This design decision definitely affects the API of immutable collection classes. They don’t even have public constructors.

Q20)What are Honest method or pure method?

Honest method is a function whose output depends on its input parameters and that does not have any side effects. Which means that a pure method cannot mutate an argument, cannot read or mutate global state, cannot read the system timer, cannot read or write file contents, cannot read from or write to the console, etc.

Q21)Why C# is a type safe language?

C# discourages or prevents data type errors, the data type error is un-desirable program behavior caused by variation between differing datatype for the program variables, constants and functions this is the reason behind C# a type safe language.

Q22)C# Types and type member signatures

The System.Object type is CLS compliant and it is base type of all object types in the .NET Framework type system. Inheritance in the .NET Framework is either implicit (for example, the String class implicitly inherits from the Object class) or explicit (for example, the CultureNotFoundException class explicitly inherits from the
ArgumentException class, that is explicitly inherited from the Exception class. For a derived type to be a CLS compliant, its base type must also be CLS compliant.

Q23)Intrinsic types which are not CLS Compliant in .net framework

The following intrinsic types are not CLS-Compliant.
SByte – 8-bit signed integer data type, TypedReference – Pointer to an object and its runtime type, Uint16 – 16-bit unsigned integer, Uint32 – 32-bit unsigned integer, Uint64 – 64-bit unsigned integer, UintPtr – Unsigned pointer or handle.le.

Q24)What are dynamic views.

Views that don’t declare a model type using @model but that have a model instance passed to them (for example, return View(Address)) can reference the instance’s properties dynamically. The feature offers flexibility, but it doesn’t offer compilation protection or IntelliSense. If the property doesn’t exist, then webpage generation fails at run-time.

Q25)Purpose of Generics.

Generic types to maximize code re-usability, type safety, and performance. The main common use of generics is to create collection classes. The .NET Framework class library contains many new generic collection classes in the System.Collections.Generic namespace. These can be used whenever possible instead of classes such as ArrayList in the System.Collections namespace. We can create our own generic interfaces, classes, methods, events and delegates. Generic may be constrained to enable access to methods on data types. The information on the types that are used in a generics data type may be obtained at run-time by using reflection.

Q26)What are delegates.

In .NET Framework delegates provide a late binding mechanism. it means which we create an algorithm where the caller also supplies at least one method that implements part of the algorithm. Consider sorting a list of stars in an astronomy program. we may choose to sort those stars by their distance from the earth, or the magnitude of the star, or their perceived brightness.

Q27)Explain the life cycle of a Winforms in .net?

The following steps are involved in the life cycle of the winforms in .net

Load: When the form is loaded in into application.

Activate: When the form gets focused when it loads for the first time.

Deactivate: When the form is not focused or minimized or sent to background.

Closing: Before closing the application, this functionality is invoked.

Closed: When application is closed.

Disposed of: Garbage collection performs once the application is closed.

Q28)How can we get the information from the form of a Dialog Box

By using the Form.ParentForm property of the dialog box we can access the public members of the form. And we can explicitly convert the reference returned by the ParentForm property to appropriate type.Below code will help us to demonstrate the ParentForm property to access a property from the form.

public void GetParent()
{
string x = ((Form1)this.ParentForm).Text;
}

Q29)How can we implement singleton design pattern in C#?

In The singleton design pattern, only one Instance of a class will be created and will be used to provide access point globally

Below code will demonstrate the Singleton Design Pattern in C#

public sealed class Singleton
{
private static readonly Singleton obj = new Singleton();
}

Q30)what are the commonly used exceptions in .Net?

OutOfMemoryException, ArithmeticException, NullReferenceException, OverflowException, InvalidOperationException, ArgumentException, DivideByZeroException,

IndexOutOfRangeException, InvalidCastException, IOEndOfStreamException, ArgumentOutOfRangeException, ArgumentNullException, StackOverflowException and so on

Q31)What are constructor overloading?

Defining multiple constructors with the same name within the same class but with different arguments in different sequence can be said as constructor overloading.

Q32) What are constructor chaining?

When a class constructor is invoking another class, constructor is called as constructor chaining. Base() can be used as constructor chaining.

Q33)Why we have “Main()” method as static method?

When we run the application the CLR will invoke Main(). If the Main() is a instance method it requires object. To succeed this, Main() method is defined as static method.

Q34)What is language In-dependency? Is dot NET language independent technology?

Dot Net will support multiple languages. When developing an application using dot net languages we can use another dot net language component.

Ex – When we develop C# dot Net application we can use vb.net component. As well as when we develop VB.Net application we can use C# dot Net component. Because of this reason dot net is independent technology.

Q35)What is Ispostback? When we will use Not Ispostback?

IsPostBack is the property of the web Page class which is used to determine whether the page is posted back from the client.  Whenever we don’t want to execute the code within the load event, then the page load event fires then we will use (!IsPostBack)

Q36)What is AutopostBack? when we will set Autopostback=true?

Autopostback is the property of the controls. If you need a control to post back automatically when an event is raised, we need to set the AutoPostBackproperty of the control as True.

Q37)How can we convert client-side control as server-side control? How can we convert server-side control as client-side control?

Yes. We can convert Client-side control as server-side control by adding an attribute runat= server But, we cannot convert server-side control to client-side control

Q38)When we will go for multiple web.config files?

Whenever we need to define some separate settings for couple of web pages, we can create a new folder and we can add those couple of web pages to that folder and we should add a new Web.config file to that new folder and we can define separate settings within that Web.config

Q39)What is the importance of machine.config? How many machine.config files can we have?

Machine.Config file, this file specifies the settings that are global to a particular system, Machine.config file is used to configure the application according to a

system. That is, configuration done in machine.config file is affected on any application that runs on a system. Usually, this file is not altered. We can have only one machine.config file in a system.

Q40)What are the main advantages and disadvantages of inproc session?

Advantages of Inproc Session are as follows

  1. Accessing the inproc session data will always be faster.
  2. It is always good for small web applications

Disadvantages of Inproc session are as follows

  1. It we restart the web server or if any crashes to the web server there is a chance of losing the session data.
  2. If the session data is increased there is a burden on the web server, it will affect the performance of web server and web application.
  3. It is not suitable for large web application models like web-garden and web-farm.

Q41)What are the Asp.Net page cycle stages?

There are overall 8 stages for any webpage in Asp.Net which will undergo within server at page life cycle.

1) Page Request

2) Start

3) Page Initialization

4) Load

5) Validation

6) PostBack Event Handling

7) Rendering

8) Unload

Q42)What is enum? What is the default data type of enum?

Enum is a value type. Enum is a collection of constants which means it is a collection of string constants which are representing collection of integer constants. Int is the default data type of enum.

Q43)How Can we pass 2 different type values to generic function?

We can pass 2 different type values to generic collection. Please find the below code which demonstrates

Class MyClass
{
Internal static void print <T, K> (Ta, Kb)
{
}
}
Class program
{
public static void Main ()
{
MyClass.print<int, string>(05,"Besant");
Console.ReadLine ();
}
}

Q44)How to send a thread for sleep?

By using Thread.sleep(), we can send a thread to sleep according to the given time. Sleep () method can be blocked the current thread for the specified number of milliseconds. In other words We can include specific time via thread.sleep() method as follows.

Thread.Sleep (TimeSpan.FromHours (1)); // sleep for 1 hour

Thread.Sleep (1000); // sleep for 1000

Q45)What are the different types of literals in dotnet

Boolean literals: False or True are literals of the boolean type which map to the 0 and 1 state, respectively. Integer literals: Interger is used to have values of types Int, ulnt, long, and ulong. Real literals: Real is used to have values of types float, double, and decimal. Character literals: character represents a single character and usually consists of a character in single quotes, such as ‘a’. String literals: Dotnet supports 2 types of string literals, regular string literal and verbatim string literals. A regular string consists of zero or more characters within the double quotes, such as “543234”. A verbatim string literal is of an @ character followed by a double–quote character, such as @”This is litrals”. The Null literal: Represents the null–type.

Q46)Can I declare a method as sealed?

No, In C# a method cannot be declared as sealed. But when we override a method in a derived class, we can declare the overridden method as sealed. By declaring it as sealed, we can avoid further overriding of the sealed method.

Q47)Suppose we need a certain ASP.NET function to be executed on mouse-over over a certain button or textbox. Where do we add an event?

Each web control has an ability to add the attributes on client side that will execute on client side and run a client-side script like a JavaScript function.

Ex – btnSubmit.Attributes.Add (“onMouseOver”,”someClientCode();”)

TextBox.Attributes.Add(“onFocus”,”ClearText();”)

Q48)What does a keyword using works for?

Using is a convention or a short-cut method which allows us to access the classes in a namespace by referencing it on top of the class. whenever we need to use the classes or methods from the namespace, we can avoid typing the entire namespace hierarchy.

Q49)What is Method Hiding in C#?

If the child class don’t want to use methods from the base class, child class can implement its own version of the same method with same signature. For example, in the classes below, Pipedrive () is implemented in the child class with same signature. This can be called as Method Hiding.

class Car
{
public void TypeOfDrive()
{
Console.WriteLine("Right Hand Drive");
}
}
class Ford : Car
{
public void TypeOfDrive()
{
Console.WriteLine("Right Hand ");
}
}

Q50) Can we create custom exception in dotnet. And How can we create?

Yes, Custom Exception class is nothing but a user defined class which is derived from System Exception class. Below are the steps, Custom class can be derived from System Exception class. By Creating a constructor of custom class with error message parameter and we can pass it to the base class (System Exception class). Then throw and catch custom exception message in try-catch block in code wherever it is required.

Q51) What is strongName in Assembly?

When you create the assembly name in gacutil , that will be create the unique name where you can deploy in the Gac util . It will also help out it with two different version of assembly.

Q52)  What is diferent types of Action result in MVC?

View ,PartialView ,File,Redirect,Content,Json and redirectToRoute. This help to achieve the different set of actionresult in MVC . It will implement in the controlaction method and in order to achieve these method.

Q53)  What is purpose of cookeis

It will the stored information on the local machine or client machine , where the user access the webpage in the system .

Q54) Why we should avoid autopost back in asp.net ?

This autopost back will taken  care by the asp.net server , in turn automatically hits the server and performance action . It will reduce of performance of applications.

Q55) Why we should avoid the roundtrip action in net

When the user has access request and made to the system , so the request will go from client to server and go back from server to client , thus making to and for action in the system.

Q56) How do you know the default viewstate is enable or not?

By default the view state has been enabled. In order to disable the view state by specifying the property at header level.

Q57) What is the specific features in web service?

The web service will able to support for multiple platforms and different languages and it will able to exchange the data with different system.

Q58) What is data type for int,string,varchar

Bigint – 8 bytes

Int – 4 bytes

smallInt- 2 bytes

TinyInt –  1 bytes

Q59) What is maximum of datelength varchar in the sql server

8000 datelength

Q60) What is the purpose of recursive stored procedure

It can be achieved by reclusive method stored procedure by calling  recrusive in built stored procedure

Q61) When you should use sql profiler and what is the purpose of sql profiler.

It is used to capture the trace of the sql query log as background process in the table and database engine.

Q62) Can we variable across all the session in the sql server?

Yes, by using the global variable across all the session

Q63) What is the use of constraints in the SQL server

This constraints nothing but it will rule to enforce the rule on the table, like null constrinats , referential constriants , primarykey  constriaints . If any of these rull will violate the rule , it will throws as error message.

Q64) Can we linked to another sqlserver from different sql server?

It can be connected by using the linked server properties.

Q65) Do you know anything about the sql server agent and what is the use of sql server agent?

It will help to performance the administration activities like job scheduler, which run on daily actives for pulling the records

Q66) Can we check the logs in the table and what the action will performed ?

By using command sp_lock

Q67) When you will use authentication and authorization?

Authentication will identify the username and password and the process of identity. Authorization are used to granting the access to the user  based on identity and allowing the specific access to the application .

Q69) What will be default timeout for cookies ?

The duration would be 30 minutes.

Q69) Which properties you will use tag hyperlink in the datagrid ?

Asp:Hyperlink

Q70) How many programming language will .net support , please mention in below

VB.Net,C#,Cobel,F#,perl . As per recently release it will support 44 languages

Q71) What kinds of event handlers in the global asax files ?

These event handler are available in the global asax file are mention in below:

Application_start,application_end,session_start,session_end

Q72) What is the use of custom validator in asp.net

The custom validator can written by use logic in both server and client side application

Q73) How will manage the session in asp.net and what are object can be used to access the application?

Viewstate,Querystring,Cookies,Session and application

Q74) Whether the webapplication will run without web.config in asp.net application?

Yes. It will be run in .net application .

Q75) Can we add the files in the app_code folder files?

The file should be same language , that will be supported.

Q76) Which protocol will support webservice ?

Only Http protocol will support.

Q77) Could please explain about the webconfig and machine config ?

Webconfig are used to confrigue the webapplication and machine config are used to confrigure the machine or server system .

Q78) Explain about the cross page posting in .net application and why so it important ?

When you submit the page with different domain or different url ,actually it will goes from one domain into another domain .

 Q79) What do you mean by strong type and weak type

The code will complie are used to checked at the compile time is called strong type. The Weak type will compile at the runtime of program .

Q80) What will be application setting in web.config file?

It will use to specific settings in the db connection string.

Q81) What are object avaibable in Ado.net ?

Dataset,DataReader,DataAdapter,Command,Connection

Q82) Why we should try and catch block in .net?

In order to handle .net exception, instead of throwing exception, it will catch and log the error message in the system.

Q83) Why we should use “Using” in c# ?

It will automatically take the dispose of object for unmanaged application , when we are using ado.net object while implementing the methodology.

Q84) How constant and read only will be different from each other?

Const cannot change the value and even latter module also.

Readonly constant can be change at the runtitme .

Q85) What is the main principle of oops in .net ?

Inheritance,Encapsulation,Polymorphism and Abstraction are used to achieve the core principle of object oriented language.

Q86) What is new features in asp.net 2017

It will support in all operating system like windows,MAC and linux environment

Q87) How will achieve the fetch data from database without any postback .

It can be achieved by jquery library.

Q88) How you will increase the performance of application in .net application and what are criteria will be consider while preparation of design of application .

Implementation of caching, Disabling the view state, implementation of stored procedure, Implementation of design patterns , creation of non-clustered index on table which frequently accessing the tables, creation of pagination (instead of avoiding  all the data in single page)

Disposing the object of unmanaged code.

Q89) Explain about the method overriding

Public Class Parent{
Public void mymethod()
{
  Console.Write(“Parent Class”);
}
}
Public Class Child:Parent {
Public void override mymethod()
{
   Console.write(“Child Class”)
}
}
  //Just overring the implementation in child class
Static void Main()
{
   Parent  objParent = new Parent()
   objParent.Mymethod(); // Output : Parent Class
   Child objChild = new Child();
   objChild.MyMethod(); // Output : Child Class    
 }

Q90) Explain about the method overloading

Public  class  Mycalcuation
{
Private int a;
Private int b;
Private int c;
Public int Add(int a,int b)
{
Return a+b;
} 
Public int Add(int a,int b,int c)
{
 Return a+b+c;
}
} 
Static void Main()
{
 MyCalculation objCalc= new MyCalculation();
ObjCalc.Add(2,3)  // It will call first method Add which has two argument
ObjCalc.Add(2,3,4) // It will call Second method Add which has three argument eventhough it has same name
}

Q91) When you will go for Webapi or WCF service .

If you want any service wants to support multiple platform like http and tcp id based , then we will go for WCF service , because same service will exposed with different service, whereas the webapi will support only http based protocol.

Q92) what is CLR ?

When you are write the program in any language like c#,vb.net,F# , that language will be convert into micrsoft intermediate language , that will further convert into target machine , these operation will be performed by CLR.  It has consider as heart of .net framework which take care of allocation memory , compilation of code and deallocation of memory.

Q93) What is Garbage collector ?

Whenever object of memory was not disposed properly, the Garbage collector will be automatically disposed the object by checking whether the object had reference in the memory or not. These Garbage collectors will keep on checking the memory with specific span of time

Q94) What is the advantages in MVC compare to asp.net

Separation of module for each task like UI,Buiness logic and data compare to asp.net and easy to maintain. Test module with separate of test case.

Q95) What is difference between string and string builder

String a =”GangBoard”;
String b =”Online Training”
 Stirng C = a + b    -> it will create three separate memory in the Heap 
Whereas
Stringbuilder s = new stringbuilder();
s.append(“GangBoard”);
s.append(“Online Training”);-> It will create single instance memory in the Heap

Q96) How to replicate the production issue in UAT or Dev , for fixing the bugs and what will be approach ?

Try to understand the client navigate page in the application and similarly steps should be followed in order to reproduce this issue

Q97) What is boxing and unboxing

Boxing is used convert value to reference type. For example

Int x =10
Object x = (object) x;   //converting the integer to object type.
Object Myclass;
MyClass =87;
Int y = (Int )y;

Q98)Can sealed class can be inherited?

Public class sealed ParentClass {
Public void Method1()
{
}
 }
Public class MyChildClass: ParentClass  -> It will throw the error due to sealed class , it will allow to inherited in the child class
{
   Public Void Method2()
  {
  } 
}

Q99) How will debug the jQuery value in the browser and how will follow steps up

By using the developer tools and specifying the debugger in the browser tools and debugs by step by steps.

Q100) For specific age property in the application, which data type you will use

Byte -> 0 to 128 and without negative , whereas the integer have –negative and positive value as data range.

Related Post

No Comments


Leave a Reply

Your email address will not be published Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

Online Training Quick Enquiry






Get Free Online training