Sunday, 29 December 2013

Some Questions

INTERVIEW QUESTIONS IN ASP.NET & SQL


Q 1 What Is CLR ?
Q 2 What is CLR HOST?
Q 3 What is CTS?
Q 4 What is CLS?
Q 5 What is an Intermediate Language?
Q 6 What is Just In Time Compiler?
Q 7 What is Portable executable (PE)?
Q 8 What is Managed Code?
Q 9 What is UnManaged Code?
Q 10 What is Garbage Collector?

Q 11 >What is a Strong Name?
Q 12 What are the steps to create Strong Name?
Q 13 What are the Problems faced using Strong Name?
Q 14 What is Program Database?
Q 15 What is Delay Signing?
Q 16 What is an Assembly?
Q 17 What are the Contents of an Assembly?
Q 18 What are the Types of an Assemblies?
Q 19 What is a Satellite assembly?
Q 20 What are the Steps to Create Satellite Assembly?

Q 21 >What is an Assembly Loader?
Q 22 What is Multi Module Assembly or Assembly Linker?
Q 23 What is an Assembly Manifest?
Q 24 What is a Metadata?
Q 25 What is a Base class in .Net?
Q 26 What is Full Assembly Reference?
Q 27 What is Partial Assembly Reference?
Q 28 What is an Assembly Qualified Name?
Q 29 What is ILDASM (Intermediate Language Disassembler)?
Q 30 What is Global Assembly Cache?

Q 31 >What is an Attribute?
Q 32 What is Serialization & DeSerialization?
Q 33 Where Serialization is used?
Q 34 What are the types of Serialization available in .net?
Q 35 What is Binary Serialization?
Q 36 What are the Advantages & Disadvantages of Binary Serialization?
Q 37 What is SOAP Serialization?
Q 38 What are the Advantages of SOAP Serialization?
Q 39 What is a XML Serialization?
Q 40 What are the Advantages of XML Serialization?
Q 41 >What is Custom Serialization?
Q 42 What is a Namespace?
Q 43 What is GUID?
Q 44 What is a Formatter?
Q 45 What is a Binary Formatter?
Q 46 What is a SOAP Formatter?
Q 47 What is Reflection?
Q 48 What is Thread and Process?
Q 49 What are the difference between a Dll and an Exe?
Q 50 What are Globalization and Localization?

Q 51 >What is a Resource File?
Q 52 What is Code Access Security(CAS)?
Q 53 What is difference between Code Based Security and Role Based Security?
Q 54 What is difference between Invoke and Begin Invoke
Q 55 What is the difference between Debug and Trace?
Q 56 What is a Debug version of a code?
Q 57 What is a Release version of a code?
Q 58 What is an IDisposable Interface?
Q 59 What is Finalize block in .net?
Q 60 What is Dispose block in .net?

Q 61 >What is Runtime Host?
Q 62 What is Connection Pooling?
Q 63 What are the main parameters used by Connection Pooling?
Q 64 What is Connection Pool Manager?
Q 65 What is Object Pooling?
Q 66 What are the Advantages of Object Pooling?
Q 67 What is the Difference between Connection Pooling and Object Pooling?
Q 68 What is an Indexer?
Q 69 What are the important points to remember on indexers?
Q 70 What is the Difference between Indexers and Properties?

Q 71 >What are the different Access Modifiers available?
Q 72 What are the differences between Class and Struts?
Q 73 What are the Similarities between Class and Struts?
Q 74 What is the term Virtual means?
Q 75 What is a Sealed Class?
Q 76 What is Polymorphism?
Q 77 What are the Types of Polymorphism?
Q 78 What is Method Overloading? Or What is Early Binding?
Q 79 What is Method Overriding or What is Late Binding?
Q 80 What is an Inheritance?

Q 81 >What are the Types of Inheritance?
Q 82 What is Multiple Inheritance?
Q 83 What are the examples of Multiple Inheritance?
Q 84 What are the Advantages of Inheritance?
Q 85 What is an Encapsulation?
Q 86 What are the examples of Encapsulation?
Q 87 What is an Abstraction?
Q 88 What are the examples of Abstraction?
Q 89 Difference between Encapsulation and Abstraction ?
Q 90 What is an Abstract Class?
 
Q 91 >What is an Interface?
Q 92 What is a difference between Abstract Class and Interface?
Q 93 What is a Constructor?
Q 94 What is a Constructor chaining?
Q 95 What are the Types of constructors?
Q 96 What is a Private Constructor?
Q 97 What is a Static Constructors?
Q 98 What are the features of Static Constructor?
Q 99 What is a Default Constructor?
Q 100 What is a COPY Constructor?

Q 101 >What is a Parameterized constructor?
Q 102 What is a Singleton Class?
Q 103 What is a Partial Class?
Q 104 What is a Partial Method?
Q 105 What is a Delegate?
Q 106 What is a Syntax of Single class delegate?
Q 107 What are the advantages of Delegates?
Q 108 What is a Multicast Delegate?
Q 109 What is an Event?
Q 110 What is a Hash Table?

Q 111 >What is the Constructor of Hashtable?
Q 112 What is an Array?
Q 113 What is a Single-dimensional arrays?
Q 114 What is a Multidimensional arrays?
Q 115 What are Jagged arrays?
Q 116 What are Mixed Arrays?
Q 117 What is an ArrayList?
Q 118 What is the difference between Array and Array List?
Q 119 What is the Difference between Array and Collections?
Q 120 What is the difference between Array.Copy and Array.Clone?

Q 121 >What is a Shallow Copy?
Q 122 What is a Deep Copy?
Q 123 What are the different String Compare options available?
Q 124 What is a Statics Class
Q 125 What are the advantages of using Static Class?
Q 126 List some of the main features of a Static Class?
Q 127 What is a Static Member?
Q 128 What is a Static Variable?
Q 129 What is a Static Method?
Q 130 What is a Nested Class?

Q 131 >What is Shadowing or Hiding?
Q 132 What are Out and Ref parameters?
Q 133 What are the differences of Out and Ref Parameters?
Q 134 What are the differences between String and String Builder?
Q 135 Why C# is strongly typed language?
Q 136 What are Imperative and Interrogative function?
Q 137 What is a Collection Class?
Q 138 What are the differences between Const & Readonly?
Q 139 What is a Stack?
Q 140 What is a Heap?

Q 141 >What are Value Types?
Q 142 What are Reference Types?
Q 143 What are Boxing and UnBoxing means?
Q 144 What is Early Binding?
Q 145 What is Late Binding?
Q 146 What are the different WCF binding available?
Q 147 What is a BasicHttpBinding?
Q 148 What is a WSHttpBinding?
Q 149 What is a NetTcpBinding?
Q 150 What is a WSDualHttpBinding?

Q 151 >What is an ASP.NET Application and Page Life Cycle?
Q 152 What are the Steps for ASP.net environment creation?
Q 153 What is the ASP.NET Page Life Cycle?
Q 154 What is a Directive in ASP.Net?
Q 155 What are the different Validation Controls in ASP.Net?
Q 156 What is the Difference between User Control and Custom Control?
Q 157 What is the Difference between Client Side and Server Side Code?
Q 158 What is the Difference between Server.Transfer and Response.Redirect?
Q 159 What are the different IIS Isolation Levels in ASP.Net?
Q 160 What are the different Authentication Modes available in ASP.Net?

Q 161 >What is Windows Authentication Mode in ASP.Net?
Q 162 What are the advantages and disadvantages of Windows Authentication Mode?
Q 163 What is Form Authentication Mode in ASP.Net?
Q 164 What are the advantages and disadvantages of Form Authentication Mode?
Q 165 What is Passport Authentication Mode in ASP.Net?
Q 166 What are the advantages and disadvantages of Passport Authentication Mode?
Q 167 What is None Authentication Mode in ASP.Net?
Q 168 What are the advantages and disadvantages of None Authentication Mode?
Q 169 What are the different IIS authentications available?
Q 170 What is an Event Bubbling?

Q 171 >What are the differences between Machine.Config and a Web.Config files in Asp.Net?
Q 172 What is an Authentication?
Q 173 What is an Authorization?
Q 174 What is an Impersonation?
Q 175 What is Autopostback event in ASP.Net?
Q 176 What is Tracing in ASP.Net
Q 177 What is Scavenging?
Q 178 What are Trace Listeners?
Q 179 What is the difference between Respose.Write and Response.Output.Write?
Q 180 What is SmartNavigation?

Q 181 >What is a State Management in ASP.Net?
Q 182 What are the different management objects available with Client & Server Side Stage Management?
Q 183 How to Pass values between pages?
Q 184 What is a View State?
Q 185 What are the Benefits of ViewState?
Q 186 What are the Limitations of ViewState?
Q 187 What is an EnableViewState in ASP.Net?
Q 188 What are Hidden Fields in ASP.Net?
Q 189 What are the Benefits of Hidden Fields in ASP.Net?
Q 190 What are the Limitations of Hidden Fields in ASP.Net?

Q 191 >What are Hidden Frames in ASP.Net?
Q 192 What are the Benefits of Hidden Frames in ASP.Net?
Q 193 What are the Limitations of Hidden Frames in ASP.Net?
Q 194 What is a Cookie in ASP.Net?
Q 195 What are the examples of Cookie usage in ASP.Net?
Q 196 What are the Types of Cookies in ASP.Net?
Q 197 What are the Benefits of Cookies in ASP.Net?
Q 198 What are the Limitations of Cookies in ASP.Net?
Q 199 What is the relation between Cookies and Session State?
Q 200 What is a Cookieless Session in ASP.Net?

Q 201 >What are the Advantages of Session?
Q 202 What are the Disadvantages of Session?
Q 203 What is an In Proc Mode of storing sessions?
Q 204 What are the Advantages of InProc Sessions?
Q 205 What are the Disadvantages of InProc Sessions?
Q 206 What is a State Server Mode of Storing Sessions?
Q 207 What are the Advantages of State Server Session?
Q 208 What are the Disadvantages of State Server Session?
Q 209 What is a SQL Server Mode of Storing Session?
Q 210 What are the Advantages of SQL Server mode Session?

Q 211 >What are the Disadvantages of SQL Server modes?
Q 212 What is Custom Session Mode in ASP.Net?
Q 213 What are the Advantages of using Custom Session Mode in ASP.Net?
Q 214 What are the Disadvantages of using Custom Session Mode in ASP.Net?
Q 215 What is a Query String in ASP.Net?
Q 216 What are the Benefits of a Query String in ASP.Net?
Q 217 What are the Limitations of a Query String in ASP.Net?
Q 218 What is Cross Page Posting in ASP.Net?
Q 219 What is SQL Cache Dependency in ASP.Net?
Q 220 What is Global.asax in ASP.Net?

Q 221 >What are the Event available in Global.asax?
Q 222 What is Caching in ASP.Net?
Q 223 What are the Types of Caching in ASP.Net?
Q 224 How to cache different versions of the same page in ASP.Net?
Q 225 What is a Fragment Cache in ASP.Net?
Q 226 What are Resource Files in ASP.Net?
Q 227 What are the Types of Resource Files available in ASP.Net?
Q 228 What is a Local Resource File in ASP.Net?
Q 229 What is a Global Resource File in ASP.Net?
Q 230 What are the main tags in Web.Config file of ASP.Net application?

Q 231 >What is the use of <compilation> tag in ASP.Net Web.Config File?
Q 232 What is the use of <customErrors> tag in ASP.Net Web.Config File?
Q 233 What is the use of <globalization> tag in ASP.Net Web.Config File?
Q 234 What is the use of <httpRuntime> tag in ASP.Net Web.Config File?
Q 235 What is the use of <trace> tag in ASP.Net Web.Config File?
Q 236 What is the use of <identity> tag in ASP.Net Web.Config File?
Q 237 What is the use of <sessionState> tag in ASP.Net Web.Config File?
Q 238 What is the use of <appSettings> tag in ASP.Net Web.Config File?
Q 239 What is HTTP GET in ASP.Net?
Q 240 What is HTTP POST in ASP.Net?

Q 241 >What is Normalization in SQL Server?
Q 242 What is a De-Normalization in SQL Server?
Q 243 What are the different Normalization Forms in SQL Server?
Q 244 What is a Stored Procedure in SQL Server?
Q 245 What are the Advantages of Stored Procedure in SQL Server?
Q 246 What are the DisAdvantages of Stored Procedure in SQL Server?
Q 247 What is a User Defined Functions in SQL Server?
Q 248 What is a Scalar value-returning User Defined Function in SQL Server?
Q 249 What is an In Line Table User Defined Function in SQL Server?
Q 250 What is a Multistatement Table User Defined Function in SQL Server?

Q 251 >What are the Advantages of User Defined Functions?
Q 252 What are the DisAdvantages of User Defined Functions?
Q 253 What is the difference between a Stored Procedure and Functions?
Q 254 What is a Trigger?
Q 255 What is a DML Trigger?
Q 256 What is a DDL Trigger?
Q 257 What is a CLR Trigger?
Q 259 What are the DisAdvantages of Triggers?
Q 260 What are Views in SQL Server?

Q 261 >What are the Types of VIEW?
Q 262 How Views ensure security of data?
Q 263 List some of the common examples of views?
Q 264 What are the Limitations of views?
Q 265 What are Linked Servers in SQL Server?
Q 266 What are the Advantages of Linked Servers?
Q 267 What is a Cursor in SQL Server?
Q 268 What are the steps to Create Cursor in SQL Server?
Q 269 What are the Types of Cursors in SQL Server?
Q 270 What are the Cursor Optimization Tips available?

Q 271 >What are the Cursor Alternatives?
Q 272 What are the Limitations of Cursors?
Q 273 What is a SubQuery?
Q 274 What are the Properties of Subquery?
Q 275 What are the Types of Subquery?
Q 276 What is a Correlated Subquery?
Q 277 What are the Properties of Correlated Subquery?
Q 278 What are the different Authentication options and Authentication Modes in SQL Server?
Q 279 What is a Windows Authentication Mode?
Q 280 What is a Mixed Authentication Mode(Windows Authentication and SQL Server Authentication)?

Q 281 >How to Select an Authentication Mode in SQL Server?
Q 282 What is an Identity?
Q 283 What are INNER JOINs in SQL?
Q 284 What is a LEFT OUTER JOIN in SQL?
Q 285 What is a RIGHT OUTER JOIN in SQL?
Q 286 What is a FULL OUTER JOIN in SQL?
Q 287 What is an EQUI JOIN in SQL?
Q 288 What is a CROSS JOIN in SQL?
Q 289 What is a SELF JOIN in SQL?
Q 290 What is a NATURAL JOIN in SQL?
Q 291 >What is Log shipping?
Q 292 What is an Index?
Q 293 How to Create an Effective Index?
Q 294 What are the Types of Indexes available?
Q 295 What is the difference between Primary Key and a Unique Key?
Q 296 What is the difference between Delete and a Truncate?
Q 297 What is a Clustered Index?
Q 298 What is a Non Clustered Index?
Q 299 What is the difference between Clustered and Non Clustered Index?
Q 300 What is BCP used in SQL?

Q 301 >What is the use of Having and Where Clause in SQL?
Q 302 What is the difference between Having and Where Clause in SQL?
Q 303 What is the Local Temporary Table?
Q 304 What is the Global Temporary Table?
Q 305 What is the difference between @@Error and @@Rowcount ?
Q 306 What is a Service Broker in SQL?
Q 307 What is Database Mirroring in SQL?
Q 308 What is Extended Stored Procedure in SQL?
Q 310 What is an Execution Plans in SQL?

Q 311 >What is Dead Lock?
Q 312 What is an example of Deadlock?
Q 313 How to Resolve Deadlock?
Q 314 What is Live Lock?
Q 315 What is an example of Live Lock?
Q 316 What are the options available to Move Database between servers?
Q 317 What is Replication?
Q 318 What is Union?
Q 319 What is Union ALL?
Q 320 List some of the DBCC (Database Console Commands for SQL Server) Commands?

Q 321 >What is a Full Database Backup type in SQL?
Q 322 What is a Differential Database Backup type in SQL?
Q 323 What is a Transactional Log Database Backup type in SQL?
Q 324 What is a Log Database Backup type in SQL?
Q 325 What are the advantages of NoLock in SQL?
Q 326 What are the disadvantages of NoLock in SQL?
Q 327 What is GRANT command in SQL?
Q 328 What is REVOKE command in SQL?
Q 329 What is Privileges command in SQL?
Q 330 What is Cascade command in SQL?

Q 331 >What is the use of RESTRICT Keyword in SQL?
Q 332 What is the use of DML in SQL?
Q 333 What is the use of DDL in SQL?
Q 334 What is the use of DCL in SQL?
Q 335 What is the use of TCL in SQL?
Q 336 What is the use of Wildcards in SQL?
Q 337 What is the use of Aggregate functions?
Q 338 What is the use of ROLLUP in SQL?
Q 339 What is the use of CUBE in SQL?
Q 340 What are the Differences between CUBE and ROLLUP?

Q 341 >What is the use of CUBE Operator in SQL?
Q 342 What is the Difference between ROLLUP and COMPUTE?
Q 343 What is the use of COMPUTE in SQL?
Q 344 What is the use of COMPUTE BY in SQL?
Q 345 What is the use of With TIES in SQL?
Q 346 What is the use of ALL & ANY operator in SQL?
Q 347 What is the use of Master Database in SQL?
Q 348 What is the use of MSDB Database in SQL?
Q 349 What is the use of TEMPDB Database in SQL?
Q 350 What is the use of MODEL Database in SQL














Life set Question 3

1. What is CTS in C#?

In Microsoft's .NET Framework, the Common Type System (CTS) is a standard that specifies how Type definitions and specific values of Types are represented in computer memory. It is intended to allow programs written in different programming languages to easily share information. As used in programming languages, a Type can be described as a definition of a set of values (for example, "all integers between 0 and 10"), and the allowable operations on those values (for example, addition and subtraction).
Function Of CTS:
To establish a framework that helps enable cross-language integration, type safety, and high performance code execution.
To provide an object-oriented model that supports the complete implementation of many programming languages.
To define rules that languages must follow, which helps ensure that objects written in different languages can interact with each other.
The CTS also defines the rules that ensures that the data types of objects written in various languages are able to interact with each other.
The CTS also specifies the rules for type visibility and access to the members of a type, i.e. the CTS establishes the rules by which assemblies form scope for a type, and the Common Language Runtime enforces the visibility rules.
The CTS defines the rules governing type inheritance, virtual methods and object lifetime.
Languages supported by .NET can implement all or some common data types…




4. Paging is possible in repeater control?

The Repeater control is used to display a repeated list of items that are bound to the control. The Repeater control may be bound to a database table, an XML file, or another list of items. Repeater control lacks paging and sorting of data like other data bound controls such as Datagrid, GridView, DetailsView and FormView. But we can add this feature to repeater control.

6. How we make dynamic table in C#?

In ASP.Net 2.0 there are number of controls to display the data retrieved from the database in tabular form using Grid View Control, list view Control, Repeater. But in some cases when there is no option to custom these default controls. At that time a questions arises – how to generate dynamic tables? How to display the data according to requirement?
You can use the Literal Control to display the html tagged string generated by using VB/C# code in ASP.Net 2.0.
(Advance ASP.Net developers: See Alternate Example here using Panel Control to Create dynamic tables using HtmlControls HtmlTable) 
To generate the table using string variables you can use the following C# code:
  1. // create a string type variable to generate dynamic table  
  2. string dynTable = "";  
  3.   
  4. // start with table tag with following attributes   
  5. dynTable = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"1\">";  
  6.   
  7. // outer loop to generate table rows  
  8. for (int tRows = 0; tRows < 5; tRows++)  
  9. {  
  10.     //start table row  
  11.     dynTable += "<tr>";  
  12.   
  13.     // inner loop to generate columns  
  14.     for (int tCols = 0; tCols < 4; tCols++)  
  15.     {  
  16.         // create column  
  17.         dynTable += "<td>";   
  18.         dynTable += "Row: " + (tRows + 1) + " Col: " + (tCols + 1);  
  19.   
  20.         // close td column tag  
  21.         dynTable += "</td>";  
  22.     }  
  23.   
  24.     // close table row  
  25.     dynTable += "</tr>";  
  26. }  
  27.   
  28. // close the table tag  
  29. dynTable += "</table>";  
  30.   
  31. Literal1.Text = dynTable;   
Above C# code will build a string having table tag, tr as table row, td as table data/column. To display the data retrieved from database you can set the tRows < [No. of DataRows Retrieved] and tCols < [No. of DataColmns].

7. Table value function in Sql Server?

User-defined functions that return a table data type can be powerful alternatives to views. These functions are referred to as table-valued functions. A table-valued user-defined function can be used where table or view expressions are allowed in Transact-SQL queries. While views are limited to a single SELECT statement, user-defined functions can contain additional statements that allow more powerful logic than is possible in views.
A table-valued user-defined function can also replace stored procedures that return a single result set. The table returned by a user-defined function can be referenced in the FROM clause of a Transact-SQL statement, but stored procedures that return result sets cannot.

8. Event log in C#?

Event logging provides a standard, centralized way for your applications to record important software and hardware events. Windows supplies a standard user interface for viewing the logs, the Event Viewer. By using the common language's run-timeEventLog component, you can connect to existing event logs easily, on both local and remote computers, and write entries to these logs. You can also read entries from existing logs and create your own custom event logs. In its simplest form, writing to an event log involves only a few steps to create a sample application. To do this, follow these steps:
1.      Open Visual Studio C#.
2.      Create a new Console application in Visual C#. The Console application creates a public class and an empty Main method for you.
3.      Verify that the project references at least the System.dll file.
4.      Use the using directive on the System and System.Diagnostics namespaces so that you do not have to qualify declarations from these namespaces later in your code. You must use these statements before any other declarations.
5.      using System;
6.      using System.Diagnostics;
                                                                  
7.      To write to an event log, you must have several pieces of information: Your message, the name of the log you to which you want to write (which will be created if it does not already exist), and a string that represents the source of the event. You can register a particular source with only a single event log; if you want to write messages to more than one log, you must define multiple sources.
8.      string sSource;
9.      string sLog;
10.  string sEvent;
11.   
12.  sSource = "dotNET Sample App";
13.  sLog = "Application";
14.  sEvent = "Sample Event";
                                                                  
15.  Use two static methods of the EventLog class to check whether your source exists, and then, if the source does not exist, to create this source that is associated with a particular event log. If the log name that you specify does not exist, the name is created automatically when you write your first entry to the log. By default, if you do not supply a log name to the CreateEventSource method, the log file is named "Application Log."
16.  if (!EventLog.SourceExists(sSource))
17.       EventLog.CreateEventSource(sSource,sLog);
                                                                  
18.  To write a message to an event log, you can use the EventLog.WriteEntry static method. This method has several different overloaded versions. The following sample code shows the simplest method, which takes a source string and your message, and one of the more complex methods, which supports specifying the event ID and event type:
19.  EventLog.WriteEntry(sSource,sEvent);
20.  EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,  234);
                                                                  
21.  Save your application. Run your application, and then check the Application log in the Event Viewer to see your new events.

Complete code listing

using System;
using System.Diagnostics;
 
namespace WriteToAnEventLog_csharp
{
               /// Summary description for Class1.
               class Class1
               {
                               static void Main(string[] args)
                               {
                                              string sSource;
                                              string sLog;
                                              string sEvent;
 
                                              sSource = "dotNET Sample App";
                                              sLog = "Application";
                                              sEvent = "Sample Event";
 
                                              if (!EventLog.SourceExists(sSource))
                                                             EventLog.CreateEventSource(sSource,sLog);
 
                                              EventLog.WriteEntry(sSource,sEvent);
                                              EventLog.WriteEntry(sSource, sEvent,
                                                             EventLogEntryType.Warning, 234);
                               }
               }}
9. DML event possible in function?

No.

11. How we get emp 3rd Max salary?
Select sal from emp a where 3=(select
count(distinct(sal)) from emp b
where a.sal<=b.sal) 






































4. What is Cascading in Sql Server?
 Microsoft SQL Server provides declarative referential integrity (DRI) which allows you to define data integrity restrictions for a table as well as relationships between tables, both of which are enforced by SQL Server automatically at the system level. 

SQL Server conforms to ANSI Entry SQL with regard to referential integrity between PrimaryKey and ForeignKey columns which requires the inserting, updating, and deleting of data in related tables to be restricted to values that preserve the integrity. 

ANSI Intermediate SQL adds 'referential actions,' which describe what should be done to dependent ForeignKey values when their corresponding PrimaryKey values are updated or deleted. This article describes how such cascading deletes and updates can be implemented with SQL Server
.



5. What is indexing in Sql Server?

One of the most important routes to high performance in a SQL Server database is the index. Indexes speed up the querying process by providing swift access to rows in the data tables, similarly to the way a book’s index helps you find information quickly within that book. 

Index Types

In addition to an index being clustered or nonclustered, it can be configured in other ways:
·         Composite index: An index that contains more than one column. In both SQL Server 2005 and 2008, you can include up to 16 columns in an index, as long as the index doesn’t exceed the 900-byte limit. Both clustered and nonclustered indexes can be composite indexes.
·         Unique Index: An index that ensures the uniqueness of each value in the indexed column. If the index is a composite, the uniqueness is enforced across the columns as a whole, not on the individual columns. For example, if you were to create an index on the FirstName and LastName columns in a table, the names together must be unique, but the individual names can be duplicated.
   A unique index is automatically created when you define a primary key or unique constraint:
§  Primary key: When you define a primary key constraint on one or more columns, SQL Server automatically creates a unique, clustered index if a clustered index does not already exist on the table or view. However, you can override the default behavior and define a unique, nonclustered index on the primary key.
§  Unique: When you define a unique constraint, SQL Server automatically creates a unique, nonclustered index. You can specify that a unique clustered index be created if a clustered index does not already exist on the table.
·         Covering index: A type of index that includes all the columns that are needed to process a particular query. For example, your query might retrieve the FirstName and LastName columns from a table, based on a value in the ContactID column. You can create a covering index that includes all three columns.


6. What is clustered and non clustered index?

Clustered Indexes

A clustered index stores the actual data rows at the leaf level of the index. Returning to the example above, that would mean that the entire row of data associated with the primary key value of 123 would be stored in that leaf node. An important characteristic of the clustered index is that the indexed values are sorted in either ascending or descending order. As a result, there can be only one clustered index on a table or view. In addition, data in a table is sorted only if a clustered index has been defined on a table.

Nonclustered Indexes

Unlike a clustered indexed, the leaf nodes of a nonclustered index contain only the values from the indexed columns and row locators that point to the actual data rows, rather than contain the data rows themselves. This means that the query engine must take an additional step in order to locate the actual data.
A row locator’s structure depends on whether it points to a clustered table or to a heap. If referencing a clustered table, the row locator points to the clustered index, using the value from the clustered index to navigate to the correct data row. If referencing a heap, the row locator points to the actual data row.
Nonclustered indexes cannot be sorted like clustered indexes; however, you can create more than one nonclustered index per table or view. SQL Server 2005 supports up to 249 nonclustered indexes, and SQL Server 2008 support up to 999. This certainly doesn’t mean you should create that many indexes. Indexes can both help and hinder performance, as I explain later in the article.
In addition to being able to create multiple nonclustered indexes on a table or view, you can also add included columns to your index. This means that you can store at the leaf level not only the values from the indexed column, but also the values from non-indexed columns. This strategy allows you to get around some of the limitations on indexes. For example, you can include non-indexed columns in order to exceed the size limit of indexed columns (900 bytes in most cases).

7. What is state management in .net?

State Management is the process by which we maintain session related information and additional information about the controls and its state. The necessity of state management arises when multiple users request for the same or different Web Pages of a Web Site.

Client Side State Management Options

Client Side State Management involves storing information either on a Web page or on a Client computer. There are four ways to manage states. 


  • View State
  • Hidden Form Fields
  • Cookies
  • Query String


View State

In this method, the ViewState property that is inherited from the base Control class is used to automatically save the values of the page and of each control prior to rendering of the page. ViewState is implemented with a hidden form field called the _VIEWSTATE, which is automatically created in every Web Form page. When ASP.Net executes a Web page on a Web Server, the values stored in the ViewState property of the page and controls on it are collected and formatted into a single encoded string. The encoded string is then assigned to the Value attribute of the hidden form field _VIEWSTATE and is sent to the client as a part of the Web page. 


Hidden Form Fields

In ASP.Net we can use the HTML standard hidden fields in a Web Form to store page-specific information. A hidden field does not render in a Web browser. However, we can set the properties of the hidden field. When a page is submitted to the server, the content of the hidden field is sent in the HTTP Form collection along with values of other controls. 


Cookies

A cookie is a small data structure used by a Web server to deliver data to a web client. A cookie contains page specific information that a Web server sends to a client along with Page output. Cookies are used to keep track of each individual user who accesses the web page across a HTTP connection. 


Query String

The Query string is a part of the request that appears after the Question mark (?) character in the URL. A query string provides a simple way to pass information from one page to another. 


Server Side State Management Options

Application State

ASP.Net provides application state as a means of storing global application specific information. The information in the application state is stored in a key value pair and is used to maintain data consistency between server round trips and between pages. 


Session State

In this option session state used to store session specific information for a Web site. In session state, the scope fo session state is limited to the current browser session. In case, many users are accessing the same Web application, each will have a different session state. If a user exits from a Web applicatin and returns later, it will be a different session state. 


Database Support

Another option is the database support option. Database support is used in combination with cookies or session state. The database used is usually a relational database. 

9. How much type of cookies in .Net?

There are two types of cookies in ASP.NET
Single valued cookies
Example:
request.cookies(”UserName”).value=”myCookies”
Multivalued cookies
Example 
request.cookies(”CookiName”)(”UserName”)=”Lucky”
request.cookies(”CookiName”)(”UserID”)=”1234? 

10. What is the best way to move one value to another page?

Sessions.

11. What is the diff b/w script manager and script manager proxy?

1. You can only have one script manager per page 
2. A server control that makes script resources available to the browser, including the Microsoft AJAX Library and the functionality that enables partial-page rendering. 

Script manager proxy 

1. You can have multiple proxies. 
2. A server control that enables nested components to add script and service references if the page already contains a ScriptManager control. 

12. Why we use script Manager?

Script manager control is the control that send the scripts to the client. This control is at the heart of all AJAX related functions. It manages all controls in your Ajax enabled page. It also ensures that partial page updates happen as it is expected.

13. What is diff b/w server.transfer and cross page posting?

1. In ‘Server.Transfer’, the URL doesn’t change whereas in cross page posting, the form is submitted to a different page, thereby changing the url.
2. The Server.Transfer method is a server-based operation whereas cross-page postback is a client-based transfer.




































1. What is the diff b/w table variable and temporary table?

Table variables are Transaction neutral. They are variables and thus aren't bound to a transaction.
Temp tables behave same as normal tables and are bound by transactions. 
A simple example shows this difference quite nicely:
 BEGIN TRAN
declare @var table (id int, data varchar(20) )
create table #temp (id int, data varchar(20) )
 
insert into @var
select 1, 'data 1' union all
select 2, 'data 2' union all
select 3, 'data 3'
 
insert into #temp
select 1, 'data 1' union all
select 2, 'data 2' union all
select 3, 'data 3'
 
select * from #temp
select * from @var
 
ROLLBACK
 
select * from @var
if object_id('tempdb..#temp') is null
    select '#temp does not exist outside the transaction'

We see that the table variable still exists and has all it's data unlike the temporary table that doesn't exists when the transaction rollbacked.
3. In a transaction we can use temporary table?

The argument is this: “you can create an InnoDB temporary table and use it only within one transaction, and then if the slave crashes and restarts, it’ll roll back the transaction to the beginning.” In other words, in theory if the temporary table exists only within that one transaction, and if your transaction accesses only InnoDB tables, it’s safe.

9. In a function we can do any DML operation?

No.
                                                                                                
10. What is the difference between server.tranfer and response.redirect?

Response.Redirect

1.      Response.Redirect() will send you to a new page, update the address bar and add it to the           Browser History. On your browser you can click back.
2.      It redirects the request to some plain HTML pages on our server or to some other web       server.
3.      It causes additional roundtrips to the server on each request.
4.      It doesn’t preserve Query String and Form Variables from the original request.
5.      It enables to see the new redirected URL where it is redirected in the browser (and be      able to bookmark it if it’s necessary).
6.      Response. Redirect simply sends a message down to the (HTTP 302) browser.

Server.Transfer

1.      Server.Transfer() does not change the address bar, we cannot hit back.One should use      Server.Transfer() when he/she doesn’t want the user to see where he is going. Sometime     on a "loading" type page.
2.      It transfers current page request to another .aspx page on the same server.
3.      It preserves server resources and avoids the unnecessary roundtrips to the server.
4.      It preserves Query String and Form Variables (optionally).
5.      It doesn’t show the real URL where it redirects the request in the users Web Browser.
6.      Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.

















1. What is Ajax . How we get ajax through javascript?

Asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous.[2]

2. What is Polymorhism?
  • Polymorphism is one of the primary characteristics (concept) of object-oriented programming.
  • Poly means many and morph means form. Thus, polymorphism refers to being able to use many forms of a type without regard to the details.
  • Polymorphism is the characteristic of being able to assign a different meaning specifically, to allow an entity such as a variable, a function, or an object to have more than one form.
  • Polymorphism is the ability to process objects differently depending on their data types.
  • Polymorphism is the ability to redefine methods for derived classes.

Types of Polymorphism

  • Compile time Polymorphism
  • Run time Polymorphism

Compile time Polymorphism

  • Compile time Polymorphism also known as method overloading
  • Method overloading means having two or more methods with the same name but with different signatures
Example of Compile time polymorphism


Run time Polymorphism

  • Run time Polymorphism also known as method overriding
  • Method overriding means having two or more methods with the same name , same signature but with different implementation
Example of Run time Polymorphism



4. We can Change Session variable value at runtime?

Generally the Session Variables tab is used for setting the initial value of session variables at startup and for values that won't be changing at run time using actions.

5. How we can get our table's all datatype and Column name through a Sql Query?

SELECT 
    t1.column_name, t2.column_name, t1.data_type, t2.data_type 
FROM 
    (select * from serverA.databaseA.information_schema.COLUMNS 
     WHERE table_name ='tableA') as t1 
full outer join
    (select * from severB.databaseB.information_schema.COLUMNS 
     WHERE table_name ='tableA') as t2 ON t1.column_name=t2.column_name;


6. What is the XML file extension?

.XML File

File extension: XML
7. What is the diff b/w grid view and repeater control?

Features of a GridView:

1.      Displays data as a table
2.      Updateable
3.      Item as row
4.      Control over
§  Alternate item
§  Header
§  Footer
§  Colors, font, borders, etc.
§  Paging
Features of Repeater:

1.      List format
2.      No default output
3.      More control
4.      More complexity
5.      Item as row
6.      Not updateable

8. In a string how we get last index value?

 created a RegEx solution that doesn't matter what the property name is, but grabs the last digits and returns an integer
static int GetLastInteger( string name ) {
 
    int value;
    if( int.TryParse( name, out value ) ) {
        return value;
    }
    System.Text.RegularExpressions.Regex r = 
        new System.Text.RegularExpressions.Regex( @"[^0-9](\d+\b)" );
 
    System.Text.RegularExpressions.Match m = 
        r.Match( name );
 
    string strValue = m.Groups[1].Value;
    value = ( int.Parse( strValue ) );
    return value;
}



9. In method overloading return type of a method are same or diff?

Different












































1. What is method overloading and method overriding?

Overloading
Overloading is when you have multiple methods in the same scope, with the same name but different signatures.
//Overloading
public class test
{
    public void getStuff(int id)
    {}
    public void getStuff(string name)
    {}
}
Overriding
Overriding is a principle that allows you to change the functionality of a method in a child class.
//Overriding
public class test
{
        public virtual getStuff(int id)
        {
            //Get stuff default location
        }
}
 
public class test2 : test
{
        public override getStuff(int id)
        {
            //base.getStuff(id);
            //or - Get stuff new location
        }
}


2. What is Datakey in a Gridview?

It generally happens with many developers that they want some value from the datasource to be carried in Asp.net Data controls (ListView, GridView etc) but don't want to show that value in the UI.
One traditional way to do this is to bind that value to a column or hidden field and set the control  visibility as false.
To get rid of that we can use DataKeys and DataKeyNames property of ListView and GridView.

The DataKeyNames property is to specify the field names that we want to carry as hidden, from the data source. For more than one field name we use a comma-separated list of field names.
DataKeyNames = 'Field1, Field2, Field3'
When the DataKeyNames property is set, the ListView control automatically creates a DataKey object for each item (GridViewRow, ListViewDataItem) in the control. The DataKey object contains the values of the field or fields that are specified in the DataKeyNames property. Then it is added to the control's DataKeys collection. This provides a convenient way to access different fields of each item.

So, in the code behind the DataKey object give a access to these hidden values. You just need to pass the key to the DataKeys collection to get the value out of it. 
The following example explain all these things.
Design Page: to specify the column names in the DataKeyNames property of the ListView or GridView
<asp:ListView ID="lvExample" runat="server"OnItemDataBound="lvExample_ItemDataBound"DataKeyNames="EmployeeId,WorkStatus">
    <ItemTemplate>
        <!-- the diaplayed controls here -->
    </ItemTemplate>
</asp:ListView >


3. What is viewstate? In hiddenfield which  format it contain?
View State is one of the most important and useful client side state management mechanism. It can store the page value at the time of post back (Sending and Receiving information from Server) of your page. ASP.NET pages provide the ViewState property as a built-in structure for automatically storing values between multiple requests for the same page.
Example:
If you want to add one variable in View State,
 Collapse | Copy Code
 ViewState["Var"]=Count;
For Retrieving information from View State
 Collapse | Copy Code
string Test=ViewState["TestVal"];
Sometimes you may need to typecast ViewState Value to retreive. As I give an Example to strore and retreive object in view state  in the last of  this article.
Which  format it contain?
View State stored the value of page controls as a string which is hashed and encoded in some hashing and encoding technology. It only contain information about page and its controls. Its does not have any interaction with server. It stays along with the page in the Client Browser. View State use Hidden field to store its information in a encoding format.
Suppose you have written a simple code , to store a value of control:
 Collapse | Copy Code
ViewState["Value"] = MyControl.Text;
Now, Run you application, In Browser, RighClick > View Source , You will get the following section of code
User_S1.jpg
Fig : View state stored in hidden field
Now , look at the value. looks likes a encrypted string, This is Base64 Encoded string, this is not a encoded string. So it can easily be decoded. Base64 makes a string suitable for HTTP transfer plus it makes it a little hard to read . Read More about Base64 Encoding . Any body can decode that string and read the original value. so be careful about that. There is a security lack of view state.

4. What is plain text?

Refers to textual data in ASCII format. Plain text is the most portable format because it is supported by nearly every application on every machine. It is quite limited, however, because it cannot contain any formatting commands.
In cryptography, plain text refers to any message that is not encrypted. Contrast with cipher text.
Plain text is also called clear text.

5. What is out proc Session in ASP?

Inproc session mode, 
 
1. session data is stored in current application domain and so consumes memory of server machine.
 
2. if server restarts, all session data is lost.
 
Out-proc mode (which is generally state server),
 
1. session data is stored on state server and so web servers memory is not consumed.
 
2. in case of web server restart, session data is preserved.

Out-proc mode (which is generally state server),
 
1. session data is stored on state server and so web servers memory is not consumed.
 
2. in case of web server restart, session data is preserved.
 
considering above points, use of session mode is the choice to be made considering load, no. of users, performence requirment etc.
 
for small web site with limited no. of users, in-proc mode is best suited.
 
for large applications with huge no. of users, state-server/sql server session mode should be used.




























1. What is assembly in C#. How much type of combination it make and what is the other resource in assembly.

Assemblies form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions for a .NET-based application. Assemblies take the form of an executable (.exe) file or dynamic link library (.dll) file, and are the building blocks of the .NET Framework. They provide the common language runtime with the information it needs to be aware of type implementations. You can think of an assembly as a collection of types and resources that form a logical unit of functionality and are built to work together.
Assemblies can contain one or more modules. For example, larger projects may be planned in such a way that several individual developers work on separate modules, all coming together to create a single assembly. For more information about modules, see the topic How to: Build a Multifile Assembly.
Assemblies have the following properties:
·         Assemblies are implemented as .exe or .dll files.
·         You can share an assembly between applications by putting it in the global assembly cache. Assemblies must be strong-named before they can be included in the global assembly cache. For more information, see Strong-Named Assemblies.
·         Assemblies are only loaded into memory if they are required. If they are not used, they are not loaded. This means that assemblies can be an efficient way to manage resources in larger projects.
·         You can programmatically obtain information about an assembly by using reflection. For more information, see Reflection.
·         If you want to load an assembly only to inspect it, use a method such as ReflectionOnlyLoadFrom.


Within every assembly is an assembly manifest. Similar to a table of contents, the assembly manifest contains the following:
·         The assembly's identity (its name and version).
·         A file table describing all the other files that make up the assembly, for example, any other assemblies you created that your .exe or .dll file relies on, or even bitmap or Readme files.
·         An assembly reference list, which is a list of all external dependencies—.dlls or other files your application needs that may have been created by someone else. Assembly references contain references to both global and private objects. Global objects reside in the global assembly cache, an area available to other applications, somewhat like the System32 directory. The Microsoft.VisualBasic namespace is an example of an assembly in the global assembly cache. Private objects must be in a directory at either the same level as or below the directory in which your application is installed.
Because assemblies contain information about content, versioning, and dependencies, the applications you create with Visual Basic and C# do not rely on registry values to function properly. Assemblies reduce .dll conflicts and make your applications more reliable and easier to deploy. In many cases, you can install a .NET-based application simply by copying its files to the target computer.
For more information see Assembly Manifest.


To use an assembly, you must add a reference to it, as described in How to: Add or Remove References By Using the Add Reference Dialog Box. Next, you use the Imports statement in Visual Basic or using directive in C# to choose the namespace of the items you want to use. Once an assembly is referenced and imported, all the accessible classes, properties, methods, and other members of its namespaces are available to your application as if their code were part of your source file.
In C#, you can also use two versions of the same assembly in a single application. For more information, see extern alias.


Compile your application by clicking Build on the Build menu or by building it from the command line using the command-line compiler. For details about building assemblies from the command line, see Building from the Command Line (Visual Basic) for Visual Basic and Command-line Building With csc.exe for C#.

3. By which command  we register assembly in GAC?

The following command installs the assembly mydll.dll into the global assembly cache.
gacutil /i mydll.dll
The following command removes the assembly hello from the global assembly cache as long as no reference counts exist for the assembly.
gacutil /u hello


4. How  we make assembly key or Snk key?
1.      On the Start menu, point to All Programs, point to Microsoft Visual Studio 2010, point to Visual Studio Tools, and then click Visual Studio Command Prompt (2010).
2.      At the command prompt, from the folder where you want to store the key file, type the following command, and then press ENTER:
sn /k file_name .snk
Example: sn /k ErrorHandling.snk
A confirmation message, Key pair written to <file_name>.snk, displays on the command line.
3.      In Visual Studio Solution Explorer, right-click the project and then click Properties.
4.      Click the Signing tab and choose Browse in the Choose a strong name key file drop down box.
5.      Browse to the key file and click it. Click Open, and then close the project properties.
6.      Repeat steps 3 through 6 for each project in the solution that you want to deploy using this strong name assembly key file.


6. How we decode a assembly?



7. How much type of assembly in .Net C#?

2. What is MSIL?

When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be run, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture.
When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.


5. What is reflection in C#?

Reflection (C# Programming Guide)

Visual Studio 2008

9 out of 19 rated this helpful
Reflection provides objects (of type Type) that describe assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, reflection enables you to access them. For more information, see Attributes (C# Programming Guide).
Here's a simple example of reflection using the static method GetType - inherited by all types from the Object base class - to obtain the type of a variable:
C#
// Using GetType to obtain type information: 
int i = 42;
System.Type type = i.GetType();
System.Console.WriteLine(type);
The output is:
System.Int32
The following example uses reflection to obtain the full name of the loaded assembly.
C#
// Using Reflection to get information from an Assembly:
System.Reflection.Assembly info = typeof(System.Int32).Assembly;
System.Console.WriteLine(info);


8.What is the normalization?

Normalization or data normalization is a process to organize the data into tabular format (database tables). A good database design includes the normalization, without normalization a database system may slow, inefficient and might not produce the expected result. Normalization reduces the data redundancy and inconsistent data dependency.

Normal Forms

We organize the data into database tables by using normal forms rules or conditions. Normal forms help us to make a good database design. Generally we organize the data up to third normal form. We rarely use the fourth and fifth normal form.
To understand normal forms consider the folowing unnormalized database table. Now we will normalize the data of below table using normal forms.

1.                 First Normal Form (1NF)

A database table is said to be in 1NF if it contains no repeating fields/columns. The process of converting the UNF table into 1NF is as follows:
1.      Separate the repeating fields into new database tables along with the key from unnormalized database table.
2.      The primary key of new database tables may be a composite key
1NF of above UNF table is as follows:

2.                 Second Normal Form (2NF)

A database table is said to be in 2NF if it is in 1NF and contains only those fields/columns that are functionally dependent(means the value of field is determined by the value of another field(s)) on the primary key. In 2NF we remove the partial dependencies of any non-key field.
The process of converting the database table into 2NF is as follows:
1.      Remove the partial dependencies(A type of functional dependency where a field is only functionally dependent on the part of primary key) of any non-key field.
2.      If field B depends on field A and vice versa. Also for a given value of B, we have only one possible value of A and vice versa, Then we put the field B in to new database table where B will be primary key and also marked as foreign key in parent table.
2NF of above 1NF tables is as follows:

3.                 Third Normal Form (3NF)

A database table is said to be in 3NF if it is in 2NF and all non keys fields should be dependent on primary key or We can also said a table to be in 3NF if it is in 2NF and no fields of the table is transitively functionally dependent on the primary key.The process of converting the table into 3NF is as follows:
1.      Remove the transitive dependecies(A type of functional dependency where a field is functionally dependent on the Field that is not the primary key.Hence its value is determined, indirectly by the primary key )
2.      Make separate table for transitive dependent Field.
3NF of above 2NF tables is as follows:

4.                 Boyce Code Normal Form (BCNF)

A database table is said to be in BCNF if it is in 3NF and contains each and every determinant as a candidate key.The process of converting the table into BCNF is as follows:
1.      Remove the non trival functional dependency.
2.      Make separate table for the determinants.
BCNF of below table is as follows:

5.                 Fourth Normal Form (4NF)

A database table is said to be in 4NF if it is in BCNF and primary key has one-to-one relationship to all non keys fields or We can also said a table to be in 4NF if it is in BCNF and contains no multi-valued dependencies.The process of converting the table into 4NF is as follows:
1.      Remove the multivalued dependency.
2.      Make separate table for multivalued Fields.
4NF of below table is as follows:

6.                 Fifth Normal Form (5NF)

A database table is said to be in 5NF if it is in 4NF and contains no redundant values or We can also said a table to be in 5NF if it is in 4NF and contains no join dependencies.The process of converting the table into 5NF is as follows:
1.      Remove the join dependency.
2.      Break the database table into smaller and smaller tables to remove all data redundancy.
5NF of below table is as follows:











  


3. What is Jquery?


jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.