0% found this document useful (0 votes)
12 views3 pages

Ii CHT

The document provides answers to various exam questions related to web design, JavaScript, and HTML. Key topics include principles of effective web design, FTP, predefined JavaScript functions, the Document Object Model (DOM), and examples of HTML and JavaScript code. Additionally, it covers operators in JavaScript, caching, and creating forms for user input.

Uploaded by

karandey968
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Ii CHT

The document provides answers to various exam questions related to web design, JavaScript, and HTML. Key topics include principles of effective web design, FTP, predefined JavaScript functions, the Document Object Model (DOM), and examples of HTML and JavaScript code. Additionally, it covers operators in JavaScript, caching, and creating forms for user input.

Uploaded by

karandey968
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Here are the answers to the questions on the second page of the exam paper:

---

### Q3. Attempt any four of the following:

1. **Explain concepts of effective web design in details**:


- Effective web design principles include simplicity, consistency,
accessibility, visual hierarchy, and responsiveness. An effective website should
be easy to navigate, visually appealing, and adaptable to different screen
sizes. The design should also consider user experience by focusing on fast
loading times and providing clear, readable content.

2. **Write Note on FTP**:


- FTP (File Transfer Protocol) is a standard protocol used to transfer files
between a client and server over a network. It operates over TCP/IP connections
and allows users to upload, download, delete, and manage files on remote
servers. FTP requires a client (such as FileZilla) to connect to an FTP server
and may use authentication to ensure secure access.

3. **Explain any 4 predefined functions used in JavaScript**:


- **`alert()`**: Displays a message box to the user.
- **`parseInt()`**: Parses a string and returns an integer.
- **`setTimeout()`**: Executes a function after a specified delay.
- **`Math.random()`**: Returns a random floating-point number between 0
(inclusive) and 1 (exclusive).

4. **Explain DOM**:
- The DOM (Document Object Model) is a programming interface for web
documents. It represents the structure of an HTML or XML document as a tree of
objects, where each element is a node. JavaScript can manipulate the DOM to
dynamically change the content, structure, and styling of a webpage.

5. **Write a JavaScript program to create four buttons on the web page. Clicking
on a button will change the background color of the web page**:
```javascript
<!DOCTYPE html>
<html>
<body>
<button onclick="changeColor('red')">Red</button>
<button onclick="changeColor('green')">Green</button>
<button onclick="changeColor('blue')">Blue</button>
<button onclick="changeColor('yellow')">Yellow</button>

<script>
function changeColor(color) {
document.body.style.backgroundColor = color;
}
</script>
</body>
</html>
```

---

### Q4. Attempt any four of the following:

1. **Write HTML code to design the following output for table**:


```html
<!DOCTYPE html>
<html>
<body>
<table border="1">
<caption>Train Time Table</caption>
<tr>
<th>TNO</th>
<th>TNAME</th>
<th>Arrival Time</th>
<th>Departure Time</th>
</tr>
<tr>
<td>T01</td>
<td>Rajdhani</td>
<td>04.00pm</td>
<td>04.30pm</td>
</tr>
<tr>
<td>T02</td>
<td>Indrayani</td>
<td>05.15pm</td>
<td>05.45pm</td>
</tr>
</table>
</body>
</html>
```

2. **Explain any 4 operators used in JavaScript with example**:


- **Arithmetic operators** (e.g., `+`, `-`): Used for mathematical
operations. Example: `5 + 3`
- **Comparison operators** (e.g., `==`, `!=`): Used to compare values.
Example: `5 == 5`
- **Logical operators** (e.g., `&&`, `||`): Used for logical operations.
Example: `true && false`
- **Assignment operators** (e.g., `=`, `+=`): Used to assign values to
variables. Example: `x += 5`

3. **Explain the Working of caching**:


- Caching is a process of storing copies of files in a temporary storage
location (cache) for quicker access. It reduces the need to re-download
resources, improving load times and performance. Caching can be done on the
client side (browser cache) or the server side.

4. **Design an HTML form to take the information of a customer for booking a


travel plan**:
```html
<!DOCTYPE html>
<html>
<body>
<form action="/submit" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name"><br><br>

<label for="address">Address:</label>
<input type="text" id="address" name="address"><br><br>

<label for="contact">Contact No:</label>


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

<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label><br><br>

<button type="submit">Submit</button>
</form>
</body>
</html>
```

5. **Write a JavaScript program to check if a given number is perfect or not**:


```javascript
function isPerfectNumber(num) {
let sum = 0;
for (let i = 1; i < num; i++) {
if (num % i === 0) {
sum += i;
}
}
return sum === num;
}

// Example usage
let number = 28;
console.log(isPerfectNumber(number) ? `${number} is a perfect number` : `$
{number} is not a perfect number`);
```

---

If you need further explanations or answers to additional questions, let me


know!

You might also like