Best Online Tutorials

SQL Tutorial

Free SQL Tutorial

SQL Interview Questions

SQL Practice Questions

SQL Tips & Tricks

SQL Errors

SQL Books

Angular Tutorial

Free Angular Tutorial

Angular Interview Questions

Angular Practice Questions

Angular Tips & Tricks

Angular Errors

Angular Books

Node.js Tutorial

Free Node.js Tutorial

Node.js Interview Questions

Node.js Practice Questions

Node.js Tips & Tricks

Node.js Errors

Node.js Books

React.js Tutorial

Free React.js Tutorial

React.js Interview Questions

React.js Practice Questions

React.js Tips & Tricks

React.js Errors

React.js Books

SSIS Tutorial

Free SSIS Tutorial

SSIS Interview Questions

SSIS Practice Questions

SSIS Tips & Tricks

SSIS Errors

SSIS Books

SEO Tutorial

Free SEO Tutorial

SEO Interview Questions

SEO Practice Questions

SEO Tips & Tricks

SEO Errors

SEO Books

Javascript Tutorial

Free Javascript Tutorial

Javascript Interview Questions

Javascript Practice Questions

Javascript Tips & Tricks

Javascript Errors

Javascript Books

MongoDB Tutorial

Free MongoDB Tutorial

MongoDB Interview Questions

MongoDB Practice Questions

MongoDB Tips & Tricks

MongoDB Errors

MongoDB Books

Next.js Tutorial

Free Next.js Tutorial

Next.js Interview Questions

Next.js Practice Questions

Next.js Tips & Tricks

Next.js Errors

Next.js Books

Asp.Net framework Interview Questions - Part 2 

Prashant Surya  |   Mar 3, 2020  |  Views: 175
pictures

Description:

Read ASP.NET (Dot Net) framework interview questions and answers for beginners and experienced on DritalConnect

11.  What are generations in Garbage collector (Ge 0, 1 and 2)?


Generation defines age of the object . 

There are three generations:

Gen 0: When application creates fresh objects they are marked s Gen 0.

Gen 1: When GC is not able to clear the objects from Gen 0 in first round it moves them to Gen 1 bucket.

Gen 2: When GC visits Gen 1 objects and not able to clear them it moves them to gen 2.

Generations are created to improve the GC performances.

Garbage collector will spend more time on gen 0 objects rather than Gen 1 and Gen 2 thus improving the performance.


12. How do we clean unmanaged code?


Garbage collector only claims the managed code memory. For unmanaged code we need to put clean up logic manually in the destructor / finalize while coding.


13. Do using a destructor decreases the performances?


Yes, it does.

When we define a destructor , garbage collector does not collect these object in the first round.
It moves them to Gen 1 and then reclaims these objects in the next cycle.

As more objects are created in Gen 1 the performance of the application falls down because more memory is consumed. 


14. How can we clean unmanaged objects also maintaining the performance?


To do this we need to do the following steps:

Implement IDisposable interface and implement the dispose function.

In Dispose function call the "GC.SuppressFinalize" method.

At the client side ensure that the "Dispose" function is called when the objects no more required.

Finalize and Dispose Pattern:

This ensures that your objects are created in the Generation 0 rather than the Generation 1..

"GC.SuppressFinalize" tells the garbage collector to not worry about destructor and destroy the objects in the first call itself.

Class clsMyClass: IDisposable
{
~clsMyClass
{
// In case the client forgets to call
// Dispose,destructor will be invoked for Dispose (false)
        }
        protected virtual void Dispose (bool disposing)
{
if(disposing)
{
    //Free managed objects.
}
// Free unmanaged objects
}
        public void Dispose()
{
        Dispose(true);
// Ensure that the destructor is not called
GC.SuppressFinalize(this);
}
}


15.  Can we force garbage collector to run?


"Syastem.GC.Collect()" forces garbage collector to run. This is not a recommended practice but can be used when any situation Arieses.


16.  What is the difference between finalize and dispose?


Finalize is a destructor and dispose is a function which is implemented via IDisposable interface.

Finalize is non deterministic, since it's called by garbage collector. Dispose is a function and needs to be called by the client for the clean up.

Where finalize is automatically called by garbage collector while dispose needs to be called forcefully.

As a good practice finalize and dispose is used collectively because of double garbage collector loop.


17. What is CTS:


CTS - Common Type System

In .Net there are lots of languages like c#, VB.Net, VF.Net etc. There can be situations when we want code in one language to be called in other language.

In order to ensure smooth communication between these languages the most important thing is that they should have a common type system.

CTS ensures that the data types defined in two different languages get compiled to a common data type.

So, "Integer" data type in VB6 and "int" data type in C++ will be converted to System.int32, which is data type of CTS.


18. What is CLS?


CLS :  Common Language Specification

CLS is a subset of CTS.

CLS is a specification or set of rules or guidelines.

When any programming language adheres to these set of rules it can be consumed by any .Net language.

For instance one of the rule which makes your application CLS non-compliant is when you declare your methods members with same name and with only case differences in C#.

You can try this, create a simple class in C# with same name with only case differences and try to continue the same in VB.NET, it will not work.


19. What is an Assembly?


Assembly is a unit of deployment like EXE or a DLL.


20. What are the different types of assembly?


There are two types of assembly:

Private - A private assembly is normally used by a single application, and is stored in application's directory, or a sub-directory beneath.

Public - A public or shared assembly is stored in the global assembly cache, which is a repository of assemblies maintained by the .Net runtime.

Shared assemblies are needed when we want the same assembly to be shared by various applications in the same computer.



Comments:
Content Contributor
Prashant Surya

Prashant Surya

Software developer at Uniserve Data Technologies Pvt. Ltd.  |   Noida, Uttar Pradesh, India

I am a software developer, freelancer and trainer working on technologies likes. MEAN stack, MERN Stack, ASP.NET full stack , SQL, JavaScript, jQuery, HTML, CSS, SEO, responsive UI/UX designing... having 7 years of experience in development in multiple domains like, eCommerce, capital markets, education, real estate...


Want to sell your software ?-

If you want to sell your readymade software to the genuine clients or businessman, list your software with details and demo links.

  • Sell ERP
  • Sell Website Clones
  • Sell App Clones
  • Sell Readymade Portals
  • Sell Readymade Websites
  • Sell Mobile Apps
  • Sell Window Apps

Clients will find it using our advanced search filter and will contact you directly.

No any charge for the product lsiting.

Do you own a Company ?+

Property.sale

Buy or Sell Commercial Property+

Are you a freelancer ?+

Looking for a job ?+

Are you a Service Provider ?+

Are you a blogger ?+

Do you own an IT Institute ?+


Property.sale