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.

    Webservice ,Remoting,XSLT Interview Questions


    Q1)Define XMLReader Class and XMLValidatingReader class?
    Ans)

    The XMLReader Class (Assembly: System.Xml.dll) represents a reader that provides fast, non-cached, forward-only access to XML data.

    The XMLValidatingReader class (Assembly: System.Xml.dll) represents a reader that provides:
    a) Document type definition (DTD),
    b) XML-Data Reduced (XDR) schema, and
    c) XML Schema definition language (XSD) validation
    ---------------------------------------------
    Q2)Are Web services only written in .NET ?
    Answer:

    No.....

    A web service is based on SOAP (Simple Object Access Protocol). So any technology which is able to implement SOAP should be able to create a web service. For example we can create web services in .NET or Java.

    Tags: web services, wcf

    WCF Interview Questions Part_3

    Previous Questions

    7) What is a service contract, operation contract and Data Contract?
    Ans)
    ServiceContract :
    Describes which operation client can perform on the services
    Indicates that an interface or a class defines a service contract in a application
    operation contract:
    Indicates that a method defines an operation that is pBoldart of a service contract
    Data Contract :
    Defines which data type are processed to and from the services, It provides built in contract for implicit type
    ----------------------------------------------------
    8)In WCF, "wsHttpBinding" uses plain unencrypted texts when transmitting messages and is backward compatible with traditional ASP.NET web services (ASMX Web Services) ?
    Ans)
    Select from following answers:

    True
    False
    Not Aware

    False

    "wsHttpBinding" is secure (messages are encrypted while being transmitted), and transaction-aware. However, because this is a WS-* standard, some existing applications (for example: a QA tool) may not be able to consume this service. Hence, it is not completely backward compatible.
    ------------------------------------------
    9) Why in WCF, the "httpGetEnabled" attribute is essential ?
    Ans)

    The attribute "httpGetEnabled" is essential because we want other applications to be able to locate the metadata of this service that we are hosting.


    Without the metadata, client applications can't generate the proxy and thus won't be able to use the service.
    -------------------------------------------
    10)What is the purpose of base address in WCF service? How it is specified?
    Ans)
    When multiple endpoints are associated with WCF service, base address (one primary address) is assigned to the service, and relative addresses are assigned to each endpoint. Base address is specified in element for each service.
    E.g.
    ```````````````````````````````````````````````````

























    ````````````````````````````````````````````````````
    -------------------------------------------
    11)What is the difference between XMLSerializer and the DataContractSerializer?
    Ans)
    a.DataContractSerializer is the default serializer fot the WCF
    b.DataContractSerializer is very fast.
    c.DataContractSerializer is basically for very small, simple subset of the XML infoset.
    d.XMLSerializer is used for complex schemas.
    -------------------------------------------
    12)What is Fault Contracts in WCF?
    Ans)
    Fault Contracts is the way to handle exceptions in WCF. The problem with exceptions is that those are technology specific and therefore cannot be passed to other end because of interoperability issue. (Means either from Client to Server or vice-versa). There must be another way representing the exception to support the interoperability. And here the SOAP Faults comes into the picture.

    Soap faults are not specific to any particular technology and they are based on industry standards.

    To support SOAP Faults WCF provides FaultException class. This class has two forms:

    a. FaultException : to send untyped fault back to consumer
    b. FaultException: to send typed fault data to the client

    WCF service also provides FaultContract attribute so that developer can specify which fault can be sent by the operation (method). This attribute can be applied to operations only.

    .NET Framework Interview questions
    -----------------------------
    Q4)What is break mode? What are the options to step through code?
    Ans)
    Break mode lets you to observe code line to line in order to locate error.

    The VS.NET provides following options to step through code.
    • Step Into
    • Step Over
    • Step Out
    • Run To Cursor
    • Set Next Statement

    Previous Questions

    Testing Questions

    Q1)What is Error, Bug and Defect?
    Ans)
    Error --> Which comes at the time of development.
    Bug --> Which comes at the time of testing. (Pre-Release)
    Defect --> Which comes in Production. (Post-Release)
    -----------------------------
    Q2)What is STLC? Explain about the steps of STLC?
    Ans)
    STLC stands for Software Test Life Cycle .

    1.Test Planning
    Prepare the test plan document, and test cases.

    2.Test Development
    Preparing requirements documents, UseCase documents, Traceability documents.

    3.Test Execution
    Executing all Test cases and filling actual results using testing tools and utilities.

    4.Result Analysis
    Comparing expected results with actual results.

    5.Bug Tracking
    Filed bugs are identified ,isolated and managed.

    6.Reporting
    Bug Reporting process, is the reporting of bugs in a database to track further.

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


    1) In Singleton Design Pattern, synchronization is essential ?
    Ans) In Singleton Design Pattern , synchronization is essential only for the first time when the instance is to be created. When the instance is created then it becomes an overhead for each request.

    public class Singleton

    {

    private static Singleton uniqueinstance;



    private Singleton()

    {

    }
    public static Singleton getinstance()

    {

    if(uniqueinstance == null)

    {

    uniqueinstance = new Singleton();

    }

    return uniqueinstance;

    }

    }


    In the above code, when for the first time getinstance method is called, synchronization is needed. After the first instance is created, we no longer need synchronization.
    ---------------------------------------------------
    2) Tell me the exact difference between IQueryable and IEnumerable interface ?
    Ans)
    IEnumerable is applicable for in-memory data querying, and in contrast IQueryable allows remote execution, like web service or database querying.
    ---------------------------------------------------------
    3)When a dynamic compilation of a website project is bad ?
    Ans)
    Dynamic compilation happens for a website project not for a web application project.
    If the site is very large, dynamic compilation of a Web site project might take a noticeable amount of time. Dynamic compilation occurs when a request for a site resource is received after an update to the site, and the request that triggers compilation might be delayed while the required resources are compiled. If the delay is unacceptable, you can pre-compile the site. However, then some of the advantages of dynamic compilation are lost.
    --------------------------------------------------


    Q4)Why the exception handling is important for an application?
    Ans)

    Exception handling is used to prevent application from unusual errors occurrences at the time of execution. If the exceptions are handled properly, the application will never get terminated abruptly.
    -------------------------------------------
    Q5)Define Error Events?
    Ans)

    ASP.NET supports events. When any unhandled exception occurs in an application, an event occurs, that events are called as Error Events.

    ASP.NET is having two events to handle exceptions.
    • Page_Error: This is page event and is raised when any unhandled exception occur in the page.
    • Application_Error: This is application event and is raised for all unhandled exceptions in the ASP.NET application and is implemented in global.asax

    The Error events have two methods to handle the exception:
    • GetLastError: Returns the last exception that occurred on the server.
    • ClearError: This method clear error and thus stop the error to trigger subsequent error event.

    Previous questions


    Next questions

    ADO.Net Questions

    Q1)What is DataViewManager?
    Ans)
    DataViewManager is used to manage view settings of the tables in a DataSet. A DataViewManager is best suited for views that consist of a combination of multiple tables. The properties like ApplyDefaultSort, Sort, RowFilter, and RowStateFilter are referenced using DataViewSetting.
    ---------------------------------
    Q2)What is the role of data provider?
    Ans)

    The .NET data provider layer resides between the application and the database. Its task is to take care of all their interactions.

    The .NET Data provider can be demonstrated to be:
    • SQL Server data provider
    • OLEDB data provider
    • ODBC Data Provider

    ADO.NET supports the following OLE DB Providers:
    • SQLOLEDB - Microsoft OLE DB Provider for SQL Server.
    • MSDAORA - Microsoft OLE DB Provider for Oracle.
    • Microsoft.Jet.OLEDB.4.0 - OLE DB Provider for Microsoft Jet
    --------------------------------
    Q3) How to convert a DataSet to a DataReader?
    Ans)
    DataTableReader rd = ds.Tables[0].CreateDataReader();

    OOPS Concept Interview Questions

    Q1)When inheriting from a base class, whether the derived class inherits the destructor and constructor from the base class?
    Ans)
    No, On inheriting from a base class the derived class inherits the only the members - including the code except the destructor and constructor of the base class.
    -------------------------------------------------------------------
    Q2)What is Multi-Threading?
    Ans)
    Threading:
    A thread is nothing more than a process.
    The process sets up sequential steps, each step executing a line of code.
    MultiThreading:
    A multithreaded application allows you to run several threads, each thread runs in its own process.
    So that you can run step1 in one thread and step 2 in another thread at the same time.

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

    Previous questions
    Next Questions


    Q1)Difference between Session object and Profile object in ASP.NET?
    Ans)
    Profile
    -------
    1.Profile object is persistent.
    2.Profile object uses the provider model to store information.
    3. Profile object is strongly typed.
    4. Mostly used for anonymous users.

    Session
    --------
    1.Session object is non-persistant.
    2.Session object uses the In Proc, Out Of Process or SQL Server Mode to store information.
    3. Session object is not strongly typed.
    4. Used for authenticated users.
    --------------------------------------------
    Q2)What are the new features in Visual Basic 10?
    Ans)
    1.Multi-Line Statement Lambdas
    2.Sub Lambdas
    3.Auto-implemented Properties
    4.Collection Initializers
    5.Array Literals
    --------------------------------------------
    Q3)How do we implement ASP.NET Globalization?
    Ans)
    • Create a resource file and compile them into a binary resource file.
    • Create satellite assembly for each of the resource file for each culture.
    • Store them in separate folder for easy access and replacement.
    • Read the resources from the satellite assembly that is stored in different folders based on the location and culture.
    -------------------------------------------
    Q4)How do you provide secured communication in ASP.NET?
    Ans)
    ASP.NET provides secured communication using Secure Sockets Layer. To use this SSL application we need to have an encryption key called a server certificate configured in IIS.

    When a user requests a secured page, the server generates an encryption key for the user’s session. The encrypted response is then sent along with encryption key generated. In the client side, the response is then decrypted using same encryption key.
    -------------------------------------------
    Q5)What are the advantages and disadvantages of using Outproc Session State?
    Ans)
    The advantages of using session state are:

    • It ensures data durability, since session state retains data even if ASP.NET work process restarts.
    • It works in multi-process configuration, thus ensures platform scalability.

    The disadvantages of using session state are:

    • Since data in session state is stored in server memory, it is not advisable to use session state when working with large amount of data.
    • Session state variable stays in memory until you destroy it, so too many variables in the memory that effects on the performance of the session state.
    ---------------------------------------------
    Q6)What is Session Identifier?
    Ans)
    Session Identifier is used to identify session. It has SessionId property. When a page is requested, browser sends a cookie with a session identifier. This identifier is used by the web server to determine if it belongs to an existing session or not. If not, a Session ID (120 - bit string) is generated by the web server and sent along with the response.

    Previous questions
    Next Questions

    IIS level Questinos , Application server

    Q1) What is scavenging ?
    Ans)
    When server running your ASP.NET application runs low on memory resources, items
    are removed from cache depending on cache item priority. Cache item priority is set when you add item to cache. By setting the cache item priority controls the items scavenging are removed first.
    -------------------------------------------

    Q2)How can we take back-ups in IIS Server?
    Ans)

    Step 1 : In the IIS (inetmgr), right click on the "Computer" icon under "Internet Information Services" . Click "All Tasks" and select "Backup/Restore Configuration".

    Step 2 : Click on button "Create backup". Give Name for your backup file. If you want encryption enable encryption option and give UserName and Password and then click OK.
    ---------------------------------------------
    Q3)What is the default user name of an anonymous login in IIS?
    Ans)In IIS, an anonymous user will be given with a user name of "IUSR_MachineName "
    -----------------------------------------------
    4)How can we check whether IIS is being installed in my system or not?
    Ans)
    To verify if IIS is installed or not we need to go to ’Add or Remove Programs’ utility in the Control panel and click on the ’Add/Remove Windows Components’ in the side menu.
    There we must locate an item called "Internet Information Services (IIS)". If this is checked, IIS should be installed.
    So that you can have your IIS installed in your system if it is not installed

    Sql Server Experience Questions

    Q1)How to respond to a Full Transaction Log Error in SQL Server ?
    Ans)
    Normally the Transaction Log full Err occurred with 9002 Error code.

    1. Backing up and Truncating the log.
    2. Freeing the transaction physical disk space so that the log can automatically grow.
    3. Moving the log file to a different disk drive with sufficient space.
    4. Increasing the size of a log file(Initial and Growth).
    5. Completing or killing a long-running transaction.
    ---------------------------------------------------
    Q2)What is "Double Hop" in SQL Server ?
    Ans)
    One computer connects to another computer to connect to a third computer, is called a double hop.
    ---------------------------------------------------
    Q3)What is Delegation in SQL Server ?
    Ans)
    SQL Server and Windows can be configured to enable a client connected to an instance of SQL Server to connect to another instance of SQL Server by forwarding the credentials of an authenticated Windows user. This arrangement is known as delegation.
    ---------------------------------------------------
    Q4)Maximum How many Row(s) will be there in Sys.Indexes view for Each table in SQL Server 2008/2008 R2 ?
    Ans)
    Normally, When we create a new table, One entry will be there in Sys.Indexes view as 'HEAP' the Index_ID is '0', If we create a CLUSTERED Index on that table then, The 'HEAP' will be replaced as 'CLUSTERED' the Index_ID is '1'.

    When we create a NONCLUSTERED Index on remaining columns then the Index_ID will be increased as 2,3,4,5....1005. Normally, a table can have maximum 999 NONCLUSTERED INDEXES and 1 CLUSTERED INDEX, Totally a table can have 1000 INDEXES.

    But, The Index_ID in Sys.Indexes will be 0 or 1 to 250 and 256 to 1005 (Totally 1000 Indexes/Entries in Sys.Indexes View for a table). Then what about the 251 to 255 (5 Sequence have been reserved for Index Internals).

    Finally, An Index_id will be 0 or 1 to 250 and 256 to 1005 (Maximum 1000 Entries will be there in Sys.Indexes View for each table), Minimum 1 entry will be there as 'HEAP' or 'CLUSTERED'
    -----------------------------------------------
    Q5) What is MERGE statement?
    Ans)
    MERGE is new feature in SQL Server 2008 that provide an efficient way to perform multiple operations. In previous version we had to write separate statement to INSERT,DELETE and UPDATE data based on certain conditions, but now using MERGE statement we can include the logic of such data modification in one statement that even checks when the data matched then just update it and when unmatched then insert it. most important advantage of MERGE statement is all the data is read and processed only once.
    ---------------------
    Q6)What is BCP ?
    Ans)
    BCP is stand for Bulk copy Program in sql server, bulk copy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structure same as source to destination.
    --------------------------------------

    Interview Questions for freshers part -3



    Q1)What are User Controls and Custom controls?
    Ans)

    Custom controls are control build entirely in code. The pro is that you can put them in libraries, add an icon to the toolbox and other fine control.

    User controls are more easy to do, and in general is a way to encapsulate things to simplify other pages or when you need to use the same markup in several pages.
    --------------------------------------------------------------
    Q2)web.config file main two advantages are :-
    (1) web.config file cannot be viewed directly in a browser
    (2) If the web.config file is changed, you don’t need to re-compile your ASP.NET application

    Ans)
    Select from following answers:
    False
    True
    Both
    Both the above statements are correct.
    ------------------------------------------------------


    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.

    Exception handling Questions

    Q1)How to use Exception Handling?
    Ans)
    What is Exception?
    An Exception is an unexpected error or problem.
    What is Exception Handling?
    It is a method to handle the error and solution to recover from it which makes the program to work smoothly.

    What is try Block?
    The try block consists of the code that might generate an error.
    This try block must be associated with one or more catch blocks or by finally block.
    The try block may not have a catch block associated with it every time but in this case,it must have a finally block associated with it instead of catch block.

    Example:

    Format1



    try

    {

    //Code that might generate error

    }

    catch(Exception error)

    {

    }



    Format2



    try

    {

    //Code that might generate error

    }

    catch(ExceptionA error)

    {

    }

    catch(ExceptionB error)

    {

    }



    Format3



    try

    {

    //Code that might generate error

    }

    finally

    {

    }



    What is catch Block?
    catch block is used to recover from error generated in the try block.
    In case of multiple catch blocks,only the first matching catch block is excecuted.
    you need to arrange the multiple catch blocks from specific exception type to more generic type.
    If none of the matching catch blocks are able to handle the exception, the default behaviour of web page is to terminate the processing of the web page.

    Example:

    Format1



    try

    {

    //Code that might generate error

    }

    catch(Exception error)

    {

    //Code that handle errors occurred in try block

    }



    Format2:



    try

    {

    //Code that might generate error

    }

    catch(DivideByZeroException error)

    {

    //Code that handle errors occurred in try block

    //It is the most specific error we are trying to catch

    }

    catch(Exception error)

    {

    //Code that handle errors occurred in try block

    //It is not specific error we are catching

    }

    catch

    {

    //Code that handle errors occurred in try block

    //It is the least specific error in hierarchy

    }



    What is finally Block?
    The finally block contains the code that executes,whether an exception occurs or not.
    The finally block is used to write code to close files,database connections,etc.
    Only one finally block is associated with each try block.
    finally block must appear only after the catch block.
    If there are any control statements such as goto,break or continue in either try or catch block,the transfer happens only after the code in the finally block is excecuted.
    If the control statements are used in finally block,there occurs a compile time error.

    Example:

    Format1



    try

    {

    //Code that might generate error

    }

    catch(Exception error)

    {

    //Code that handle errors occurred in try block

    }

    finally

    {

    //Code to dispose all allocated resources

    }



    Format2



    try

    {

    //Code that might generate error

    }

    finally

    {

    //Code to dispose all allocated resources

    }
    -----------------------------------------------
    Q2)"Viewstate information does not automatically transfer from page to page. It cannot be tracked across pages". Is the statement true ?
    Ans)
    Select from following answers:

    Yes
    No
    Maybe


    Yes, the above statement is true.

    Viewstate information cannot be tracked across pages. You can use session or querystring to track anything from one page to another.

    Note: Do not store large amount of data on the page using viewstate because it will slow down the page load process.
    ------------------------------------------------
    Q3) What is the use of throw statement?
    Ans)
    A throw statement is used to generate exception explicitly.
    This throw statement is generally used in recording error in event log or sending an Email notification about the error.
    Avoid using throw statement as it degrades the speed.

    Example:

    try

    {

    //Code that might generate error

    }

    catch(Exception error)

    {

    //Code that handle errors occurred in try block



    throw; //Re throw of exception to add exception details in event log or sending email

    }



    //Code that handle errors occurred in try block

    }

    finally

    {

    //Code to dispose all allocated resources

    }



    Format2



    try

    {

    //Code that might generate error

    }

    finally

    {

    //Code to dispose all allocated resources

    }
    ----------------------------------------------------------

    4)How to manage unhandled Exception?
    Ans)
    You can manage unhandled exception by configuring the element in web.config file.
    It has 2 attributes:

    Mode Attribute:It specifies how the custom error page should be displayed.
    It has 3 values:
    on - Displays custom error pages at both the local and remote client.
    off - Disables custom error pages at both the local and remote client.
    RemoteOnly - Displays custom error pages only at the remote client as it displays default asp.net error page for local machine.This is default setting in web.config file.
    defaultRedirect:It is an optional attribute to specify the custom error page to be displayedwhen an error occurs.
    The custom error page is displayed based on http error statusCode using error element inside the customError element.
    If none of the specific statusCode matches with it, it will redirect to defaultRedirect page.
    -----------------------------------------------
    5)Difference between catch(Exception error) and catch
    Ans)
    The code below explains the difference between catch(Exception error) and catch


    try

    {

    //Code that might generate error

    }



    catch(Exception error)

    {

    //Catches all Cls-complaint exceptions

    }



    catch

    {

    //Catches all other exception including the Non-Cls complaint exceptions

    }




    For Final Year Students of Computers

    Q1) Tell in brief, the difference between Development and Production Environment ?
    Ans)

    Development Environment – It is the place where we develop our application/product. Here all the coders or programmers develops the application/product by writing code.

    Production Environment – When the application/product is ready for release to the end-users. When that application/product executes or run in the target machine live.

    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.
    -------------------------------------------------

    Interview Question part 3

    Q 1)Can I deploy the application without deploying the source code on the server?

    Ans)yes, After Project Completion we will Publish the Code after published we will give the code deploy the application on the server.
    *************************************************************************
    Q 2)Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.

    Ans) inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
    *************************************************************************
    Q 3) Can we declare event and delegates in an interface?

    Ans)No,we cannot declare delegates in interface however we can declare events in interface.
    So interface can only contains the signature of the following members
    Methods
    Properties
    Indexers
    Events
    *************************************************************************

    Q4) Difference between catch(Exception error) and catch?
    Ans)

    The code below explains the difference between catch(Exception error) and catch

    try

    {

    //Code that might generate error

    }



    catch(Exception error)

    {

    //Catches all Cls-complaint exceptions

    }



    catch

    {

    //Catches all other exception including the Non-Cls complaint exceptions

    }

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

    Previous Questions


    Next Questions

    1)What is Marshaling?
    Ans)

    The process of establishing a Remote Proxy Server object which resides at the client side and act as if it was the server.Which in turn handles the communication between the real server object and client object. This process of monitoring is said to be Marshaling.
    --------------------------------------------------
    2)What is Smart Navigation ?
    Ans)
    When ever there is a request from a web browser which is IE 5.0 or greater Smart Navigation enhances the user feel of the page.

    These are the different functions which this smart navigation performs.

    1) It Persists the element focus between navigation's.

    2) It also persists the scroll position when user traversing from one page to another.

    3) It eliminates the flash content which was caused by navigation.

    4) Most important feature is retaining the last page state in the browsers history.

    This is how we can set the Smart Navigation :

    We can set SmartNavigation attribute at the @ page directive in the .aspx page. So when the page is requested the dynamically generated class sets this attribute.

    Note : This property is best useful when a particular web site has frequent postbacks.
    ---------------------------------------------------
    3)In C# how do you find the last error which occurred ?
    Ans)

    This can be done by implementing a method called GetLastError(). Generally this returns a ASPError object stating the error condition that has occurred. This method will work only before the .ASP page sent any content to the Client.

    Sample Code

    Exception LastErrorOccured;

    String ShowErrMessage;

    LastErrorOccured = Server.GetLastError();

    if (LastErrorOccured != null)

    ShowErrMessage = LastErrorOccured.Message;

    else

    ShowErrMessage = "No Errors";

    Response.Write("Last Error Occured = " + ShowErrMessage);
    ---------------------------------------------------
    4)What is the difference between OLEDB Provider and SqlClient ? Which is more productive to use for Dot Net application?
    Ans)
    Generally SQLClient .NET classes are highly optimized for the .net / sqlserver combination which in-turn gives accurate results. The SqlClient data provider is fast. It works faster than the Oracle provider, and even more faster than accessing database through the OleDb layer.

    Reason for being faster is, it access the native library which generally gives you a better performance and it has also got a lot of support from SQL Server team online.
    ----------------------------------------------------
    5)which is server side state management technical?
    Ans)
    Select from following answers:
    a)cookies
    b)hidden fields
    c)session
    d)view state

    session is the server side state management and other 3 r client side state management

    6) What is the name given to a type of assembly which contains localized resources?

    Ans)

    Select from following answers:

    A. a) Satellite

    B. b)Spoke

    C. c)Sputnik

    D. d)Hub

    satellite

    We can deploy our application's resources in satellite assemblies. Generally by definition, satellite assemblies contains only resource files. They do not contain any application code.

    In the satellite assembly deployment model, we create an application with one default assembly (which is the main assembly) and several satellite assemblies.

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

    7) In Singleton Pattern, how will you make sure that threading is done with minimal overhead

    Ans)

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    public sealed class Singleton

    {

    private static volatile Singleton instance;

    private static object syncRoot = new Object();

    private Singleton() {}

    public static Singleton Instance

    {

    get

    {

    if (instance == null)

    {

    lock (syncRoot)

    {

    if (instance == null)

    instance = new Singleton();

    }

    }

    return instance;

    }

    }

    }

    '''''''''''''''''''''''''''''''''''''''''''''''''''''

    In the above code, when the Singleton instance is created for the first time then it is locked and synchronized but next call or successive calls make sure that the lock is not checked anymore because an instance already exists. This way the overhead of checking the lock minimizes.

    The double-check locking approach solves the thread concurrency problems while avoiding an exclusive lock in every call to the Instance property method.



    Previous Questions


    Next Questions