Dot Net Interview questions for 3+ years of experience - Part-6


1)What is the default mapping logic used by ASP.NET MVC ?
Ans)
The default mapping logic used by ASP.NET MVC is as follows :-

/[Controller]/[ActionName]/[Parameters]

For example,

controller = "Home", action = "Index", id = UrlParameter
----------------------------------------------------------------------
2)What is difference between Web site and Web application ?
Ans)
Both function and perform similarly, but still differ in following ways.

Web application:

a) We can't include c# and vb page in single web application.
b) We can set up dependencies between multiple projects.
c) Can not edit individual files after deployment without recompiling.
d) Right choice for enterprise environments where multiple developers work unitedly for creating,testing and deployment.
Web site:
a) Can mix vb and c# page in single website.
b) Can not establish dependencies.
c) Edit individual files after deployment.
d) Right choice when one developer will responsible for creating and managing entire website.

But let me clarify point number (d) for both ?


In Web application, different different groups work on various components independently like one group work on domain layer, other work on UI layer.

In web site development, decoupling is not possible.
-----------------------------------------------------------------------
3)Explain about Authentication and Authorization ?
Ans)
Authentication:
Authentication is the process of verifying the credentials such as username and password of the user and then allows that user to access the server.
This process can be done in many ways like :

Password based authentication

Device based authentication

Biometric authentication

For Example, if you use

Windows based Authentication and are browsing an ASP.NET page from server -- ASP.NET/IIS would automatically use NTLM to authenticate you as user1.

Forms based Authentication, then you would use an html based forms page to enter username/password -- which would then check a database and authenticate you against the username/password in the database.
Authorization:
Authorization is a process of verifying whether the user has got the permission to do the operation that he is requesting.
Ex: In my project we will first authenticate the user is valid or not after that we will check(Authorization) the user is able to access or not.
------------------------------------------------------------------------------------
4)What is the use of AutoPostBack ?
Ans)
AutoPostBack is a feature available that is available on few controls.
The main purpose of this feature is that, if there is any change done on the client side, then it should be handled on the server side.

Usage:





Example:






--------------------------------------
5)What is the difference between Server.Transfer and Response.Redirect ?
Ans)

Both are objects of ASP.Net and are used to transfer user from one page to another page.

Syntax:

Response.Redirect("Default.aspx");

Server.Transfer("Default.aspx");

Server.Transfer() can directly access the values, controls and properties of the previous page whereas you cannot do with Response.Redirect().

Asp.Net Multiple Choice Interview Questions -1

1)Which is the default method that will be called on a controller if one is not explicitly specified in Asp.Net MVC ?
Ans)
Select from following answers:
  1. Home
  2. Index
  3. Welcome
Show Correct Answer

----------------------------------------------------------------------------------

Multiple Choice Questions-1

1)In traditional web service, can Hash table (IDictionary interface) can be serialized or de-serialized ?
Ans)


Select from following answers:
  1. Yes
  2. No
  3. Don't Know
View Correct Answer

------------------------------------------------------
2)In traditional web services, Only Public fields or Properties of .NET types can be translated into XML ?
True or false ?
Ans)

Select from following answers:
  1. True
  2. False
  3. Don't Know
View Correct Answer

Sql Server Interview questions part-1

1)Difference between Primary Key and unique key ?
Ans)
Primary Key Restrict duplicate values and null values each table can have only one primary key,default clustered index is the primary key.

unique key restrict duplicate values and allow only one null value. default non clustered index is an unique key
------------------------------------
2)What is the clause that specifies a condition for a group or an aggregate?
Ans)
Select from following answers:
A. Distinct
B. Where clause
C. Exists
D. Having Clause

Having Clause
This is how we can create a condition laid on a group or aggregate

Example :
SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
------------------------------------------------------------------------
3) Which command removes all the rows from the table without logging individual row deletions ?
Ans)
Select from following answers:
A. Truncate
B. delete
C. drop
D. Alter

Truncate will not log individual row deletion.

Here is an example of how we can count the rows before and after truncate

SELECT COUNT(*) AS BeforeTruncateCount FROM MyTable.MyJob;
TRUNCATE TABLE MyTable.MyJob;
SELECT COUNT(*) AS AfterTruncateCount FROM MyTable.MyJob;
---------------------------------------------------------------------
4) What is the command that is used to set a set of privileges that can be granted to users or different roles?
Ans)
Select from following answers:
A. Create Authority
B. Create Grant
C. Create Role
D. Create Authentication

Role Command is used to set the set of privileges which can be granted to users.

An example:

CREATE ROLE editors AUTHORIZATION db_SecurityServices;
-------------------------------------------------------------------------------------
5)Write a script to identify, Each character's count in a given string ? (Without using Loop)
i.e: Pandian
Ans)
Declare @String Varchar(100)

Select @String = 'Pandian'

;With CTEs

As

(

Select LEFT(@String,0) Chars,0 [String]

Union All

Select Substring(@String,[String]+1,1) Chars,[String]+1 From CTEs Where [String] <=LEN(@String)

)

Select Chars [Letter], COUNT(1) [Repeats] from CTEs Where Chars <>'' Group by Chars

Go
Result:
Letter Repeats

------ ------

a 2

d 1

i 1

n 2

P 1
------------------------------------------------------------------------------
1) What is magic table in Sql server ?
Ans)
Sql Server automatically creates and manages two temporary, memory-resident tables (deleted and inserted tables) which are popularly known as magic tables.

Usually used with the DML triggers. Can not directly modify the data in the tables or perform ddl operation.

Primarily used to perform certain action like

1) Extend referential integrity between tables
2) Test for errors and take action based on the error.
3) Find the difference between the state of a table before and after data modification and take actions based on that difference.
-----------------------------------
2)What is CTE in Sql server 2005 ?
Ans)
A common table expression (CTE) can be thought of as a temporary result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement. It is similar to a derived table. Unlike a derived table, a CTE can be self-referencing, not stored as object and can be referenced multiple times in the same query.

It can be recursive and non-recursive.

It provides the significant advantage of being able to reference itself because earlier version sql server, a recursive query usually requires using temporary tables, cursors, and logic to control the flow of the recursive step.

CTEs can be defined in user-defined routines, such as functions, stored procedures, triggers, or views.
------------------------------------------
3)What is the difference between DELETE and TRUNCATE in SQL ?
Ans)
Using TRUNCATE, we cannot restore the deleted data.

Syntax:

TRUNCATE TABLE table_name;

Example:

To delete all the rows from employee table, the query would be like,

TRUNCATE TABLE employee;

Unlike using DELETE, we can restore the data, as the physical data will not get deleted.

Syntax:

DELETE FROM table_name [WHERE condition];

Example:

To delete an employee with id 100 from the employee table, the sql delete query would be like,

DELETE FROM employee WHERE id = 100;

Finally, To delete rows using truncate, the identity column will reset , but not reset when using delete

Dot Net Interview questions for 3+ years of experience - Part-5




Q1)What is DLL Hell?
Ans)
DLL Hell: DLL Hell refers to the set of problems while sharing multiple applications under a single common component like Dynamic Link Library(DLL) or a Component Object Model(COM) class.
Simply, it is the problem which occurs while registering the DLL components with a common name.
DOT Net has removed this problem by introducing the concept of versioning.
Versioning: Versioning is a process where, every shared application creates its own version number.
For Example, Let us assume that the version number of the first registered DLL takes as V1.0. And Now, you want to overwrite the first registered DLL by installing another DLL with same name.
Then the version number of the second registered DLL would be taken as V2.0.
By this way we can avoid the conflicts of DLL registration and can overwrite the registered DLLs successfully.
-------------------------------------------------------

2)Can we access from a compiled class?
Ans)
Yes we can access cache from a compiled class. Here is the code to it.
''''''''''''''''''''''''''''''''''''''''
MyVariable=System.Web.HttpContext.Current.Cache("");


'''''''''''''''''''''''''''''''''''''''''
---------------------------------
3)How can we clear total cache of a give page?
Ans)
At times we need to make sure that all the cache which was used must be cleared.

This can be done in many ways here is one of the way using the dictionary object
''''''''''''''''''''''''''''''''''''''''''''''
foreach(DictionaryEntry objClearItem in Cache)

{

//Response.Write (objClearItem .Key.ToString ());

Cache.Remove(objClearItem .Key.ToString () ) ;

}
''''''''''''''''''''''''''''''''''''''''''''''''
-------------------------------------------------
4)Can we implement caching with PDF files?
Ans)
Say our PDF files are on the disk then we should let the IIS to handle it. The reason being the caching done through IIS is much faster than ASP.NET cache.

In IIS the caching done through IIS static file handler.
------------------------------------------------
5)How do we read data from a XML file and display it in a DataGrid ?
Ans)
we can do this by using ReadXML method.

DataSet MyDataset= new DataSet ();

MyDataset.ReadXml (Server.MapPath ("sample.xml"));

MyDataGrid.DataSource =MyDataset;

MyDataGrid.DataBind();
-------------------------------------------------
6)How do we write data from the database to a XML file?
Ans)
we can do that using WriteXml method.
'''''''''''''''''''''''''''''''''''''''
In C#

’Filling the DataSet
ds.WriteXml(Server.MapPath ("sample.xml" ) )


In VB

//Filling the DataSet
ds.WriteXml(Server.MapPath ("sample.xml" ) );
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-------------------------------------------------------------
7)What is the difference between Abstract Class and Interface?
Ans)
Abstract Class:

a) An abstract class is a special kind of class that cannot be instantiated.
b) It allows the other classes to inherit from it but cannot be instantiated.
c) It is used to carry the same hierarchy or standards for all the subclasses.


Interface:

a) An interface is not a class,but it is an entity and has no implementation.
b) It has only the definition of the methods without the body.


Differences:

1) A class may inherit several interfaces, but inherit only one abstract class.
2) An abstract class cn provide complete code, but interface provides just the signature.
3) An abstract class can contain access modifiers for the subs, functions, properties, but an interface cannot.
4) An abstract class defines the core identity of a class, but interfaces are used to define the peripheral abilities of a class.
5) An abstract class is fast whereas the interfaces requires more time to find the actual method in the corresponding classes.
6) If we add a new method to an abstract class, there we can provide the default implementation and therefore all the existing code might work properly whereas in interface, we have to track down all the implementations of the interface and define implementation for the new method.
7) In Interface, we cannot define the fields whereas in an Abstract class, we can define the fields and constants.



If you define additional methods in the WCF service that are not in the service contract, will it be visible to client applications ?

Select from following answers:
  1. Yes
  2. No
  3. Can't say

Show Correct Answer

Which file specifies the name and location of the class that implements the WCF service ?


Select from following answers:

  1. IService.cs file
  2. web.config file
  3. Service.svcfile


View Correct Answer

JQuery Interview Questions Part -1

1)What is the use of Delegate() Method in jQuery?
Ans)
The delegate() method can be used in two ways.
1) If you have a parent element, and you want to attach an event to each one of its child elements, this delegate() method is used.
Ex:Un-ordered List
Instead of attaching an event to each
  • element, you can attach a single event to element.
    Example:
    $("ul").delegate("li", "click", function(){
    $(this).hide();
    });
    2) When an element is not available on the current page, this method is used.
    .live() method is also used for the same purpose but, delegate() method is a bit faster.
    Example:
    $("ul").live("li", "click", function(){
    $(this).hide();
    });
    This will hide any list items that are not currently available on the page. They may be loaded via an Ajax request and then append to it.
    Using .bind() or .click() methods, you would have to manually attach events to these new list items once they are added.
    ---------------------------------------------------------------
    2)Can we select a element having a specific class in jQuery ?
    Ans)
    Yes, we can select an element with a specific class, we use the class selector.The class name must contain the prefix as "." (dot).


    <script language="javascript" type="text/javascript">
    $(".class1").css("border", "2px solid red");
    </script>

    Above code will select all the elements of the webpage containing the class as "class1" and apply the css style border width as 2 Pixel, style as solid and color as red.

  • Other Questions

    1)What are different People Management Styles?
    Ans)
    The different styles are:
    1. Directing
    2. Coaching
    3. Supporting
    4. Delegating
    Directive: The leader provides specific instructions and closely supervises task accomplishment. Structure, Control, Supervise
    Coaching: Direct and closely supervise; also explain decisions, solicit suggestions, and support progress
    Supporting: Facilitate and support efforts towards task accomplishment. Also share responsibility for decision making with subordinates.
    Praise, Listen, Facilitate
    Delegating: Turn over responsibility for decision-making and problem-solving to subordinates. --
    Before you are a leader, success is all about growing yourself. When you become a leader, success is all about growing others. - sekhar
    -----------------------------------------------------------------
    2)What is the importance of Feedback?
    Ans)In an environment where people are self-managed, it is very important to give feedback to ensure they are on the right track.
    Fire in private and praise in public.
    Positive feedback in public encourages the individual and motivates peers.
    Negative feedback needs to given quickly to stop negativity from spreading but in private to reduce embarrassment to the individual.
    Continuous feedback is more effective than feedback at end of year/project.
    -----------------------------------------------------------------------
    3)What are the key points of People Interactions?
    Ans)
    Consider your team members as people and not resources
    1. Take ownership
    2. Invest in building relationships
    3. Look at the situation from the other person’s point-of-view
    ----------------------------------------------------------------------------
    4)What good leaders do?
    Ans)
    1. Listen
    2. Communicate clearly
    3. Inspire others
    4. Keep promises and commitments
    5. Act in timely and firm manner
    6. Optimistic in their outlook
    7. Unbiased in their action
    8. Approachable for issues
    9. Leads from the front
    10. Makes the team participate in decision making
    11. Organized and structured
    12. Recognizes achievements
    13. Respects others
    14. Delegates work Etc........
    ---------------------------------------------------------------------
    5) What leadership style should I choose?
    Ans)
    You can choose a style based on:
    Experience of your team (junior or senior)
    Nature of work (routine or creative)
    Environment (stable or radically changing, conservative or adventurous)
    Your own preferred or natural style
    This can vary from situation to situation and person to person

    ---------------------------
    6)What is the purpose of a bootstrapper application?
    Ans)

    A bootstrapper erases the installation of the various required components for an application. It provides a simple, automated way for detecting, downloading, and installing applications and their required components. It also detects whether a component is supported to a particular operating system or not.
    -----------------------------------------------------
    7)What is XCopy?
    Ans)

    XCopy command is an advanced version of the copy command used to copy or move the files or directories from one location to another location (including locations across networks). It excludes the hidden and system files.

    .NET Framework Interview questions

    Q1)What are the debugging windows available?
    Ans)

    The windows which are available while debugging are known as debugging windows.

    These are: Breakpoints, Output, Watch, Autos, Local, Immediate, Call Stacks, Threads, Modules, Processes, Memory, Disassembly and Registers.
    -------------------------------------------
    Q2)How do we step through code?
    Ans)
    Stepping through the code is a way of debugging the code in which one line is executed at a time.

    There are three commands for stepping through code:

    Step Into: This debugging mode is usually time-consuming. However, if one wants to go through the entire code then this can be used. When you step into at a point and a function call is made somewhere in the code, then step into mode would transfer the control to the first line of the code of the called function.

    Step Over: The time consumed by the Step into mode can be avoided in the step over mode. In this, while you are debugging some function and you come across another function call inside it, then that particular function is executed and the control is returned to the calling function.

    Step Out: You can Use Step Out when you are inside a function call and want to return to the calling function. Step Out resumes execution of your code until the function returns, and then breaks at the return point in the calling function.

    Steps in visual studio
    ----------------------
    Tools\Options -> Environment\Keyboard. The Step Into/Out commands are Debug.StepInto/Debug.StepOut.

    Note that the default is F10 = StepOver and F11 = StepInto.
    You can alternatively reset the key bindings because the default is what you want as well.
    -----------------------------------------

    Q3)Which one is not a testing tool in Dotnet Framework ?
    Ans)
    Select from following answers:
    1. NUNIT
    2. NANT
    3. csUnit

    NANT - NAnt is a free .NET build tool based on Ant.