Showing posts with label C# interview questions and answers | Sharath. Show all posts
Showing posts with label C# interview questions and answers | Sharath. Show all posts

Tuesday, 3 June 2014

Top 10 C# Interview Questions and Answers 2014,C# interview questions and answers | Sharath,important .NET interview Questions & Answers

1.what is importance of DOCTYPE in html?

<html>
<head>
<title>Title of the document</title>
</head>

<body>
The content of the document......
</body>

</html>
The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.
The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.
In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.
HTML5 is not based on SGML, and therefore does not require a reference to a DTD.
HTML (HyperText Markup Language) then I would suggest you use the HTML 4.01 Transitional declaration. It is much more forgiving for the beginner when performing HTML validation. You would also use this declaration if you know that your audience will not have a browser that supports CSS (Cascading Style Sheets).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
This DOCTYPE declaration still allows elements and presentation attributes that should be in the stylesheet.
If you want to learn to code in preparation for the future but still not ready for XHTML then you would use the Strict declaration.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
With this declaration all presentation attributes are moved to the stylesheet.
!DOCTYPE
The identifier. It indicates to the user-agent that the enclosed information will define the type of document of the page.

2.what is frameset and frame?
The <frameset> tag is not supported in HTML5.
The <frameset> tag defines a frameset.
The <frameset> element holds one or more <frame> elements. Each <frame> element can hold a separate document.
The <frameset> element specifies HOW MANY columns or rows there will be in the frameset, and HOW MUCH percentage/pixels of space will occupy each of them.

Example:-
<frameset cols="25%,*,25%">
  <frame src="frame_a.htm">
  <frame src="frame_b.htm">
  <frame src="frame_c.htm">
</frameset>
The <frameset> Element:
  • The <frameset> tag replaces the <body> element in frameset documents.
  • The <frameset> tag defines how to divide the window into frames.
  • Each frameset defines a set of rows or columns. If you define frames by using rows then horizontal frames are created. If you define frames by using columns then vertical farmes are created.
  • The values of the rows/columns indicate the amount of screen area each row/column will occupy.
  • Each farme is indicated by <frame> tag and it defines what HTML document to put into the frame.



3.what are  form element in html  and  write each element syntax?
HTML forms are used to pass data to a server.
An HTML form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements. HTML elements in ASP.NET files are, by default, treated as text. To make these elements programmable, add a runat="server" attribute to the HTML element. This attribute indicates that the element should be treated as a server control.
Note: All HTML server controls must be within a <form> tag with the runat="server" attribute!

The <form> tag is used to create an HTML form:
<body>
    <form id="form1" runat="server">
<table   >

    <tr>
    <td><b>First Name</b></td>
    <td>:</td>
    <td>
        <asp:TextBox ID="TextBox1"runat="server"Height="18px"Width="166px"></asp:TextBox>
       &nbsp; &nbsp;
        <asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"
            ErrorMessage="*"ControlToValidate="TextBox1"ForeColor="Red"></asp:RequiredFieldValidator>
       
        <br />
       
        </td>
    
         </tr>

     <tr>

    <td><b>Last Name</b></td>
    <td>:</td>
    <td>
        <asp:TextBox ID="TextBox2"runat="server"Height="18px"Width="166px"  ></asp:TextBox>
       &nbsp; &nbsp;
        <asp:RequiredFieldValidatorID="RequiredFieldValidator2"runat="server"
            ErrorMessage="*"ControlToValidate="TextBox2"ForeColor="Red"></asp:RequiredFieldValidator>
       
        </td>
    </tr>
        <asp:DropDownList ID="DropDownList4"runat="server">
        </asp:DropDownList>
     <tr>

    <td><b>Education Qualification</b></td>
    <td>:</td>
    <td>
        <asp:DropDownList ID="DropDownList5"runat="server"Height="18px"Width="166px">
        <asp:ListItem>--Select--</asp:ListItem>
        <asp:ListItem>10Th Class</asp:ListItem>
        <asp:ListItem>Inter</asp:ListItem>
        <asp:ListItem>B.Tech</asp:ListItem>
        <asp:ListItem>B.Sc</asp:ListItem>
        <asp:ListItem>M.sc</asp:ListItem>
        <asp:ListItem>M.tech</asp:ListItem>
        <asp:ListItem>M.B.A</asp:ListItem>
        </asp:DropDownList>
       
          &nbsp; &nbsp;
        <asp:RequiredFieldValidatorID="RequiredFieldValidator3"runat="server"
            ErrorMessage="*"ControlToValidate="DropDownList5"ForeColor="Red"></asp:RequiredFieldValidator>
       
          </td>

    </tr>
</table>

4. create one function and call that function onto  button click?
<head runat="server">
    <title></title>
   <script>
       function myfun() {
           document.getElementById("demo").innerHTML = Date;
           }
    
        </script>
</head>
<body >
    <form id="form1" runat="server">
    <div align="center">
    <h1>Welcome to Javascript Language</h1>
    <p>Click the button to dispaly the date .</p>
    <p id="demo"></p>
    <button type="button"onclick="myfun()">Try it</button>
      
    </div>
    </form>
</body>



5.how to create array in javascript? dispaly records.

The Array object let's you store multiple values in a single variable.
Example for the arrays
var fruits = new Array( "apple", "orange", "mango" );
ordinal numbers to access and to set values inside an array as follows:
·  fruits[0] is the first element
·  fruits[1] is the second element
·  fruits[2] is the third element

<!DOCTYPE html>
<html>
<body>

<script>
var i;
var myworld = new Array();
myworld[0] = "sharath";
myworld[1] = "kumar    ";
myworld [2] = "reddy";

for (i=0;i<mycars.length;i++)
{
document.write(myworld [i] + "<br>");
}
</script>

</body>
</html>

Output:
Sharath
Kumar  

Reddy