Showing posts with label Freshers. Show all posts
Showing posts with label Freshers. Show all posts

Interview Questions for freshers part -2



Q1)difference between array and stack
Ans)
There are two main differences between an array and a stack. Firstly, an array can be multi-dimensional, while a stack is strictly one-dimensional. Secondly, an array allows direct access to any of its elements, whereas with a stack, only the 'top' element is directly accessible; to access other elements of a stack, you must go through them in order, until you get to the one you want
------------------------------------------
Q2)Suppose you have a DataTable having 100,000 rows and 50 columns. Now you've create array of perticular column values, how will you do that?
Ans)
It's simple.
for C#
object[] arr = Array.ConvertAll(dataTable.Select(), (DataRow r) => r[]);
for VB
dim arr as Object() = Array.ConvertAll(Of DataRow, Object)(dataTable.Select(), Function(r as DataRow) r());
------------------------------------------------------------
Q3)Can we assign values to read only variables?if yes then how?
Ans)
yes, we can assign values to read only variables either at a time of declaration or in constructors
-------------------------------------------------------------------
4)Difference between Abstract class and interface?
Ans)
1.Through the abstract class we cannot achieve the multiple inheritance in c-sharp. while by interface we can.
2. We can declare the access modifier in abstract class but not in interface. Because by default everything in interface is public
-----------------------------------------------------------------------
5)You can derive an abstract class from another abstract class. In that case, in the child class it is optional to make the implementation of the abstract methods of the parent class....!
Ans)
Select from following answers:
True
False
No Idea
True
If the derived class is also an abstract class then it is not mandatory to implement the abstract method of the parent class.
-------------------------------------------------------------------------------
6)Can you prevent a class from overriding ?
Ans)Yes you can prevent a class from overriding if you define a class as "Sealed " then you can not inherit the class any further.
------------------------------------------------------------------
7)What is the difference between N-layer and N-tier architecture?
Ans)
N-layers of application may reside on the same physical computor(same tier) and the components in each layer communicates with the components of other layer by well defined interfaces.Layered architecture focuses on the grouping of related functionality within an application into distinct layers that are stacked vertically on top of each other.Communication between layers is explicit and loosely coupled.With strict layering, components in one layer can interact only with componentsin the same layer or with components from the layer directly below it.
The main benefits of the layered architectural style are:
Abstraction,Isolation, Manageability, Performance, Reusability, Testability.
N-tiers architectue usually have atleast three separate logical parts,each located on separate physical server.Each tier is responsible with specific functionality.Each tier is completely independent from all other tier, except for those immediately above and below it.Communication between tiers is typically asynchronous in order to support better scalability.
The main benifit of tier achitecture styles are
1.Maintainability. Because each tier is independent of the other tiers, updates or changes can be carried out without affecting the application as a whole.
2.Scalability. Because tiers are based on the deployment of layers, scaling out an application is reasonably straightforward.
3.Flexibility. Because each tier can be managed or scaled independently, flexibility is increased.
4.Availability. Applications can exploit the modular architecture of enabling systems using easily scalable components, which increases availability.

Interview Questions for freshers


1)What is CDN and how jQuery is related to it?
Ans)
CDN - It stands for Content Distribution Network or Content Delivery Network.

Generally, a group of systems at various places connected to transfer data files between them to increase its bandwidth while accessing data. The typical architecture is designed in such a way that a client access a file copy from its nearest client rather than accessing it from a centralized server.

So we can load this jQuery file from that CDN so that the efficiency of all the clients working under that network will be increased.

Example :

We can load jQuery from Google libraries API

-------------------------------------------------
2)What is the advantage of using the minified version of JQuery rather than using the conventional one?
Ans)
The advantage of using a minified version of JQuery file is Efficiency of the web page increases.

The normal version jQuery-x.x.x.js has a file size of 178KB

but the minified version jQuery.x.x.x-min.js has 76.7 KB.

The reduction in size makes the page to load more faster than you use a conventional jQuery file with 178KB
-------------------------------------------------
3) Do we need to add the JQuery file both at the Master page and Content page as well?
Ans)

No, if the Jquery file has been added to the master page then we can access the content page directly without adding any reference to it.

This can be done using this simple example

------------------------------------------------
4)What is the use of Using Statement ?
Ans)
Using statement is used similar to finally block that is to dispose the object.
It declares that you are using a disposable object for a short period of time.
Once the using block ends,the CLR releases the corresponding object immediately by calling its dispose() method.

Example:

//Write code to allocate some resource

//List the allocated resource in a comma-separated list inside

//the parenthesis of the using block



using(...)

{

//use the allocated resource

}



//Here dispose() method is called for all the object referenced without writing any additional code.
-------------------------------------------------