1. Types of Authentication and Authorization in IIS.
A. Types of Authentication: Anonymous Authentication, Windows Authentication,
Digest Authentication
Types of Authorization:- Anonymous
2. Types of Authentication and Authorization in ASP.Net.
A. Types of Authentication: Windows Authentication, Forms Authentication
Types of Authorization:- File Authorization and URL Authorization
3. ASP.Net Life cycle.
A. The request starts with the client and processed through IIS. In IIS,
there are 2 utilities- INetInfo.exe and ASPNet_ISAPI.dll the InetInfo.exe
checks for the syntax and semantics of the request and then the request goes
to the ASPNet_ISAPI.dll which is the filter to filter the .aspx files. Here
the URL request split in to 2 parts- virtual directory and webpage. Now
worker process which is nothing but the application factory basically
contains all the virtual directories and checks for the current virtual
directory. If this is first request, then there will be no Virtual directory
available. Now the worker process (W3wp.exe) creates a memory area called as
AppDomain to check for the current page. As AppDomain is the Page Handler
factory so it contains all the processes pages. If this is the new page then
it will not find here. The request further move to the HttpPipeline where the
actual execution of the page happened by using the ProcessRequest method and
creates the events of the page. After creation of event and execution of the
entire event, the html page gets back to the user.
4. Page Life Cycle.
A. There are few events which gets generated during the page execution like:
Page_BeginRequest, Page_Init, Page_Load, Page_Prerender, Page_Render,
Page_Unload etc
For the details of the page life cycle, you can follow the previous question.
5. What are types: Value Type and Reference Type?
A. Value type holds data directly, Value type stored in the stack memory, We
can get the direct value of the value types. Value type data type can’t be
null.
Reference types: This type doesn’t hold the data directly. They hold the
address on which the actual data present. They stored in heap memory, Can
have default values.
We can make and work with null reference type.
6. Boxing and Unboxing: Terminology, Advantages and Disadvantages.
A. Converting the value type data type in to the Reference type is called as
Boxing. Converting the Reference type data type and keep its value to stack
is called as the reference type.
byte b= 45;
Object o = b.Tostring();
The Advantage of boxing and unboxing is that we can convert the type of the object
in to another type. The disadvantage is that it requires lot of memory and
CPU cycles to convert from one type to another type.
Object o=10;
Int i= Convert.ToInt32(o.ToString());
7. What is Type Safety?
A. TypeSafe is a way through which the application or framework that the
memory will not be leaked to outside environment. E.g. C# is the type safe
language where you must have to assign any object before using it. In VB.Net
it will take the default value. So C# is the type safe language while VB.Net
is not.
8. What is Strong Name?
A. Strong Name (SN) is used to make the dll as the unique as:
SN -k fileName.dll
Now it will have the unique name. This assembly when placed in the GAC, it
will treat as the unique with its version number and other details. 2
assemblies with the same name can exist in the GAC but both will have
different version. The CLR takes the latest version assembly while running
the application.
9. What are Extensions, modules and handlers?
A. HttpModule and HttpHandler are the utilities which are used in the
HttpPipeline under the ASP.Net page life cycle. When the request received to
HttpPipeline, the HttpModule checks for the Authentication of the request and
then it route the request to the respective handler. After that HttpHandler
takes that request and process it. After Processing the request again the
HttpModule takes the response and send it back to the worker process and
finally to the user.
10. What is worker process?
A. Worker process (w3wp.exe) is an executable which is also called as the
Application Factory. This is used for the execution of the request and
handling of the request for the current web page.
|
11. CLR and DLR?
A. CLR (Common Language Runtime) is the utility in the .Net framework to run
the application. It is the runtime engine which actually executes the
application with many responsibilities like taking care of memory management,
versioning, CasPol etc.
DLR is new with .Net 4.0 which is the Dynamic Language Runtime and used to
run the application on the fly wherever required. CLR runs as statically
while DLR runs dynamically.
12. In case more than one version of an installable is installed, which
version is invoked by default?
A. By default the CLR will take and invoke the latest version of the dll and
execute it accordingly. There could be the same name assemblies exists in the
GAC but they will have different versions altogether for their uniqueness.
So while running the application, CLR takes the latest version assembly and
use in the application.
13. What are Globalization and localization? How to implement them?
A. Globalization is the concept of developing the application in more than
one language while the Localization is used for a particular language. Like
if we develop the application in more than one language we need to create the
resource files (.resx) by using System. Globalization and when we open the
application in a particular language, then the localizations used to convert
that application to the selected language.
14. What is assembly, GAC? Where they are physically located?
A. Assembly is the collection of classes, namespaces, methods, properties
which may be developed in different language but packed as a dll. So we can
say that dll is the assembly.
There are 3 types of assemblies- Private Assembly, Shared Assembly, and
Satellite Assembly.
GAC (Global Assembly Cache)- When the assembly is required for more than one
project or application, we need to make the assembly with strong name and
keep it in GAC or in Assembly folder by installing the assembly with the
GACUtil command.
To make the assembly with strong name:
SN -k MyDll.dll
And to install it in GAC:
GacUtil -i MyDll.dll
GAC assemblies are physically stored in Assembly folder in the system.
15. How to configure HTTPS for a web application?
A. To configure the HTTPS (HTTP with Secure) for the web application, we need
to have a client certificate. We can purchase the client certificate from the
trusted providers and then we need to install that provider for our site. By
implementing the HTTPS, all the data which is passing will be in encrypted
format and will be more secure.
16. What are in-proc and out-proc? Where are data stored in these cases?
A. In-Proc and Out-Proc is the types of Sessions where the session data can
be stored in the process memory of the server and in the separate state
server.
When the session data is stored in the process memory of the server, the
session is called as the In-Proc server. In this case when the server is
restarted, the session data will be lost.
When the session data is stored in the separate server like in state server
or in Sql Server, the type of session is called as the Out-Proc session. In
this case, if the server where the application is running is restarted, the
session will be still remain in the separate servers.
So in the in-Proc session state, the session data is stored in the Process
memory of the Server where the application is running.
In the Out-proc session state, the session data is stored in the separate
server- may be state server or in sql server.
17. When the View state is saved, and when is it loaded? How to enable/
disable View states?
A. View State data is stored in the current page in base64 encoded format. It
gets loaded with the page and displays the values to the controls after the
decoded. Internally it actually saves the checksum of all the control data
where the view state is enabled.so that when the page gets loaded due to any
post back, it again finds the checksum and then decodes the Base64 encoded
string and gets back the same data to the controls. We can see the view state
base 64 encoded string in View Source of the page. It will be like
_VIEWETATE="DSDSDF8DGDGDFGFD5FDGGDJFF23BNN457M9UJOG" this.
View state won't take the client or server memory to keep the view state
data.
18. Difference between GET and POST. Which one is more secure?
A. GET and POST methods are used for the data transfer between the web pages.
GET mainly used for small data which is not secure because in case of GET
method, the data which we are passing will be visible in the url so we can't
keep the secure data which will be visible in the url. There is also limited
data which can be passed in case of GET method (max 255 character).
POST is used for transferring the huge data between the pages where we can
keep the secure data and can transfer it. In case of using the POST method,
the data which is transferring between the pages will not be visible so it is
more secure than the GET method. Also there is no limit for POST method to
post the data to the next page.
POST is more secure.
19. What are Razor engines? How is it diff from ASP Engines?
A. RAZOR engine is the new concept in the MVC 3 which is mainly used to
create the views in the MVC applications. It created the xhtml pages for the
MVC application and xhtml pages can be generated automatically by using the
Razor engine.ASP engine create the aspx pages while Razor engine creates the
xhtml pages.
20. Pros and cons of JavaScript and AJAX.
A. JavaScript is a scripting language and mainly used for client side
validation. We can validate the client side data before sending to the
server. So by this we can improve the performance of the application.
Ajax is Synchronous JavaScript and XML which is used for the Asynchronous
calls from the server. It uses internally the JavaScript for making the call
and use XML for the Data Transfer. It basically uses the XmlHttpRequest for
the asynchronous calls to the server and communicates with the xml data which
is platform independent. So Ajax can be used with any technology.
|
21. In how many different ways can JavaScript be used/called in an
application?
A. JavaScript can be used for Client Side validation, can also be used for
calling of server side methods and functions, can be used for calling the web
services etc.
22. What needs to be done to call a JavaScript function from code behind?
A. If we want to call the JavaScript function from the code behind, we need
to attach the JavaScript to the events in the page_load eventas:
protected void btnSave_cliekc9object sender, EventArgs e)
{
btnSave.Attributes.Add("onclick,"JavaScript: retrun
Validatedata();");
}
Here ValidateData is the JavaScript function which can be used to validate
the page data and if validation fails, it will return and will not execute the
server side btnSave_click event.
23. Difference between Server Controls and User controls?
A. User controls are used for the reusability for the controls in the
application. By using the user control, we can use the same control in the
various pages. User controls can be created by combining more than one
control. To use the user controls, first we need to register them in the web
page where we want to use that control. A separate copy is need in each page
where we want to use the user control. User controls can't be included in to
the toolbox.
Server controls are those controls which can be found in the toolbox and can
be directly drag to the application like textbox, button etc. For the server
control, only 1 copy of the control is needed irrespective of the number of
web pages. If we want 10 textboxes to be added in our web page, we need only
1 copy of the textbox in the toolbox and can be dragged 10 times.
24. Difference between Var, object and Dynamic types.
A. var is the keyword introduced with .net 3.5 and used to store any kind of
data like dataset, data table, int, float, char etc. We can keep any kind of
data in the var variable.
var myVar = new String[] {"hello", "world!!"} ;
Here the myVar is the var type variable which is used to store the string
array. Like this we can store any type of data into the var.
Object is the type which is used to store the objects of any kind. These
objects need to be type caste when required.
Like object mybject = "Hello"
Here the myObject variable of object type is used to keep the string
variable. Now when we want this variable value, we need to typecast it like
string strvar= (string) myobject;
Dynamic- It’s a keyword introduces with the .net 4.0 and used to keep the
data similar to the var keyword. The difference between the var and dynamic
is that the dynamic variable uses the same memory location to store the
object and not changes throughout the application.
25. Difference between Functions and methods.
A. in.Net terminology, both are same. in general, we use method in .net but
in scripting language we use function like JavaScript function.
Here the difference can be Function always returns a value which method may
or may not. It depends upon the return type of the method.
26. Difference between Abstract classes and Interface. Explain with scenario
where to implement one?
A. Collection of the Abstract (Incomplete) and Concrete (complete) methods is
called as the Abstract class. If there is at least one abstract method in a
class, the class must be abstract class.
When there is the similar behavior, we can use the abstract class.
e.g. We want to calculate the area of few component. As this is not generic
to the application. We have only few component- like Circle, Ellipse,
parabola, Hyperbola, Triangle etc.
So we can create an abstract class and implement it like below:
public abstract class MyAbstractClass
{
// some other concrete members
public abstract void Area();// abstract member
}
Now in the child class, let’s say i have a circle class and want to calculate
the area of the circle:
pyblic class Cicle: MyAbstractClass
{
public override void Area()
{
// calculate the area of the circle
}
}
In the similar fashion, we can calcite the area of other shapes.
Collection of abstract members is called as the Interface. When the behavior
is not similar, we need to use the interface. All the members of the
interface
must be overrides in the child class.
e.g. Print functionality of the application can have an interface like:
interface Inf
{
void Print();
}
Now as this is the generic functionality and can be implemented in any of the
page so we have taken it as interface. Now we can implement this
functionality in to any page like:
class MyClass:Inf
{
public void print
{
// write details about the print
}
// Here we can implement any kind of print-like print to excel, xml, word all
depends on the our decision.
}
27. Different forms of Polymorphism. Differences between Abstraction and
Polymorphism.
A. Polymorphism is to use the same function in many forms. The polymorphism
is of 2 types-
a. Classical polymorphism (Overloading)
b. AdHoc polymorphism (Overriding)
When the runtime (CLR) find the behavior of class members at the runtime of
the program, it is called as the AdHoc polymorphism or Overriding.in this the
method name is same but they are implemented in the different class. We use
virtual keyword in the base class method to be overrides in the child class
using the override keyword.
e.g.
public class MyClass
{
Public int Add(int a, int b)
{
Return a+b;
}
Public int Add(int a, int b, int c)
{
Return a+b+c;
}
}
When the runtime (CLR) find the behavior of class members at the compilation
of the program, it is called as the Classical polymorphism or Overloading.in
this the method name is same but there prototypes (parameters) are different
and it is implemented in the same class.
e.g.
Public class MyBaseClass
{
Public virtual void Show(string message)
{
Console.WriteLine(“Your message is : ”+ message);
}
}
Public class MyChildClass: MyBaseClass
{
public override void Show(string message)
{
Console.WriteLine(“Your new message is : ”+ message);
}
}
Abstraction is the behavior to get the required functionality in the child
class. So we don’t matter whatever is written in the base class. We only need
to force the child class to implement my required functionality.
Abstract keyword is used to get the abstraction behavior.
28. What are Delegates and Events?
A. A Delegate is an object, which points to another method in the
application. Delegate holds, name of the method, arguments of the method (if
any) and the return type of the method.
See the below points regarding the Delegate:-
• delegate keyword is sealed type in System. Multicast namespace.
• Delegate works like a function pointer in C language.
• Delegate holds the address of the function.
• Delegate hides the actual information which is written inside the method
definition.
• A delegate can hold address of a single function as well as the address of
multiple functions.
• There are 2 types of delegate- Single-cast delegate (hold single function)
and Multicast delegate(hold multiple functions).
• Addition and subtraction are allowed for the delegates but NOT
multiplication and division. It means, we can add delegates, subtract
delegates etc.
e.g. To create a single cast delegate, first we can create a class with a
method as:
public class DelegateDemo
{
public void Show(string msg)
{
Console.WriteLine(msg);
}
}
Now we can call the method Show using the delegate as:
public delegate void MyDelegate(string message); //declare delegate
now we need to create the object of the delegate with the address of the
method as:
DelegateDemo obj = new DelegateDemo();//class object
MyDelegate md= new MyDelegate(obj.Show(“Hello World!!”));
md(); // call the delegate
We can create the events and event handler by using delegate with the below
syntax:
public delegate void textChangedEventHandler(Object sender, TextEventArgs
e);
This event handler will be used to handle the textbox text changed event.
We can get more details about the delegate and events from the below link:
http://msdn.microsoft.com/en-in/library/orm-9780596521066-01-17.aspx
29. Covariance and Contra-variance.
A. covariance and contravariance are the new features added with the .net
4.0. They are basically used for the implicit reference conversion for
different .net types like array, delegate, and generic etc
You can go to the below link for more details with the examples that how we
can use the covariance and contrvariance to implicate reference conversion:
http://blogs.msdn.com/b/csharpfaq/archive/2010/02/16/covariance-and-contravariance-faq.aspx
30. What are Extension methods?
A. Extension methods are special types of methods which are static methods
but called as the instance methods. The extension methods are added with the
.Net framework 3.5 and with the Visual Studio 2008.
These methods won’t affect the existing class and the label. These methods
are used for the extra behavior which the calls can provide. There is no need
to build the class again if we add any extension method to the class.
There are various inbuilt methods added in .Net 3.5 with the introduction of
LINQ. We can see the extension methods like Order By when we use the Linq as:
e.g.
int[] numbers = { 10, 45, 15, 39, 21, 26 };
var orderedNumbers = numbers.OrderBy(a => a);
|
31. What are Anonymous methods and Lambda Expression?
A. Anonymous methods are those methods which does not have the name. As they
don’t have the name, so there is no way to call these methods. These methods
are created by using the work delegate as below:
button1.Click += delegate{listBox1.Items.Add(textBox1.Text)};
Lambda Expression: It’s an easy way to create anonymous functions. It is also
an anonymous function which has the capability to contain expressions and
statements. We can create the delegate and expression tree types using the
lambda expression.
For more details regarding the anonymous method and lambda express, you can
go through the below link:
http://www.codeproject.com/Articles/47887/C-Delegates-Anonymous-Methods-and-Lambda-Expressio
32. Multithreading. How to implement Multithreading?
A. Executing more than one process simultaneously called as multithreading.
To implement the multithreading concept, we need to use the System. Threading
.dll assembly and the System. Threading namespace.
To write the thread program, we need to create a class with the method. Now
we can create the thread object and then pass the method by using the class
object to the method.
After that we need to create the ThreadStart delegate which will call the
actual method of the class.
You can go through below link for more explanation and other details
regarding the implementation and the code snippet:
http://www.codeproject.com/Articles/1083/Multithreaded-Programming-Using-C
33. Which interface is used to-
a. Convert Boolean values to Visibility values?
b. Compare two integer values?
c. Compare String values?
A. Check the below interfaces which are used in these scenarios:
a. Convert Boolean values to Visibility values?
b. Compare two integer values?- IComparable interface
c. Compare String values? IComparer interface
SQL Server
34. What is the difference between a View and a Cursor?
A. View: It is one of the database object which is also called as virtual
table. We can also say that it is a window through which we can see some part
of database. View is also called as stored query because we are going to
fetch some data using View.
View doesn’t contain any data. It’s just a virtual table which is used to get
the records from the base table for which the view is created. View is faster
than ad hoc queries because when we create the view and execute it once. Next
time onwards it will be available as the compiled format. So whenever the
view is called, it will just execute rather than compiling.
Cursor: Cursor is a database object which is also the buffer area which is
created as a result of any sql statement to hold the intermediate values.
Views are used to format the rows individually. By using the views, we can
process the individual rows. There are 4 types of cursors in Sql Server-
a. Static Cursor
b. Dynamic Cursor
c. Key set cursor
d. Read-only cursor
35. How to execute multiple update on different conditions in a single query?
A. To execute multiple update using a single Sql update statement is the new
feature available with the SQL Server 2008. In this, we can update multiple
rows using a single update command.
36. Left outer joins and Right Outer joins
A. Joins are used to join 2 or more tables using some conditions. There are 3
types of Joins in SQL Server database-
a. Left Outer Join
b. Right Outer Join
c. Full Join
In order to extract the matched row from both the tables and unmatched row
from the first table, left Outer join is used. The syntax for left outer join
condition is:
T.Col1* = T2.Col1
In order to extract the matched row from both the tables and unmatched row
from the second table, right Outer join is used. The syntax for right outer
join condition is:
T.Col1 = *T2.Col1
In order to extract the matched row from both the tables and unmatched row
from the first table and then unmatched row from the second table, full join
is used. The syntax for full join condition is:
T.Col1* = *T2.Col1
37. Exception handling.
A. Exception Handling is the way to handle the unexpected error. From the SQL
Server 2005 version, try…catch block is also supported to catch the
exceptions in SQL Server database. There is various other ways to catch the
error like @@Error which is the global variable and used to get the error.
RaiseError is another inbuilt method which is used to display the error.
38. What is Performance Tuning? How do you implement it.
A. Performance Tuning is the process through which we can optimize the SQL
Server objects like functions, triggers, stored procedure so that we can
achieve high response time to the front end. In the performance tuning
process we generally check for the below point and optimize the objects
processing:
a. Through Query Execution plan, check for the processing time of the query
execution.
b. Check the join conditions and break all the condition for executions of
the queries individually
c. Check for the error prone process, conditions in the queries.
d. Check for the loops whether they are terminated if any error occurs
e. Check for the processes which are taking more time in execution and how to
reduce the response time.
39. Difference between Having and Where clauses.
A. When the where clause is not able to evaluate the condition which consists
of group functions, Having clause is used. Having clause is always followed
by the Group By clause.
Where clause is used to filter the records based on the conditions. If there
is the requirement to get the group data in the select statement and where
clause is not able to get it, we can use the Having clause.
e.g. Display DeptNo, No.of Employees in the department for all the
departments where more than 3 employees are working
SELECT DEPTNO, COUNT(*) AS TOTAL_EMPLOYEE
FROM EMP
GROUP BY DEPTNO HAVING COUNT(*) >3
40. Difference between Temp tables and Tables variables?
A. Temp Table in SQL Server:
a. Temp table is the special type of tables which are used to store the
intermediate data of the actual table.
b. Temp tables are only visible to the current sessions of the sql server
instance. When the session end, these table data automatically drops.
c. We can’t join the temp tables as they don’t allow the foreign key
constraints.
d. Temp tables are created in TempDB database.
e. We can use the same temp table name for the different user sessions.
f. Mostly used in stored procedure to handle the intermediate data.
|