Dotnet interview questions for experienced-Part3

 

part3
For experienced Dotnet developer their are more chances to ask deep and more questions. So how much ever possible will try to cover all in this series.

1. What are all access modifiers in C# language?

Access modifiers are their to implement encapsulation in C#. This will define the scope of a member of a class or type of class itself.

Public

Private

Protected

Internal

Protected Internal


2. Define the scope of all access modifiers?

Public:This members have no restriction everywhere you can access public members.

Private: It is specific to a class it defined in. by default all class members are private.

Protected: It is accessible with in class and the classes that are inherited from this class.

Internal: It is accessible with in the current project assembly it defined in.

Protected Internal: It is accessible with in the current project assembly and the classes that are derived from this assembly. All the derived classes have the access to this members.


3. Difference between abstract class and interface?

Abstract class                                                  Interface

Abstract class is partially implemented . Interface contains only definition.

All members by default not public                 All members by default public

Abstract class don't support Multiple             Interface support Multiple inheritance

inheritance                                                  

It can be fully or partially implemented         It should be implemented fully.


4. Difference between function and Stored procedure and SQL Server?

Function                                                          Stored Procedure

It's mandatory to return a value                        It is optional to Stored Procedure

It support input parameters only                 It supports input and output parameters

We cannot call Stored Procedure                     We can call a function in stored procedure

in a function                          

Exception Handling we cannot                         We can implement Exception Handling

implement  

5. What is the difference between "Break" and "Continue" statement?

Break will exit the loop and go to next statement after the loop. Where as continue will just skip the iteration of the loop and executes next value in the iteration.


6. How to get the values in first List which are not their in second list of strings?

for example:

var example1= new List<string>()

                    {

                        "New York",

                        "London",

                        "Mumbai",

                        "Chicago"                    

                    };

var example2= new List<string>()

                    {

                        "New York",

                        "Kolkatta",

                        "Mumbai",

                        "Kochi"                    

                    };

//To get "London","Chicago"

var finalList= example1.Except(example2).ToList();


7. What is the difference between dll and exe files in C#?

DLL                                                                                         Exe

Dynamic linked library                                                  Executable files

No entry point and it cannot run on its own                  Have entry point and run on its own.

This will be linked to application dynamically                  This itself is an application

at run time


8. What is Parsing?

A parsing operation converts a string that represents a .NET base type into that base type. 

For example, a parsing operation is used to convert a string to a floating-point number or to a date-and-time value. 

The method most commonly used to perform a parsing operation is the Parse method.

Example for DateTime Parsing:

string dateInput = "Jan 1, 2021";

var parsedDate = DateTime.Parse(dateInput);

Console.WriteLine(parsedDate);      


9. What is Delegate?

Delegate is function pointer. It is a reference type. it holds a reference (pointer) to a function (method). It is type safe. Delegates are mainly used for the event handling and the callback methods.


10. What is Caching?

It is a way of storing frequently used data in memory so that when ever we need we can take it from memory instead of server request for data. This will increase the application performance.


Thanks for Reading.     

Please find my previous blogs in this series.

Part1 

Part2                               

Post a Comment

0 Comments