Sunday, October 4, 2009

ASP.Net/SQL Server/.Net Framework Interview questions

Following are .Net Framework/ASP.Net/SQL Server questions which tests your mettle in these technologies. I quickly gathered these questions from different sources. Probably, i guess I should provide answers to these questions. I'll do that in my next post.


Where are the value types contained inside a reference type stored? Say for example if there is a class Employee and a member 'int roll no', where will the roll number be stored?
  1. In the stack
  2. In the heap
  3. In the harddisk
What is faster?
  1. Accessing the heap
  2. Accessing the stack
  3. Accessing the hard disk
If you declare String a = "Minecode" and 'a' points to an address 1000, executing a = "MINECODE01" will not change the address. Is this true?
  • True
  • False
Which of the following datatypes cannot be set to null?
  1. string
  2. custom classes
  3. DateTime

What are the interfaces related to USING block in C#?
  1. IComparer
  2. IDisposable
  3. ISerializable
Which of the following is true?
  1. A static method can access all private properties of a class.
  2. A static method can access only the public properties of a class.
  3. None of the above
Which of the following is true?

  1. A delegate uses an event
  2. An event uses a delegate
  3. None of the above

If we have a try block and three catch blocks, the first catch block catches Exception, the second one catches ArgumentException and the third one catches ArgumentNullException, Which block will catch an ArgumentNullException thrown from the try block?
  1. Catch Exception
  2. Catch ArgumentException
  3. Catch ArgumentNullException

LogIn is bad on?
  1. A write intensive table
  2. A read intensive table
  3. None
You can use an insert statement on a view.
  • True
  • False
You can insert into a table without providing values for all the non null columns.
  • True
  • False
Group by takes precedency over Order by.
  • True
  • False
Which of the following can not be rolled back?
  1. Truncate
  2. Delete
  3. Update
  4. None of the above
Referential integrity is related to.
  1. Views
  2. Foriegn keys
  3. LogIn
Which of the following is true.
  1. There can be only one unique column in a table
  2. There can be only one primary key in a table
  3. There can be only one foriegn key in a table

Which SQL statement is used to return only different values?
  1. select distinct
  2. select unique
  3. select different
If there are two tables Employees and Orders an inner join between employees and orders would fetch employee rows?
  1. Even if there is no order for the employee.
  2. only if there is an order for the employee

If there are two tables Employees and Orders an left join between employees and orders would fetch employee rows
  1. Even if there is no order for the employee.
  2. only if there is an order for the employee.
I have a table called products that has the list of all products. I have a table called stores which has all the stores in the market. If I want to track the sales for a store and product combination, what kind of join will I use?

  1. Inner Join
  2. Right Outer Join
  3. Cross Join
  4. Left Outer Join
Can you explicitly update an Identity column?
  • Yes
  • No

In Asp.Net, interceptions like authentication and session information are handled
using
  1. Pages
  2. handlers
  3. Modules

The page class implements
  1. IHttpModule
  2. IHttpHandler
  3. IHttpContext
Managing Session state in memory
  1. Decreases scalability
  2. Has no effect on scalability
  3. Increases scalability
Page remembers the state of the various controls across postbacks because of
  1. Application state
  2. Session state
  3. Cache
  4. View State

In which file do we handle the application start and end event?
  1. the aspx file
  2. Web.config
  3. application.asax
  4. global.asax
Which of the following is not a stage of page - Load Life cycle?
  1. Load()
  2. Init()
  3. PreRender()
  4. Render(),PostRender()
  5. Unload()

Interface does not come with an implementation. If there are multiple classes that want to implement the same interface and want to implement the same way, they are helpless. What is the correct way to work around this problem?

  1. Inheritance
  2. Composition
  3. Encapsulation
  4. Polymorphism

A contract that could possibly come with a default implementation

  1. Abstract Base class
  2. Interface
  3. Sealed class
  4. Partial class
What is the scope of connection pooling?
  1. Appdomain
  2. Process
  3. Machine
Which of the following prevent SQL injection?
  1. Use of Stored Procedures
  2. Use of dynamic queries by using SqlParameter objects.
  3. Use of dynamic Queries by concatinating strings.
I have a million rows in a database and I want to read the records and show them in the UI. What is the prefered way to read the data?

  1. DataReader
  2. DataSet
  3. RecordSet
When a web service receives an invalid input it should throw
  1. SoapFault with Fault code set to Client
  2. InvalidArgumentException
  3. SoapFault with Fault code set to Server
  4. Argument Exception
ASP.NET uses _________ to generate a WSDL out of your class
  1. Polymorphism and Serialization
  2. Reflection and serialization
  3. Encapsulation and serialization
  4. ISDASM and Serialization
WSDL is a
  1. contract in xml form
  2. contract in binary form
  3. Protocol to access a web service
  4. Directory to discover a web service

Where would you store the connection strings that are used in the ASP.NET application?
  1. Web.config
  2. Machine.config
  3. In your page class
  4. in global.asax

Which config file takes precedence?
  1. Web.Config
  2. Machine config

What is the extension used for ASP.NET HTTP Handlers?
  1. ASHX
  2. ASCX

Response.Redirect redirects to a new URL

  1. With the knowledge of the browser
  2. without the knowledge of the Browser