Interview Questions Part 1 - Oracle , DotNet , SQL , UML , Javascript , AJAX

Interview Questions Part 1 - Oracle , DotNet , SQL , UML , Javascript , AJAX


Question 1 :

What are few Oracle DDL statements or commands ?


Answer 1 :

Below are few  DDL commands to create, alter, drop, and rename tables.
CREATE TABLE
  • Create a table.
  • Create a table based on another table by using a subquery.
ALTER TABLE
  • Modify table structures.
  • Change column widths, change column data types, and add columns.
DROP TABLE

  • Remove rows and a table structure.
  • Once executed, this statement cannot be rolled back.

RENAME

Rename a table, view, sequence, or synonym.

TRUNCATE

Remove all rows from a table and release the storage space used by the table.

COMMENT

 Add a comment to a table or a column.
  Query the data dictionary to view the comment.
For more details refer below link :

Question 2 :

How to round off decimal to two decimal places in C# ?


Answer 2 :
There are 3 ways to round off decimal to two decimal places :

1. Use ToString()
 double  d = 2.445;
 d.ToString("0.00")

Output : 2.45

2. Use Math.Round

double d = 2.445;

Math.Round(d, 2)

Output : 2.44

3. Create a Custom logic method like below :

N = 2.445 I want to show "2.45" only.

Step a. N*100 + 0.5 = 245
Step b. Divide System.Math.Floor(245) by 100
Step c. The result will be 2.45

Question 3 :

Which property of the image control should you use to set the descriptive text?


Answer 3:

AlternateText

Question 4 :

Your development team is working on a large scale .Net project that has multiple assemblies and code files. Before releasing the software as a Beta product, you and the team are testing classes and assemblies for bugs. Most methods have been programmed to just catch the exception without logging any information. You now want to change this so that information about the sequence of calls and the line number of the method where the exception occurred are logged.


 

Which property of the exception class should you use?


a. HelpLink
b. Message
c. InnerException
d. StackTrace

Answer 4 : d

Question 5:

You and a group of programmers have written a new web application using Visual Studio.NET for a new client. The application tracks charity donations for a well known charity company. Due to the nature of the data it is vital that the server maintains session state even if the Web server crashes and needs to be restarted.

Which alternative is it best to use to store session state in this situation?

a. SQL Server

b. XML Configuration files

c. In-process storage

d. Session State Service


Answer 5 : a

Question 6 :
Difference between Web farm and Web Garden ?

Answer 6 :

A Web farm allows you to expand a Web Site across multiple servers whereas A Web garden allows you to expand a Web Site across multiple CPUs within a single server.

Question 7 :
State why we create custom HTTPModule ?

Answer 7 :
Custom HTTPmodule is created for:

  1. URL rewriting
  2. Compression
  3. Specialized authentication and authorization
  4. Specialized logging

Question 8 :
What is params keyword in C# ?

Answer 8 :
The params keyword lets you specify a method parameter that takes a variable number of arguments.
No additional parameters are permitted after the params keyword in a method declaration, and only one params keyword is permitted in a method declaration.
You can send a comma-separated list of arguments of the type specified in the parameter declaration, or an array of arguments of the specified type. You also can send no arguments

Example :

public static void UseParams(params int[] list)
{
for (int i = 0; i < list.Length; i++)
{
Console.Write(list[i] + " ");
}
Console.WriteLine();
}

We can call above method

Way 1 :
// You can send a comma-separated list of arguments of the specified type.
UseParams(1, 2, 3, 4);
Way 2 :
// An array argument can be passed, as long as the array

// type matches the parameter type of the method being called.
int[] myIntArray = { 5, 6, 7, 8, 9 };
UseParams(myIntArray);

Way 3:
UseParams();

Question 9 :
What is CharEnumerator in C# ?

Answer 9 :
CharEnumerator is an object in C# that can be used to enumerate through all the characters of a string.
Sample Code :
string str = "santosh";
CharEnumerator chs = str.GetEnumerator();
while(chs.MoveNext())
{
Response.Write(chs.Current);
}

Question 10 :
Difference between RegisterStartUpScript and RegisterClientScriptBlock ?
Answer 10 :
RegisterStartUpScript
This adds the javascript code at the end of the page before the closing of form tag.

RegisterClientScriptBlock
This adds the javascript code at the top of the page.

Which namespace does Cache object belong to ?Cache object belongs to System.Web.Caching namespace.

Explain WCF callback behaviour ?Call back behaviour is similar to Service behaviour . They control endpoints created on client in duplex communication.

Explain WCF Operation behaviour ?Operation behaviour are scoped at Operation level. It is used for transaction flow , serialization , parameter handling.

Explain WCF Endpoint behaviour ?Endpoint behaviour are defined at endpoint level. They are used for inspecting and taking actions on messages as they come in and out of service.

Explain WCF Service behaviour ?Service behaviour run at service level and have access to all endpoints. They control instancing and transactions. They are also used for authorization and auditing.

State different types of primary WCF behaviours ?Different types of primary behaviours are as follows :
  1. Service Behaviour
  2. Endpoint Behaviour
  3. Operation Behaviour
  4. Callback Behaviour
What is the impact of IsReusable property in HTTPHandler?IsReusable property can be set to true or false.
If set to true then IHttpHandlerFactory object ( object which calls handler ) can place handler in pool and reuse it for better performance. If set to false , new instance must be created each time handler is needed.

How to create custom synchronous HTTPHandler ?Steps to create custom synchronous HTTP Handler :

  1. Implement IHttpHandler interface
  2. Implement ProcessRequest mehtod and IsReusable property
  3. Register handler in Web.config
  4. Add file name extension mapping to ASP.NET in IIS
State few built in HttpHandler in ASP.NETFew built-in httphandler in ASP.NET are :

  1. ASP.NET Page Handler - handler of all .aspx pages
  2. Web Service Handler - handler of all .asmx
  3. ASP.NET User Control handler - handler of all .ascx
  4. Trace Handler - for trace.axd
How do I add public events for Httpmodule in Global.asax ?You can add public events for Httpmodule using below syntax i.e

ModuleName_OnEventName in Global.asax .

Example

Session_OnStart ( Object sender , EventArgs e ) in Global.asax defines event handler for Start event of SessionStateModule

What are default httpmodules available for all ASP.NET Applications which are declared in machine.config ?

Default modules available for all applications are :

  1. SessionStateModule
  2. OutputCacheModule
  3. WindowsAuthenticationModule
  4. FormsAuthenticationModule
  5. PassportAuthenticationModule
  6. UrlAuthorizationModule
  7. FileAuthorizationModule
How to create Custom HTTP module ?The steps to create custom HTTP module are :

  1. Implement IHttpModule Interface
  2. Handle Init Method and register events one needs
  3. Handle the events
  4. Implement Dispose if one has to perform cleanup . This is optional
  5. Register module in Web.config
How are indexer declared ?Below is indexer declaration :
modifier return type this [argument list]
{
get
{
// Get codes goes here
}
set
{
// Set codes goes here
}
}
Where the modifier can be private, public, protected or internal. The return type can be any valid C# types. The 'this' is a special keyword in C# to indicate the object of the current class. The formal-argument-list specifies the parameters of the indexer. The formal parameter list of an indexer corresponds to that of a method, except that at least one parameter must be specified, and that the ref and out parameter modifiers are not permitted. Remember that indexers in C# must have at least one parameter. Other wise the compiler will generate a compilation error.

Difference between indexer and property ?

1. An indexer is identified by it's signature. But a property is identified it's name.
2. An indexer is always an instance member, but a property can be static also.
3. An indexer is accessed through an element access. But a property is through a member access.

How Do I Release COM objects?Runtime Callable Wrapper is managed  hence its lifetime is controlled by Common Language Runtime. The COM component is freed from memory when the garbage collector calls the Finalize() method on RCW. Internally, RCW calls Release() of IUknown interface on the COM object.

To explicitly remove COM objects from memory, invoke the static method on Marshal class in System.Runtime.InteropServices namespace:

using System.Runtime.InteropServices;

Marshal.ReleaseComObject(myAuthorRCW);

State some important things in .NET 3.0.NET 3.0 consists of :
  1. Windows Communication Foundation ( WCF )
  2. Windows Presentation Foundation ( WPF )
  3. Windows Workflow Foundation ( WF )
  4. Windows Cardspace
Question :

State whether below class relationship is correct or not . If not why ?

class A: B {}

class B: C {}
class C: A {}

Answer :

Above releationship is incorrect as it has circular relationship. This would result in compile-time error.

How can Validation Summary show validation errors in Message Box instead of Web page ?Set ShowMessageBox property to true and ShowSummary=false for ValidationSummary control.

State two importanrt properties of System.Exception Class ?Two properties of System.Exception Class are :
  1. Message
  2. InnerException
How to instantiate and invoke static and instance method using delegates ?Refer below code to understand :
using System;

delegate void DelMethod(int x); // This is the delegate declaration
// Example is Class containing static method and instance method to be instantiated
class Example
{
public static void StaticMethod(int i) {
Console.WriteLine("M1: " + i);
}
public void InstanceMethod(int i) {
Console.WriteLine("M3: " + i);
}
}
// Below class contains code to instantiate and invoke static and instance method using delegates
class Test
{
static void Main() {
DelMethod cd1 = new DelMethod (Example.StaticMethod); // Instantiate Static Method delegate
cd1(-1); // Invoke Static Method

Example c = new Example ();
DelMethod cd2 = new DelMethod (c.InstanceMethod); // Instantiate InstanceMethod delegate

cd2(5); // Invoke Instance Method
}
}

What are different types of remotable objects ?Two types of remotable objects :
  1. Marshal-by-value objects
  2. Marshal-by-reference objects
What are different types of configuration files in .NET Framework ?Different types of configuration files are :
  1. Machine configuration file
  2. Application configuration file
  3. Security configuration file
What are different types of assemblies ?Different types of assemblies are :
  1. Static and Dynamic assemblies
  2. Private and Shared assemblies
  3. Single file and Multiple file assemblies
What is CASPOL ?Caspol tool allows one to grant and modify permissions to code groups at user policy , machine policy and enterprise policy level

What does assembly version consists of ?Assembly version consists of four parts i.e. major version.minor version.build number.revision

What is computed column ?Computed Column is virtual column in table whose value is computed at runtime.The values are not stored in table but computed by the expression that defines column.

State different types of indexesThere are two types of indexes :
  1. Clustered Index
  2. Non Clustered Index
What does ACID stands for in SQL ?ACID stands for Atomicity ,  Consistency , Isolation and Durabilty .

What global variable is used to return number of rows returned by last Transact-SQL ?@@ROWCOUNT is global variable used to return number of rows returned by last Transact-SQL.

Question : Two TSQL statements are executed in below order :
DELETE FROM Employee where EmpID=10
UPDATE Employee set EmpSal = 10000 where EmpID = 15
SELECT @@ERROR

A. @@ERROR will store Error Number of Delete statement
B. @@ERROR will store Error Number of Update statement

Answer : B is correct option

Hint : @@ERROR contains error number of last TSQL statement executed.

@@ERROR has value of 0. What does it mean ?@@ERROR with value of 0 indicates no error. @@ERROR with non zero value indicates error.

What global variable is used to return error number of last Transact-SQL ?@@ERROR is a global variable used to return error number of last T-SQL.

Which interfaces to use or implement when sorting custom arrays ?Sorting in Custom Arrays can be acheived using one of following interfaces :
  1. IComparable
  2. IComparer
State some new data types in SQL Server 2008 ?New Data types in SQL Server 2008 are :

  1. DATE - occupies 3 bytes . Has accuracy of 1 day . Data stored in 'YYYY-MM-DD' format
  2. TIME - occupies 3 to 5 bytes . Has accuracy of 100 nanoseconds. Data stored in 'hh:mm:ss.nnnnnnn' format.
  3. DATETIME2 - occupies 6 to 8 bytes . Has accuracy of 100 nanoseconds. Data stored in 'YYYY-MM-DD hh:mm:ss.nnnnnnn' format.
  4. DATETIMEOFFSET - occupies 8 to 10 bytes . Has accuracy of 100 nanoseconds. Data stored in 'YYYY-MM-DD hh:mm:ss.nnnnnnn [+|-]hh:mm' format. The DATETIMEOFFSET data type is similar to DATETIME2 but has time zone component extra.


How to get distinct records using LINQ ?Distinct records can be obtained using Distinct() method. Please refer below code for more details :

Problem : Get Unique or Distinct First Name from Employee table
Solution :
var employeeDistinct= (from emp in Employee

                                    select emp.FirstName).Distinct();

What is ANSI_PADDING ?ANSI_PADDING can be set ON or OFF. It controls the way column stores values shorter than the defined size of the column, and the way the column stores values that have trailing blanks in char, varchar, binary, and varbinary data.

Transact SQL Statement to set it ON
SET ANSI_PADDING ON

Transact SQL Statement to set it OFF

SET ANSI_PADDING OFF

ANSI_PADDING setting is ON :
char(n) and binary(n) - Pads value with trailing blanks for char columns and with trailing zeros for binary columns to the length of column.
varchar(n) or varbinary(n) - Trailing blanks in varchar are not trimmed . Trailing zeroes in varbinary are not trimmed. Does not pads trailing blanks or zeroes to the length of column.

ANSI_PADDING setting is OFF :

char(n) and binary(n) - Pads value with trailing blanks for char columns and with trailing zeros for binary columns to the length of column.

varchar(n) or varbinary(n) - Trailing blanks in varchar are trimmed . Trailing zeroes in varbinary are trimmed. Does not pads trailing blanks or zeroes to the length of column.

What is extent in SQL Server ?Extents are basic unit in which space is allocated to tables and indexes. Extent is eight contiguous pages i.e 64 KB.

What is fundamental unit of storage in SQL Server ?Page

Different types of relationship in Class diagram ?Different types of relationship in Class diagram :

  1. Generalization
  2. Aggregation
  3. Composition
What are different types of DML ( Data Manipulation Language ) statementsTypes of DML statements :
  1. Select
  2. Insert
  3. Update
  4. Delete
What are different types of DCL statementsTypes of DCL statements :
  1. Grant
  2. Revoke
  3. Deny
What are different types of DDL statements ?Types of DDL statements :
  1. Create
  2. Alter
  3. Drop
What are different types of of TSQL statements ?Three types of of TSQL statements :
  1. Data Definition Language ( DDL )
  2. Data Control Language ( DCL )
  3. Data Manipulation Language ( DML )
What are different security mechanisms used in SQL Server ?Different security mechanisms used in SQL Server :
  1. Logins
  2. Users
  3. Roles
  4. Groups
What are different actions on ON DELETE clause of foreign key constraint ?Different actions on ON DELETE clause of foreign key constraint :
  1. NO ACTION specifies that the deletion fails with an error.
  2. CASCADE specifies that all the rows with foreign keys pointing to the deleted row are also deleted.
  3. SET NULL specifies that all rows with foreign keys pointing to the deleted row are set to NULL.
  4. SET DEFAULT specifies that all rows with foreign keys pointing to the deleted row are set to their default value.
What are different types of constraints ?SQL Server supports the following constraints:
  1. NOT NULL constraint
  2. Check constraint
  3. UNIQUE constraint
  4. PRIMARY KEY constraint
  5. FOREIGN KEY constraint
What are SQL Constraints ?
SQL Constraints are used to enforce integrity of database.

Difference between Unicode and non-Unicode datatype ?
Unicode datatypes are nchar, nvarchar, and ntext .
Non-Unicode datatypes are char, varchar, and text .


Difference between Unicode and non-Unicode datatype are :
  1. Unicode supports a wider range of characters.
  2. More space is needed to store Unicode characters.
  3. The maximum size of nchar and nvarchar columns is 4,000 characters, not 8,000 characters like char and varchar.
  4. Unicode constants are specified with a leading N: N'A Unicode string'.
  5. All Unicode data uses the same Unicode code page. Collations do not control the code page used for Unicode columns, only attributes such as comparison rules and case sensitivity.
What is Collations in SQL Server ?
Collations control physical storage of characters strings in SQL Server. Collation specifies bit patterns that represent each character and the rules by which characters are sorted and compared.

Collation specifies three properties:
  1. Sort order to use for Unicode data types ( nchar , nvarchar and ntext )
  2. Sort order to use for non-Unicode data types ( char , varchar and text )
  3. Code page to store non-Unicode character data
What is various Database objects in SQL ?Database objects in SQL are :
  1. Table
  2. Data Type
  3. View
  4. Stored procedure
  5. Function
  6. Index
  7. Constraint
  8. Rule
  9. Default
  10. Trigger
What does ABC stand for in WCF terminology ?ABC stands for address, binding, and contract:


• The address specifies where the messages can be sent (or where the service lives).

• The binding describes how to send the messages.

• The contract describes what the messages should contain.

Which namespace does WCF belong to ?
Answer  : WCF belongs to System.ServiceModel

State ways to host WCF Service ?WCF Service can be hosted in following four ways :
  1. Internet Information Server ( IIS )
  2. Windows Activation Service ( WAS )
  3. Self hosting
  4. Managed Windows Service

Please refer below links for more information :
Hosting WCF Service

What is Type Library Importer (Tlbimp.exe) ?The Type Library Importer or Tlbimp.exe is used to convert type definitions within COM component to equivalent definitions in CLR assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library. You can examine this file with tools such as Ildasm.exe.Santosh Singhhttp://www.blogger.com/profile/0455433154258677971902010-05-20T10:50:46.415-07:00How to change size of array ?Size of array can be changed using Array.Resize Method. Array.Resize Method can be used to increase or reduce size.

Syntax :
Array.Resize ( ref array , newsize )

Example :
int[] arrayInt = new int[10];
Resize the above array to new size 20

Array.Resize ( ref arrayInt , 20 )

Which namespace does Trace and Debug class belong to ?Trace and Debug class belongs to System.diagonastics

What are different types of WCF ContractsThere are five types of contracts :
  1. Service Contract
  2. Operation Contract
  3. Data Contract
  4. Message Contract
  5. Fault Contract

Please refer below links for more details :
http://www.alltechnicalfaqs.com/2010/05/wcf-contracts.html

How to sort array of primitive types in ascending and descending order ?We can sort array of primitive types using Array.Sort() and Array.Reverse() in ascending and descending order

Example :

// sort int array in ascending order


int[] intArray = new int[5] { 8, 10, 2, 6, 9 };
Array.Sort(intArray);
// write array
foreach (int i in intArray) Console.Write(i + " "); // output: 2  6 8 9 10

// sort int array in descending order


int[] intArray = new int[5] { 8, 10, 2, 6, 9 };
Array.Sort(intArray);
Array.Reverse(intArray);

// write array
foreach (int i in intArray) Console.Write(i + " "); // output: 10 9 8 6 2

How to convert string to Enum ?Please refer below example for answer :
public enum MonthEnum
{
  January = 1,
  February = 2,
  March = 3,
  April = 4,
  May = 5,
  June = 6,
  July = 7,
  August = 8,
  September = 9,
  October = 10,
 November = 11,
 December =12
 
}

To Convert string value to enum instance use below :
Month may= (MonthEnum)Enum.Parse(typeof(MonthEnum), "May");

How to get first record using LINQ ?First record of collection can be obtained using First() method .

Example :
Code :
string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
string startsWithO = strings.First(s => s[0] == 'o');
Console.WriteLine("A string starting with 'o': {0}", startsWithO);

Output :
A string starting with 'o': one

How to convert IEnumerable collection to IQueryable collection ?IEnumerable collection can be converted to IQueryable collection using AsQueryable method.

Example :
Object arrSearch is of IEnumerable type
To convert into IQueryable  use below :
IQueryable arrQuerySearch  = arrSearch.AsQueryable() ;



What is Replication in SQL ?Replication is the way to keep data synchronised in multiple datbases. SQL Replication consists of two important part :





  1. Publisher- Database server whose data has to be replicated
  2. Subscriber - Database servers that get data from publishers
Which Asp.net control is used to select mutiple list items? How would you acheive this ?ASP.NET control which allows multiple selection of items is ListBox. Set SelectionMode of ListBox control to Multiple to allow multiple selection of itmes.The following table brings out the similarities and differences between these controls.
<><><><><><><><><><><><>
Sl NoFeatureRepeaterDataListDataGrid
1.Default AppearanceNo Default AppearanceTableGrid
Pass null values to stored procedure from code behindHow to pass null values to stored procedure from code behind ?

Pass the parameter’s value as DBNull.Value from code-behind.

Difference between XML DOM and Simple API for XML
  1. XML DOM loads the entire xml document into memory whereas Simple API for XML ( SAX ) does not load entire xml document into memory
  2. XML DOM is used when you want to modify xml document and perform complex searches whereas SAX is not used when you want to modify xml document and perform complex searches


C# 3.0 Enhancements
Question :
Name few C# 3.0 enhancements ?
Answer :
The C# 3.0 language enhancements are as follows:
  1. Implicitly typed local variables
  2. Implicitly typed arrays
  3. Object initializers
  4. Collection initializers
  5. Auto-implemented properties
  6. Extension methods
  7. Lambda expressions
  8. Expression trees
  9. Query expressions
  10. Anonymous types
Compare Virtual-Override and NewVirtual-Override and New

Class Child inherits from Class Parent and has mehtod ShowVirtualOverride() and ShowNew() methods.
Please see the code snippet below and answer questions below:
 class Parent

{
     public virtual void ShowVirtualOverride()
    {
         Console.WriteLine("ParentVirtual");
    }
    public virtual void ShowNew()
   {
        Console.WriteLine("ParentNew");
    }
}

class Child : Parent
{
      public override void ShowVirtualOverride()
     {
          Console.WriteLine("ChildVirtual");
     }
     public new void ShowNew()
    {
         Console.WriteLine("ChildNew");
    }
}

Question 1:
What is output of below code :
Parent objA = new Parent();

objA.ShowVirtualOverride();
objA.ShowNew();

Answer 1:
Output is below :
ParentVirtual
ParentNew

Question 2:
What is output of below code :
Parent objB = new Clild();
objB.ShowVirtualOverride();
objB.ShowNew();

Answer 2:
Output is below :
ChildVirtual
ParentNew

Question 3:
What is output of below code :
Child objC = new Child();
objC.ShowVirtualOverride();
objC.ShowNew();

Answer 3:
Output is below :
ChildVirtual
ChildNew

Question 4:
What is output of below code :
Child objD = new Parent();
objD.ShowVirtualOverride();
objD.ShowNew();

Answer 4:
This gives compilation error

Difference between stored procedure and functionStored Procedure vs Function
  1. Stored procedure cannot be executed using SQL Select command whereas Function (UDF) can be executed using SQL Select command. Stored Procedure can be executed using execute command i.e EXEC or EXECUTE 
  2. Stored Procedure can return zero to n values whereas Function can return one value that is mandatory
  3. Stored Procedure can have input and output parameters whereas Function can have only input parameters.
  4. Stored Procedure can call functions whereas Function cannot call stored procedures.
  5. Stored Procedure exception handling can be done by try-catch block whereas Function exception handling cannot be done by try-catch block.
  6. Stored Procedure can't return a table variable although it can create a table while Function returns table variables.
  7. Stored Procedure can change the server environment or your operating system environment, while Function can change the server environment or your operating system environment
Question : Which shells support command-line editing in vi mode and emacs mode?

Answer : Following shells support editing in vi and emacs mode :
  1. Korn
  2. Bash
  3. TC
Question : What symbol is used to seperate commands ?
Answer : semi colon is used to seperate commands i.e ;

Question : What does the following code do? ls rep|| mkdir rep


Answer : This would run the mkdir command if the ls command doesn't execute successfully

What is difference between Dataset and DataReader ?
  1. Database Connection - Datereader requires an open database connection whereas Dataset does not require an open database connection
  2. Namespace - Datereader belongs to System.Data.SqlClient or System.Data.OleDB whereas Dataset belongs to System.Data
  3. Record Set - Datereader  is forward only and read only whereas  Dataset  is not forward only and read only
  4. Data Source - Datereader  can get data from managed data provider. Data cannot be loaded manually whereas Dataset  can get data from managed data provider .Data can be loaded manually by XML etc.
  5. Performance -  DataReader has faster retrival and better performance then Dataset
State few tips to improve performance of Web Application ?Tips to improve performance :
  1. Connection Pooling : Connection between Web Application and SQL Server is expnsive. So, connection pooling can improve performance.To use connection pooling, use the same connection string. Also , open the connection, do the work and then close the connection.
  2. Paged Data Access : Datagrid with paging would show fixed number of records. Suppose a Datagrid is bound with 100000 records but if page size is 25 , then Datgrid would display only 25 records out 100000 records. Data layer has to fetch all 100000 records and bind to Datgrid hence performance would be bad. So , Paged Data Access would really improve performance wherein you fetch only fixed number of records to be shown in Datagrid using stored procedure.
  3. Caching : Caching data would improve performance. Data is used more than once is good situation to use Caching. Also, data is general and not user or request specific is an ideal situation for Caching
  4. ViewSate : Viewstate is used to store state data in hidden field in page.When the page is posted back to the server, the server can parse, validate, and apply this view state data back to the page's tree of controls. There are a number of drawbacks to the use of view state, however. First of all, it increases the total payload of the page. There is also an additional overhead incurred when serializing or deserializing view state data that is posted back to the server. Lastly, view state increases the memory allocations on the server.So diabling View State will improve performanca of page.Within a control, you simply set the EnableViewState property to false, or you can set it globally within the page using this setting.
  5. Return Muliple RecordSet : Returning multiple recordset will improve performance by reducing time spent and resource spent to cumminicate with SQL
What is ASP.NET impersonation ?When impersonation is enabled, only your application code runs under the context of the impersonated user. Applications are compiled and configuration information is loaded using the identity of the ASP.NET process.
ASP.NET impersonation is disabled by default. If impersonation is enabled for an ASP.NET application, that application runs in the context of the identity whose access token IIS passes to ASP.NET.

You control impersonation using the identity configuration element.
<configuration>
<system.web>
<identity impersonate="true">
</system.web>
</configuration>
or
<identity impersonate="true" password="********" username="testDomain\Santosh">

What is authorization and how ASP.NET authorization works ?Authorization is used to determine whether user has access to resource or not.
There are two ways to authorize a resource :
File authorization : is performed by the FileAuthorizationModule. It checks the access control list (ACL) of the .aspx or .asmx handler file to determine whether a user should have access to the file.

URL authorization : is performed by the UrlAuthorizationModule, which maps users and roles to URLs in ASP.NET applications. This module can be used to selectively allow or deny access to arbitrary parts of an application (typically directories) for specific users or roles.

To enable URL authorization, you specify a list of users or roles in the allow or deny elements of the authorization section of a configuration file.


<[allow/deny] users roles verbs />


verbs mean actions such as GET , HEAD and POST

What is authentication and different types of ASP.NET authentication ?Authentication is process of obtaining credentials such as username and password and validating the credentials.

There are 3 types of ASP.NET authentication :
  1. Windows authentication
  2. Form authentication
  3. Passport authentication
What are few properties and methods that are common to all validation controls ?

The important properties and methods common to all validation controls are as follows:
  1. ControlToValidate - Specifies which control to be validated
  2. IsValid - Boolean value stating whether control to be validated is valid or not
  3. ErrorMessage - Error message which will be displayed in Validation Summary
  4. Validate - Method to validate and set IsValid property
  5. Display - This specifies how the error message is shown.
Possible display options are :
  • None (The validation message is never displayed.)
  • Static (Space for the validation message is allocated in the page layout.)
  • Dynamic (Space for the validation message is dynamically added to the page if validation fails.)
What are different validation controls in ASP.NET?

Different validation controls in ASP.NET are as follows :
  1. RequiredFieldValidator
  2. CompareValidator
  3. RangeValidator
  4. RegularExpressionValidator
  5. CustomValidator
  6. ValidationSummay
Explain various ASP.NET Page lifecycle events ?
Various Page lifecycle events are listed below :
  1. PreInit - Check IsPostBack Property , Create dynamic controls , Set Master page , Theme and Profile properties dynamically.
  2. Init - Read and Initialize control properties
  3. InitComplete
  4. PreLoad - Use this event if one wants to do something before Page or Control load
  5. Load - Set Control properties etc.
  6. Control Events - Handle Events specific to controls like button , link etc
  7. LoadComplete
  8. PreRender - occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls.
  9. SaveStateComplete - perform tasks that require view state to be saved, but that do not make any changes to controls.
  10. Render - calls this method on each control.
  11. Unload - occurs for each control and then for the page. 
What is difference between User Contol and Custom Control ?


Ease of Creation : User Control is easy to create whereas Custom Control is complex to create
Good For : User Control good for static content whereas Custom Control good for dynamic content
Usage : User Control need to create seperate copy for each application . Custom control , one single copy is required and placed in GAC
Toolbox : User control cannot be added to Visual Studio toolbox . Custom control can be added to Visaul Studio Toolbox

What are the different IIS authentication modes ?

 IIS provides a variety of authentication schemes:

• Anonymous (enabled by default) -  Client does not provide any credetials
• Basic  - Client supplies username and password.Username and password transmitted in clear text
• Digest - Uses MD5 algorithm
• Integrated Windows authentication - can use either NTLM or Kerberos V5 authentication and only works with Internet Explorer 2.0 and later

Difference Between String and String Builder ?

String is collection of char objects . String is immutable ( read only ) since its value cannot be modified once it is created . It belongs to System namespace .
String concatenation always creates a new object from existing string and new data
StringBuilder is mutable string of characters . It belongs to System.Text namespace. StringBuilder does not creates a new object

What are various OOPs concept that C# supports?OOPs concepts that C# supports are :
  1. Abstraction : is a process that involves identifying the crucial behavior of an object and eliminating irrelevant and tedious details. Suppose you have to design a software to calculate area and perimeter . So you have a abstract class for Shape with two behaviours CalculateArea and ClaculatePerimeter as behaviour. So all classes i.e Square, Rectangle etc has to inherit and forced to implement these two behaviours.
  2. Encapsulation :  is often referred to as information hiding.Encapsulation makes it possible to separate an object’s implementation from its behavior—to restrict access to its internal data. This restriction allows certain details of an object’s behavior to be hidden. It allows us to create a “black box” and protects an object’s internal state from corruption by its clients. 
  3. Inheritance : enables to create a new class that reuses , extends , modifies the behaviour of another class . The class whose members and behaviours are inherited is known as base class . The class which inherits another class is known as derived class.
  4. Polymorphism refers to the ability to assume different forms.
How would you implement delegate calling a method ?
public class Operation
{
   public int Add ( int a , int b )
{
return (a+b);
}
}
We have to call above method using delegate
Steps below :
  1. Declare a delegate : public delegate int DelAdd ( int a , int b );
  2. Instantiate a delegate : Operation obj = new Operation() ; DelAdd objDel = new DelAdd(obj.Add);
  3. Call a delegate : objDel(1,2);
A delegate can be called synchronously as shown above or asynchronously by using BeginInvoke and EndInvoke methods.


What is multicast delegate ?

Multicast delegate contains references to more than one function . Use + operator to add a delegate component to multicast delegate . - operator is used to remove delegate component from multicast delegate

Explain Covariance and Contravariance in Delegates ?


Covariance permits a method to have a more derived return type than what is defined in the delegate.
Contravariance permits a method with parameter types that are less derived than in the delegate type.

Comparison of Usage of Delegate and Interface ?

Use a delegate when:
  1. An eventing design pattern is used. • It is desirable to encapsulate a static method.
  2. The caller has no need access other properties, methods, or interfaces on the object implementing the method.
  3. Easy composition is desired
  4. A class may need more than one implementation of the method
Use an interface when:
  1. There are a group of related methods that may be called.
  2. A class only needs one implementation of the method.
  3. The class using the interface will want to cast that interface to other interface or class types.
  4. The method being implemented is linked to the type or identity of the class: for example, comparison methods.
Describe new features introduced with C# 2.0 ?

New features C# 2.0 are:
  1. Generics - The .NET Framework class library contains several new generic collection classes in the System.Collections.Generic namespace. These should be used whenever possible in place of classes such as ArrayList in the System.Collections namespace.
  2. Iterators - make it easier to dictate how a foreach loop will iterate over a collection's contents.The yield keyword is used to specify the value, or values, returned. When the yield return statement is reached, the current location is stored. Execution is restarted from this location the next time the iterator is called. You can use more than one yield statement in the same iterator
  3. Partial Classes - Partial type definitions allow a single type, such as a class, to be split into multiple files. The Visual Studio designer uses this feature to separate its generated code from user code.
  4. Nullable Types - Nullable types allow a variable to contain a value that is undefined. Nullable types are useful when working with databases and other data structures that may contain elements that contain no specific values.
  5. Anonymous Methods - It is now possible to pass a block of code as a parameter. Anywhere a delegate is expected, a code block can be used instead: there is no need to define a new method.
  6. Namespace alias qualifier - The namespace alias qualifier (::) provides more control over accessing namespace members. The global :: alias allows access the root namespace that may be hidden by an entity in your code.
  7. Static Classes - Static classes are a safe and convenient way of declaring a class containing static methods that cannot be instantiated. In C# version 1.2 you would have defined the class constructor as private to prevent the class being instantiated.
  8. External Assembly Alias - Reference different versions of the same component contained in the same assembly with this expanded use of the extern keyword.
  9. Property Accessor Accessibility - It is now possible to define different levels of accessibility for the get and set accessors on properties.
  10. Covariance and Contravariance in Delegates -The method passed to a delegate may now have greater flexibility in its return type and parameters.
Difference between Interface and Abstract Class


Compare Interface with Abstract Class

Features

Interface

Abstract Class

Inheritance

A class may inherit several interfaces.

A class may inherit only one abstract class.

Code

An interface contains only signature but no code

An abstract class can contain complete, default code and/or just signature that have to be overridden.

Access Modifiers

An interface cannot have access modifiers

An abstract class can contain access modifiers

Defines

Interfaces are used to define the peripheral abilities of a class

Abstract class defines the core identity of a class and there it is used for objects of the same type.

Homogeneity

If various implementations only share method signatures then it is better to use Interfaces.

If various implementations are of the same kind and use common behaviour or status then abstract class is better to use.

Fields

No fields can be defined

Fields can be defined


Explain features of Abstract method ?Features of abstract method is below :
  1. Cannot be declared in non abstract class . Can only be declared in abstract class.
  2. Cannot have actual implementation or method body
  3. Cannot have static or virtual modifier in abstract method declaration
Explain Abstract class ?

Abstract class has following features :
  1. cannot be instantiated
  2. contain abstact methods and properties
  3. cannot modify abstract class with sealed modifier
  4. non abstract class which inherits from abstract class must implement inherited abstract methods and properties
  5. An abstract class that implements an interface might map the interface methods onto abstract methods
abstract class Shapes
{
abstract public int Perimeter();
}

class Square : Shapes
{
int x;
public override int Perimeter()
{
return 4x;
}
}

Difference between throw and throw exception ?

throw would keep the stack trace intact whereas throw ex will clear the stack trace so point of exception will be line throw ex and not the actual line where the error occured

What are different access modifiers/specifiers in C# ?


Different access modifiers/specifiers in C# :
  • Public - Any class or assembly can access
  • Protected - Access is limited to the containing class or classes derived from the containing class
  • Internal - Access is limited to the current assembly.
  • Protected Internal - Access is limited to the current assembly or types derived from the containing class.
  • Private - Access is limited to the containing class
What are different isolation levels in SQL Server?

Isolation level in SQL Server are as follows :
  1. Read Uncommitted - Lowest level of isolation . Uncommitted data can be read . Hence we will have Dirty Read , Nonrepeatable read and Phantom record. Shared and exclusive locks are not honoured .
  2. Read Committed - This is SQL's default isolation level . Uncommitted data cannot be read. It allows inserts and deletes. Shared locks are held hence dirty read is avoided but we still have Nonrepeatable read and Phantom record
  3. Repeatable Read - It prevents data updation . Locks are placed on the data , preventing other users from updating the data. Prevents non-repeatable reads but phantom rows are still possible.
  4. Serializable - Highest level of isolation . Prevents other users from updating or inserting rows into the dataset until the transaction is complete . We don't have Dirty Read , Nonrepeatable read and Phantom record

What is normalization ?
Normalization is a method to seperate data into multiple tables and relate these multiple tables. Some benefits of normalized database :
1) Removes redundancy of data
2) Faster sorting

What is Class Diagram ?

Class Diagram is static diagram which contains following : Classess, Attributes and Relationship
Class is represented by box containg three compartment which contain Class name, attributes ( ie.properties ) and behaviours ( i.e methods ).  Access modifiers are represented in following way in Class diagram :
  1.  "+" for public
  2. "#" for protected
  3.  "?" for private
What are different types of diagrams in UML ?


Different types of diagrams in UML :
  1. UseCase diagram
  2. Class diagram
  3. Object diagram
  4. State diagram
  5. Sequence diagram
  6. Collaboration diagram
  7. Activity diagram
  8. Deployment diagram
  9. Component diagram
Santosh Singhhttp://www.blogger.com/profile/0455433154258677971902010-05-29T10:56:48.630-07:00How to redirect a page using JavaScript ?Use window.location i.e window.location="http://www.redirectpage.com/redirect.html";

What are benefits and drawback of AJAX ?Benefits of Ajax :
  1. Improved user experience
  2. Asynchronous processing
  3. Reduced server hits and network load
  4. Platform and architecture neutrality
  5. Multibrowser support
  6. Faster page renders and improved response times

Drawback of Ajax :
  1. Massive usage and dependency on JavaScript
Difference between web services & remoting?

1) Protocol : Webservice can be accessed over HTTP protocol . Remoting can be accessed over any protocol (including TCP, HTTP, SMTP etc)
2) Interoperability : Webservices support interoperability across platforms, and are ideal for heterogeneous environments. Remoting requires the client be built using .NET, enforcing homogenous environment.
3) Ease of programming : Webservice is easy to create and deploy . Remoting is complex to create
4) State Management : Webservices are stateless . Remoting support for both stateful and stateless environments through Singleton and SingleCall objects

What is WCF ?

WCF stands for Windows Communication Foundation. WCF was introduced with .NET Framework 3.0. It provides combined features of Web Services , Remoting , MSMQ and COM+ . It is used for building and deploying network distributed services

What is Abstract Factory Pattern ?

Abstract Factory Pattern is type of Creational pattern . This is used to create objects of related class without specify concrete class.

Abstract Factory has :
 1) Abstarct Factory - declares an interface for operations that create abstract product objects.

 2) Concrete Factory - implements the operations to create concrete product objects.
 3) Abstract Product - declares an interface for a type of product object.
 4) Concrete Product - defines a product object to be created by the corresponding concrete factory. It implements the Abstract Product interface.
 5) Client - uses only interfaces declared by Abstract Factory and Abstract Product classes.

What is singleton design pattern ?Singleton design pattern is type of Creational Design pattern . It creates a single instance object which caters to all the clients.

Singleton Design pattern has :

  1. It has private constructor so that instance of class cannot be created anywhere but inside its own methods.
  2. It has static read only member so that instance is created only once .
  3. It has an instance property to return singleton object instance
 Code snippet for simple singleton :
public sealed class Singleton
{
// private constructor
private Singleton()
{
}
// static readonly member
static readonly Singleton instance = new Sinleton();
// static instance property
public static Singleton Instance
{
get { return instance ; }
}

}

What is difference between Control Flow and Data Flow in SSIS ?


Difference between Control Flow and Data Flow in SSIS are as follows :
  1. The smallest unit in Control Flow is task whereas smallest unit in Data Flow is component
  2. In Control FLow , Tasks require completion (success, failure or completion) before moving to next task. In Data Flow , one component will not wait for other component to finish, all of them will work together in processing and managing data in streaming way.
What is SSRS ?

SSRS stands for SQL Server Reporting Services . SSRS is server based reporting platform. It provides reporting functionality from different datasourses. SSRS enables creation , management and delivery of reports.

Explain about software estimation ?

Software estimation is used to estimate time and resource required for a particular project.
There are three types of estimation :
  1. Ballpark estimates or order of magnitude: This estimate would be two to four times actual value ideally.
  2. Rough estimates: This estimate would be closer to the actual value. Ideally it will be about 50% to 100% off the actual value. It is used when needs are well understood
  3. Fair estimates: This is a very good estimate. Ideally it will be about 25% to 50% off the actual value. Fair estimate is used in maintainence projects where you know what needs to be done and you have already done it. 
Order of magnitude estimation :
Break project into number of tasks
Evaluate each task based on complexity i.e ( Low , Medium , High )  and size of work ( Small, Medium, Large)
Once this done , then estimate time for each task based on complexity and size of work. For example , Low complexity and small sized work would require a weeks time.

What happens to the objects which survive a garbage collection?

New objects are created in generation 0. Those which survive first collection are moved to the generation 1, after second collection the survived objects are moved to the generation 2 and stay in that generation since the max number of generation supported by CLR is 2. In other words, the overall number of generations supported is 3 (0, 1 and2)

Compare Application domain and Thread ?


Application domain vs Thread
Application domain is isolation boundary for security , reliability , versioning and unloading of managed code . Thread are operating system construct to execute managed code ( used by CLR ) .

Managed code is loaded in application domain and run by thread.

An application domain may contain zero or one or more threads.

What is JIT Compiler ?JIT stands for Just in Time . JIT compiler converts MSIL code to runtime or machine code. There are three basic types of JIT compiler :

  1. Pre JIT
  2. Econo JIT
  3. Normal JIT
What is MSIL ?

MSIL stands for Microsoft Intermediate language . All .NET Code is compiled into MSIL Code . The MSIL Code is converted to machine code at runtime by JIT Compiler

What is relationship between CTS and CLS ?

CTS defines the rules the CLR follows to declare, use and manage types. CTS enables cross-language integration, type safety, and high-performance code execution.
CLS rules that governs the interoperation of types in different programming languages. Targeting the CLS is an excellent way to ensure cross-language interoperation.

What is CLS ?

CLS stands for Common Language Specification.It is subset of CTS . It defines rules that governs the interoperability of langaunages. All .NET compliant languages should adhere to CLS .

What is CTS ?

CTS stands for Common Type System. It helps in language interoperability. It defines how to define and use types. Interger is VB.NET and int is C# is coverted to System.Int32.

What are few important components of .NET Framework ?

Two important component of .NET Framework :
  1. CLR
  2. .NET Class Libraries
What is CLR ?

CLR stands for Common Language Runtime. CLR provides the execution environment for .NET Code. CLR provides following features :

  1. Garbage Collection
  2. Memory Management
  3. Code Access Security
  4. Code Verification etc

3 comments:

  1. This post is simple but great! I recommend it for all software employees.

    ReplyDelete
    Replies
    1. Thanks . Please provide any interview questions you want us to answer

      Delete
  2. The combined Questions
    will be mostly asking for the freshers as they will check the basics for all the languages.Even i faced this many time so i know better!

    ReplyDelete

Labels

.NET Framework Interview Questions (7) .NET Interview Questions (10) .NET Remoting Interview Questions (1) ADO.NET and BLOB Error (1) ADO.NET Interview Questions (4) Agile Articles (9) AJAX Articles (5) AJAX Interview Questions (11) Algorithms (2) Analytics Articles (2) Analytics Interview Questions (3) Android FAQs - Part 1 (2) Articles (13) ASP.NET Articles (24) ASP.NET Error and Resolution (4) ASP.NET Interview Questions (23) ASP.NET Tutorial (8) AWS Interview Questions (16) Business Analyst Interview Questions (1) Cloud Computing Interview Questions (16) CSharp Articles (17) CSharp Interview Questions (32) CSharp Tutorial (17) Data Analysis (2) Data Structure (1) Design Pattern Articles (5) DevOps Tutorial (1) Digital Marketing Interview Questions (1) Download Templates (1) Error Resolution (6) Excel Articles (9) Excel Macros (1) Excel Tips and Tricks (10) HTML5 Interview Questions (3) HTML5 Tutorial (3) Interview Preparation (2) Interview Questions (24) Introduction to Business Analytics (10) Introduction to Python (7) Introduction to R Programming (23) JAVA Articles (6) Java Tutorial (5) LINQ Articles (4) LINQ Interview Questions (2) LINQ Tutorial (3) Microservices Interview Questions (1) MVCInterviewQuestions (2) OOPs Interview Questions (4) Oracle 9i Tutorial (14) Oracle Articles (2) Oracle Interview Questions (15) Outlook Error (1) PHP Interview Questions (3) PHP Tutorial (3) Product Management (12) Product Management Interview Questions (14) Product Owner Interview Questions (2) Program Management (5) Project Management (13) Project Management Articles (34) Project Management Interview Questions (25) Quiz (1) RallyDev Help (1) Scrum Master Interview Questions (11) Selenium Tutorial (1) Sharepoint Articles (1) SQL Interview Questions (23) SQL Server Articles (20) SSIS Interview Questions (6) SSRS Interview Questions (1) Technical Program Management (12) Technical Program Management - Interview Questions (24) TechnicalProgramManagement (5) Threading Interview Questions (2) Tutorial (8) UML Articles (3) UML Interview Questions (2) Unix (3) UNIX Tutorial (3) WCF Articles (20) WCF Interview Questions (9) WCF Quiz (2) WCF Tutorial (16) Web Service Articles (5) Web Service Interview Questions (3) Window Azure (1) XML Articles (6) XML Interview Questions (3) XML Tutorial (3)