81

What is index in database.

 
Indexes in databases are similar to indexes in books. In a database, an index allows the database program to find data in a table without scanning the entire table. An index in a database is a list of values in a table with the storage locations of rows in the table that contain each value. Indexes can be created on either a single column or a combination of columns in a table and are implemented in the form of B-trees. An index contains an entry with one or more columns (the search key) from each row in a table. A B-tree is sorted on the search key, and can be searched efficiently on any leading subset of the search key.
82

What is disadvantage of index in database.

Every index increases the time in takes to perform INSERTS, UPDATES and DELETES, so the number of indexes should not be very much.
83

Explain about Clustered and non clustered index?

 

A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.

A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf nodes of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

84

What is sorting and what is the difference between sorting & clustered indexes?

 

The ORDER BY clause sorts query results by one or more columns up to 8,060 bytes. This will happen by the time when we retrieve data from database. Clustered indexes physically sorting data, while inserting/updating the table.

85

Difference between char and nvarchar / char and varchar data-type?

 

char(n) - Fixed-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is n bytes. The SQL-92 synonym for char is character.

nvarchar(n) - Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for nvarchar are national char varying and national character varying.

varchar[(n)] - Variable-length non-Unicode character data with length of n bytes. n must be a value from 1 through 8,000. Storage size is the actual length in bytes of the data entered, not n bytes. The data entered can be 0 characters in length. The SQL-92 synonyms for varchar are char varying or character varying.

86

What are the difference between a function and a stored procedure in SQL?

 
a). Functions can be used in a select statement where as procedures cannot

b). Procedure takes both input and output parameters but Functions takes only input parameters

c). Functions cannot return values of type text, ntext, image & timestamps where as procedures can

d). Functions can be used as user defined datatypes in create table but procedures cannot
87

What is Triggers?

 
Triggers are a type of stored procedure attached to a table or view and are executed only when the contents of a table are changed. They can be used to enforce most any business rule, and are especially important for dealing with situations that are too complex for a check constraint to handle.

The main advantage that triggers have over constraints is the ability to directly access other tables, and to execute multiple rows at once. In a trigger we can run almost every T-SQL commands, except for the following.
ALTER DATABASE, CREATE DATABASE, DROP DATABASE, RESTORE LOG, RECONFIGURE, RESTORE DATABASE.

There are two different models of trigger:
Instead-of – Meaning that the trigger operates instead of the command (INSERT, UPDATE or DELETE) affecting the table or view. In this way, we can do whatever we want with the data, either modifying it as sent, or putting is into another place. We can have only a single INSERT, UPDATE, and DELETE trigger of this type per table. You can however combine all three into one and have a single trigger that fires for all three operations.

After – Meaning the trigger fires after the command has affected the table, though not on views. After triggers are used for building enhanced business rule handlers and you would generally put any kind of logging mechanisms into them. You may have an unlimited number of after triggers that fire on INSERT, UPDATE and DELETE or any combination of them. Even if we have an instead-of trigger, we may still have as many after triggers as wanted, since they can all be combined into a single
trigger.
88

Difference between trigger and stored procedure?

 
Trigger will get execute automatically when an UPDATE, INSERT, or DELETE statement is issued against a table or view.

We have to call stored procedure manually, or it can execute automatic when the SQL Server starts (You can use the sp_procoption system stored procedure to mark the stored procedure to automatic execution when the SQL Server will start.
89

Difference between old ASP and ASP.Net?

 
 
- ASP is Interpreted language based on scripting languages like Jscript or VBScript.
- ASP has Mixed HTML and code.
- Limited development and debugging tools available(difficult to debug).
- Limited OOPS support.
- Limited session and application state management.
- Poor Error handling system.
- No in-built support for XML.
- No fully distributed data source support.
while
- ASP.Net is supported by compiler and has compiled language support.
- Separate code and design logic possible.
- Variety of compilers and tools available including the Visual studio.Net.
- Completely Object Oriented.
- Complete session and application state management.
- Full proof error handling possible.
- Full XML Support for easy data exchange.
- Fully distributed data source support.

 
90

What are the difference between Structure and Class?

 
 
- Structures are value type and Classes are reference type.

- Structures can not have contractors or destructors. Classes can have both contractors and destructors.

- Structures do not support Inheritance, while Classes support Inheritance.
 
91

What are the difference between Const and Readonly?

 
 
- A const can not be static, while readonly can be static.

- A const need to be declared and initialized at declaration only, while a readonly can be initialized at declaration or by the code in the constructor.

- A const’s value is evaluated at design time, while a readonly’s value is evaluated at runtime.
 
92

Differences between dataset.clone and dataset.copy?

 
 
Dataset.clone copies just the structure of dataset (including all the datatables, schemas, relations and constraints.), However it doesn’t copy the data. On the other hand dataset.copy, copies both the dataset structure and the data.
 
93

Difference between Code behind and inline in asp.net?

 
 
Code-behind is code written in a separate file (.cs or .vb ) and referenced by the .aspx page.
Inline code written along with the html and design blocks in an .aspx page.
 
94

What are the different types of Validation Controls?

 
 
There are six types of validation controls available:
1. RequiredFieldValidator
2. RangeValidator
3. RegularExpressionValidator
4. CompareValidator
5. CustomValidator
6. ValidationSummary

 
95

How to Manage State in ASP.Net?

 
 
There are several ways to manage a state.
- ViewState
- QueryString
- Cookies
- Session
- Application

 
96

What are the different methods available under sqlcommand class to access the data?

 
 
ExecuteReader –Used where one or more records are returned – SELECT Query.

ExecuteNonQuery – Used where it affects a state of the table and no data is being queried - INSERT, UPDATE, DELETE, CREATE and SET queries.

ExecuteScalar – Used where it returns a single record(a single value normally)


 
96

How to Delete Exists file using C#.

 
 
//Function User for Delete File from the System
private void DeleteExistingFile(string strFileName)
{
//Checking that file exist or not inside folder
if (System.IO.File.Exists(Server.MapPath("FolderName/" + strFileName.ToString()).Trim()))
{
try
{ //If file exits then delete it from the folder
System.IO.File.Delete(Server.MapPath("FolderName/" + strFileName.ToString()).Trim());
}
catch(Exception ex)
{
//In case of error, write Error Code
}
}
}
 
97

How to get application path or assembly path in C#.

 
 
//Create the assembly object
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

//Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.
System.Uri uri = new Uri(assembly.CodeBase);

//Get the actul path of your application or assembly
Path =System.IO.Path.GetDirectoryName(Convert.ToString( uri.LocalPath));
 
  Interview Page : 1 2 3