<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Browser Detection Using Javascript</title>
<script type="text/javascript">
function Browser()
{
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) alert('Opera');
if (agt.indexOf("staroffice") != -1) alert('Star Office');
if (agt.indexOf("webtv") != -1) alert('WebTV');
if (agt.indexOf("beonex") != -1) alert('Beonex');
if (agt.indexOf("chimera") != -1) alert('Chimera');
if (agt.indexOf("netpositive") != -1) alert('NetPositive');
if (agt.indexOf("phoenix") != -1) alert('Phoenix');
if (agt.indexOf("firefox") != -1) alert('Firefox');
if (agt.indexOf("safari") != -1) alert('Safari');
if (agt.indexOf("skipstone") != -1) alert('SkipStone');
if (agt.indexOf("msie") != -1) alert('Internet Explorer');
if (agt.indexOf("netscape") != -1) alert('Netscape');
if (agt.indexOf("mozilla/5.0") != -1) alert('Mozilla');
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}
</script>
</head>
<body onload="return Browser();">
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
C# Interview Question :-
C# Interview Question :-
1)Virtual function in c# with example?
Virtual functions implement the concept of polymorphism are the same as in C#, except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.
class Shape{ public virtual void Draw() { Console.WriteLine("Shape.Draw") ; }}class Rectangle : Shape{ public override void Draw() { Console.WriteLine("Rectangle.Draw"); }}
2)How to Do File Exception Handaling in C#?
Exception handling is an in built mechanism in .NET framework to detect and handle run time errors. The .NET framework contains lots of standard exceptions. The exceptions are anomalies that occur during the execution of a program. They can be because of user, logic or system errors. If a user do not provide a mechanism to handle these anomalies, the .NET run time environment provide a default mechanism, which terminates the program execution
3)What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
4)What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
5)What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
6)Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
7)What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft.
OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines
8)What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
9)What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
10) What’s the difference between an interface and abstract class?
In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers
ASP.NET:-
1)How can we check if all the validation control are valid and proper?
Using the Page.IsValid () property you can check whether all the validation are done.
2)If client side validation is enabled in your Web page, does that mean server side code is not run.
When client side validation is enabled server emit’s JavaScript code for the custom validators. However, note that does not mean that server side checks on custom validators do not execute. It does this redundant check two times, as some of the validators do not support client side scripting.
3)How to disable client side script in validators?
Set ‘EnableClientScript’ to false.
4)How can we kill a user session?
Session abandon
5)Explain the differences between Server-side and Client-side code?
Server side code is executed at the server side on IIS in ASP.NET framework, while client side code is executed on the browser.
6)How do I sign out in forms authentication?
FormsAuthentication.Signout ()
7)How can we force all the validation control to run?
Page.Validate
What is the use of command objects?
In order to execute Sql commands and stored procedures we
need command objects
What are the two fundamental objects in ADO.NET?
DataSet and DataReader are the tow funadamental object in
ADO.NET
1)Virtual function in c# with example?
Virtual functions implement the concept of polymorphism are the same as in C#, except that you use the override keyword with the virtual function implementaion in the child class. The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.
class Shape{ public virtual void Draw() { Console.WriteLine("Shape.Draw") ; }}class Rectangle : Shape{ public override void Draw() { Console.WriteLine("Rectangle.Draw"); }}
2)How to Do File Exception Handaling in C#?
Exception handling is an in built mechanism in .NET framework to detect and handle run time errors. The .NET framework contains lots of standard exceptions. The exceptions are anomalies that occur during the execution of a program. They can be because of user, logic or system errors. If a user do not provide a mechanism to handle these anomalies, the .NET run time environment provide a default mechanism, which terminates the program execution
3)What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.
4)What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
5)What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
6)Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
7)What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft.
OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines
8)What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
9)What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.
10) What’s the difference between an interface and abstract class?
In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers
ASP.NET:-
1)How can we check if all the validation control are valid and proper?
Using the Page.IsValid () property you can check whether all the validation are done.
2)If client side validation is enabled in your Web page, does that mean server side code is not run.
When client side validation is enabled server emit’s JavaScript code for the custom validators. However, note that does not mean that server side checks on custom validators do not execute. It does this redundant check two times, as some of the validators do not support client side scripting.
3)How to disable client side script in validators?
Set ‘EnableClientScript’ to false.
4)How can we kill a user session?
Session abandon
5)Explain the differences between Server-side and Client-side code?
Server side code is executed at the server side on IIS in ASP.NET framework, while client side code is executed on the browser.
6)How do I sign out in forms authentication?
FormsAuthentication.Signout ()
7)How can we force all the validation control to run?
Page.Validate
What is the use of command objects?
In order to execute Sql commands and stored procedures we
need command objects
What are the two fundamental objects in ADO.NET?
DataSet and DataReader are the tow funadamental object in
ADO.NET
What is Event Bubbling
Server Controls like DataGrid, DataGridView and DataList have other controls inside them. Example The DataGridView can have a TextBox or a button inside it. These Child Controls cannot raise events by themselves, but they pass the event to the parent control (DataGridView), which is passed to the page as "ItemCommand" event. This process is known as EventBubling.
C# General Questions
C# General Questions
1. Does C# support multiple-inheritance?
No.
2. Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).
3. Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.
4. Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.
5. What’s the top .NET class that everything is derived from?
System.Object.
6)How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
7) Is it possible to debug java-script in .NET IDE? If yes, how?
Yes, simply write "debugger" statement at the point where the breakpoint needs to be set within the javascript code and also enable javascript debugging in the browser property settings.
Interview Question
1)which statement is running fastly ie insert or delete?
Its definitely Delete.Becuase When Delete operation is being performed then Oracle
doesnot actualy permanently remove the data from data block
but rather marks that particular data block as unusable.
Whereas when concerned to Insert Oracle needs to insert the
new values into Datablocks.
2)Whats the main difference between Subquery and a Join?
Majorly subqueries run independently and result of the
subquery used in the outer query(other than corelated subquery).
And in case of join a query only give the result when the
joining condition gets satisfied.
3)what is the difference between first normal form & second
normal form?
First Normal Form:
1.it doesnt contain the duplicate rows and null values.
2.those values can be moved into new table.
second normal form:
1.each columns are completely depend upon key
4)What does COMMIT do ?
Commit is a TCL command which is used to make database
transaction parmanent.The data is commited but it can't be rollbacked.
5)difference between oracle8i and oracle9i?
merge is a command which is used to both insert and delete.
timestamp datatype is introduced.
max no of columns in 8i is 256 where as in 9i we can have
999.
on delete set null supports only in 9i.
by using this, when we delete the parent record the child
records are replaced with null values
6)What is the difference between a procedure and a function ?
Functions return a single variable by value whereas procedures do not return any variable by value.Rather they return multiple variables by passing variables by reference through their OUT parameter.
7)What is the advantage of a stored procedure over a database trigger ?
We have control over the firing of a stored procedure but we have no control over the firing of a trigger.
8)What are cascading triggers? What is the maximum no of cascading triggers at a time?
When a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading.Max = 32.
9)What are the various types of queries ?
The types of queries are:
Normal Queries
Sub Queries
Co-related queries
Nested queries
Compound queries
10)What is a transaction ?
A transaction is a set of SQL statements between any two COMMIT and ROLLBACK statements.
11)What is PL/SQL?
PL/SQL is Oracle's Procedural Language extension to SQL.The language includes object oriented programming techniques such as encapsulation, function overloading, information hiding (all but inheritance), and so, brings state-of-the-art programming to the Oracle database server and a variety of Oracle tools.
Its definitely Delete.Becuase When Delete operation is being performed then Oracle
doesnot actualy permanently remove the data from data block
but rather marks that particular data block as unusable.
Whereas when concerned to Insert Oracle needs to insert the
new values into Datablocks.
2)Whats the main difference between Subquery and a Join?
Majorly subqueries run independently and result of the
subquery used in the outer query(other than corelated subquery).
And in case of join a query only give the result when the
joining condition gets satisfied.
3)what is the difference between first normal form & second
normal form?
First Normal Form:
1.it doesnt contain the duplicate rows and null values.
2.those values can be moved into new table.
second normal form:
1.each columns are completely depend upon key
4)What does COMMIT do ?
Commit is a TCL command which is used to make database
transaction parmanent.The data is commited but it can't be rollbacked.
5)difference between oracle8i and oracle9i?
merge is a command which is used to both insert and delete.
timestamp datatype is introduced.
max no of columns in 8i is 256 where as in 9i we can have
999.
on delete set null supports only in 9i.
by using this, when we delete the parent record the child
records are replaced with null values
6)What is the difference between a procedure and a function ?
Functions return a single variable by value whereas procedures do not return any variable by value.Rather they return multiple variables by passing variables by reference through their OUT parameter.
7)What is the advantage of a stored procedure over a database trigger ?
We have control over the firing of a stored procedure but we have no control over the firing of a trigger.
8)What are cascading triggers? What is the maximum no of cascading triggers at a time?
When a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading.Max = 32.
9)What are the various types of queries ?
The types of queries are:
Normal Queries
Sub Queries
Co-related queries
Nested queries
Compound queries
10)What is a transaction ?
A transaction is a set of SQL statements between any two COMMIT and ROLLBACK statements.
11)What is PL/SQL?
PL/SQL is Oracle's Procedural Language extension to SQL.The language includes object oriented programming techniques such as encapsulation, function overloading, information hiding (all but inheritance), and so, brings state-of-the-art programming to the Oracle database server and a variety of Oracle tools.
Subscribe to:
Posts (Atom)