Floating FB popout byF5debug

Interview Questions and Answers on .Net Framework, OOPS, ASP.Net, C#.Net, SQL Server, WCF Series – Part 7

 

Question 61 - What is Runtime Host?

Ranging from Windows applications, Web applications to Mobile applications, CLR is designed to support various types of applications. .NET Framework provides different types of runtime hosts to manage the execution of application code(to load runtime in to process, create application domain within process, load user code in to application domain) and provides various services to the application. Runtime hosts included in .Net framework are : ASP.NET, Microsoft Internet Explorer and windows shell.


Question 62 - What is Connection Pooling?

  • A Connection Pool is a container of open and reusable connections. A Connection Pool is released from the memory when the last connection to the database is closed.
  • The Data Providers in ADO.NET have Connection Pooling turned on by default; if you need to turn it off, specify Pooling = false in the connection string being used.
  • Connection Pooling gives you an idle, open, reusable connection instead of opening a new one every time a connection request to the database is made. When the connection is closed or disposed, it is returned to the pool and remains idle until a request for a new connection comes in.
  • The pool can house connections up to the maximum limit as specified in the connection string that was used to connect to the database.
  • Advantage of using Connection Pooling is an improvement of performance and scalability
  • Disadvantage is that one or more database connections, even if they are currently not used, are kept open.


Question 63 - What are the main parameters used by Connection Pooling?

Connection Pooling is controlled and the parameters passed to a connection string comprises the following:

  • Connect Timeout
  • Min Pool Size
  • Max Pool Size
  • Pooling


Question 64 - What is Connection Pool Manager?

A Connection Pool is maintained internally by the Connection Pool Manager. When a request for a subsequent connection comes in, the Connection Pool Manager searches the pool for the availability of a free connection and returns it to the application if one is available. Connection Pools works as below

  • If any unused connection is available, it returns one.
  • If all connections are used up, a new connection is created and added to the pool.
  • If the number of connections reaches the maximum number of connections in the pool, the requests are queued until a connection becomes free for reuse.


Question 65 - What is Object Pooling?

It is something that tries to keep a pool of objects in memory to be re-used later and hence it will reduce the load of object creation to a great extent. Whenever there is a request for a new object, the pool manager will take the request and it will be served by allocating an object from the pool. Pooling basically means utilizing the resources efficiently, by limiting access of the objects to only the period the client requires it.

 

Question 66 - What are the Advantages of Object Pooling?

It minimizes the consumption of memory and the system's resources by recycling and re-using objects as and when it is needed and serving the request for new objects from the pool of ready-to-be-used objects. The objects that the application is done with (the objects are no longer needed) are sent back to the pool rather than destroying them from the memory.

According to MSDN, "Once an application is up and running, memory utilization is affected by the number and size of objects the system requires. Object pooling reduces the number of allocations, and therefore the number of garbage collections, required by an application.


Question 67 - What is the Difference between Connection Pooling and Object Pooling?

Object Pooling is great in the sense that it can optimize access to expensive resources (like file handles or network connections) by pooling them in memory and reusing them as and when they are needed.

According to MSDN, "Object pooling lets you control the number of connections you use, as opposed to connection pooling, where you control the maximum number reached."


Question 68 - What is an Indexer?

  • Indexers permit instances of a class or struct to be indexed in the same way as arrays.
  • Indexers are similar to properties except that their accessors take parameters.
  • The indexers are usually known as smart arrays in C#.
  • An indexer, also called an indexed property, is a class property that allows you to access a member variable of a class using the features of an array.
  • Defining an indexer allows you to create classes that act like virtual arrays. Instances of that class can be accessed using the [] array access operator.


Question 69 - What are the important points to remember on indexers?

  • Indexers are always created with this keyword.
  • Parameterized property are called indexer.
  • Indexers are implemented through get and set accessors for the [ ] operator.
  • ref and out parameter modifiers are not permitted in indexer.
  • Indexer is an instance member so can't be static but property can be static.
  • Indexers are used on group of elements.
  • Indexer can be overloaded.


Question 70 - What is the Difference between Indexers and Properties?

Indexers

Properties

Indexers are created with this keyword

Properties don't require this keyword

Indexers are identified by signature

Properties are identified by their names

Indexers are accessed using indexes

Properties are accessed by their names

Indexer are instance member, so can't be static

Properties can be static as well as instance members


Disclaimer – F5debug Interview Questions & Answers Series:

You may recopy extracts from these pages ("the material") to individual third parties website or to the local system internal websites for their personal information, but only if:

    You acknowledge the www.f5debug.net as the source of the material. Such acknowledgment should include reference to the www.f5debug.net in the copy of the material and should also include the words " © Karthikeyan Anbarasan, www.f5debug.net ". You inform the third party that these conditions apply to him/her and that he/she must comply with them.

About Author: Karthikeyan Anbarasan, Microsoft MVP (Most Valuable Professional) in ASP.NET/IIS Architecture. He is the Founder and Chief Editor of the www.f5debug.net website and has authored books on Windows Phone and Business Intelligence(SSIS). He is also a Passionate Speaker and a Blogger on Microsoft Technologies.

You can Join Me On: Facebook, Twitter, Google Plus, LinkedIn

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Recent Posts

Random Posts

Most Viewed

URL Shortner

Create your own short urls!!!

Site Counter

free counters

Disclaimer

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. For accuracy and official reference refer to MSDN/ TechNet. I have documented my personal experience on this blog.

Protected by Copyscape Web Plagiarism Finder

Site Meter