Web technology questions with answers

Q1.Create an HTML page to accept customer’s information for the

following with appropriate form elements : Customer Name,

Address, Gender, Languages known, City, and to submit the contents

<!DOCTYPE html>

<html>

<head>

 <title>Customer Information Form</title>

</head>

<body>

 <h1>Customer Information Form</h1>

 <form action="#" method="post">

  <label for="name">Name:</label>

  <input type="text" id="name" name="name" required><br><br>


  <label for="address">Address:</label>

  <textarea id="address" name="address" required></textarea><br><br>


  <label for="gender">Gender:</label>

  <input type="radio" id="male" name="gender" value="male" required>

  <label for="male">Male</label>

  <input type="radio" id="female" name="gender" value="female" required>

  <label for="female">Female</label>

  <input type="radio" id="other" name="gender" value="other" required>

  <label for="other">Other</label><br><br>


  <label for="languages">Languages known:</label><br>

  <input type="checkbox" id="english" name="languages[]" value="english">

  <label for="english">English</label><br>

  <input type="checkbox" id="spanish" name="languages[]" value="spanish">

  <label for="spanish">Spanish</label><br>

  <input type="checkbox" id="french" name="languages[]" value="french">

  <label for="french">French</label><br>

  <input type="checkbox" id="german" name="languages[]" value="german">

  <label for="german">German</label><br><br>

  <label for="city">City:</label>

  <select id="city" name="city" required>

   <option value="">--Select City--</option>

   <option value="newyork">New York</option>

   <option value="losangeles">Los Angeles</option>

   <option value="chicago">Chicago</option>

   <option value="houston">Houston</option>

  </select><br><br>


  <input type="submit" value="Submit">

 </form>

</body>

</html>



Q2.How the tables are formed in HTML? Explain with example. ExplainCellpadding and Cellspacing with example.

In HTML, tables are formed using the <table> tag. The content of a table is enclosed within this tag, and the actual rows of the table are defined using the <tr> tag. The cells of the table are defined using the <td> tag, and the header cells are defined using the <th> tag.

Here is an example of a simple table in HTML:

<table>

  <tr>

    <th>Header 1</th>

    <th>Header 2</th>

    <th>Header 3</th>

  </tr>

  <tr>

    <td>Row 1, Column 1</td>

    <td>Row 1, Column 2</td>

    <td>Row 1, Column 3</td>

  </tr>

  <tr>

    <td>Row 2, Column 1</td>

    <td>Row 2, Column 2</td>

    <td>Row 2, Column 3</td>

  </tr>

</table>

In this example, we have a table with three columns and two rows. The first row contains the header cells, which are styled differently than the regular cells. The second and third rows contain the content of the table.

Cellpadding and Cellspacing are attributes that can be used to control the spacing around the content and the borders of the cells in a table.

Cellpadding defines the space between the content of a cell and its borders. For example, if we want to add 5 pixels of padding to all cells in a table, we can add the following attribute to the <table> tag:

<table cellpadding="5">

Cellspacing defines the space between the borders of adjacent cells. For example, if we want to add 2 pixels of spacing between all cells in a table, we can add the following attribute to the <table> tag:

<table cellspacing="2">

Here is an example that combines both attributes:

<table cellpadding="5" cellspacing="2">

  <tr>

    <th>Header 1</th>

    <th>Header 2</th>

    <th>Header 3</th>

  </tr>

  <tr>

    <td>Row 1, Column 1</td>

    <td>Row 1, Column 2</td>

    <td>Row 1, Column 3</td>

  </tr>

  <tr>

    <td>Row 2, Column 1</td>

    <td>Row 2, Column 2</td>

    <td>Row 2, Column 3</td>

  </tr>

</table>

In this example, all cells have 5 pixels of padding, and there is 2 pixels of spacing between adjacent cells.

Q3.Define classes of an IP address along with the range of host ID and network ID

In IP addressing, there are five classes of IP addresses, designated by the letters A, B, C, D, and E. The classes are defined based on the number of bits used to identify the network portion and the host portion of the address.


Here are the classes of IP addresses, along with the range of host IDs and network IDs for each class:


Class A:


The first bit of the IP address is always 0.

The next 7 bits identify the network portion of the address, while the remaining 24 bits identify the host portion.

The range of network IDs is from 1.0.0.0 to 126.0.0.0.

The range of host IDs is from 0.0.0.1 to 127.255.255.254.

Class B:


The first 2 bits of the IP address are always 10.

The next 14 bits identify the network portion of the address, while the remaining 16 bits identify the host portion.

The range of network IDs is from 128.0.0.0 to 191.255.0.0.

The range of host IDs is from 0.0.1.0 to 255.255.254.254.

Class C:


The first 3 bits of the IP address are always 110.

The next 21 bits identify the network portion of the address, while the remaining 8 bits identify the host portion.

The range of network IDs is from 192.0.0.0 to 223.255.255.0.

The range of host IDs is from 0.0.0.1 to 255.255.255.254.

Class D:


The first 4 bits of the IP address are always 1110.

These addresses are reserved for multicast groups, and the remaining 28 bits are used to identify the multicast group.

Class E:


The first 4 bits of the IP address are always 1111.

These addresses are reserved for experimental or research purposes, and are not used in public networks.

Note that the range of network IDs and host IDs are not absolute, as certain addresses are reserved for special purposes, such as loopback addresses and broadcast addresses.






Comments

Popular Posts