0% found this document useful (0 votes)
4 views5 pages

Web Development Test

The document contains a web development test with questions on HTML, CSS, and JavaScript, along with code snippets for creating a navigation bar, a function to check if a number is even, and a button to change the background color of a webpage. It includes specific answers to multiple-choice questions and example code for practical tasks. The test is designed for a student named Meenal in Batch-4 (Online-Evening).

Uploaded by

meenal09281
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)
4 views5 pages

Web Development Test

The document contains a web development test with questions on HTML, CSS, and JavaScript, along with code snippets for creating a navigation bar, a function to check if a number is even, and a button to change the background color of a webpage. It includes specific answers to multiple-choice questions and example code for practical tasks. The test is designed for a student named Meenal in Batch-4 (Online-Evening).

Uploaded by

meenal09281
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/ 5

Web Development Test

Name-Meenal

Batch-4(Online-Evening)

1.Which HTML tag is used to create a hyperlink?

Answer---<a>

2. What is the correct way to apply an external CSS file?

Answer---<link rel="stylesheet" href="style.css">

3. Which of the following is NOT a valid CSS property?

Answer---background-inline

4. Which of the following will correctly display an alert box in JavaScript?

Answer---alert("Hello!");

5. What will be the output of console.log(typeof []) in JavaScript?

Answer---object

6. What is the default position value in CSS?

Answer---static

7. Which HTML tag is used for creating a form?

Answer---<form>

8. What will document.getElementById('demo').innerHTML = "Hello"; do?

Answer---Change the content inside the HTML element with ID "demo" to "Hello"

9. Which CSS unit is relative to the font size of the parent element?

Answer---em

10. What does event.preventDefault() do in JavaScript?

Answer---Prevents the default action of an event


Q11. HTML & CSS (4 Marks) Create an HTML page with a navigation bar having three links (Home,
About, Contact). Style the navigation bar using CSS with the following properties:

• Background color: Blue

• Text color: White

• Remove underline from links

• Change link color to yellow when hovered

Html Code
<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Navigation Bar</title>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<nav>

<ul>

<li><a href="#home">Home</a></li>

<li><a href="#about">About</a></li>

<li><a href="#contact">Contact</a></li>

</ul>

</nav>

</body>

</html>
CSS Code
nav {

background-color: blue;

text-align: center;

padding: 10px 0;

nav ul {

list-style-type: none;

margin: 0;

padding: 0;

nav ul li {

display: inline;

margin: 0 15px;

nav ul li a {

text-decoration: none;

color: white;

font-size: 18px;

nav ul li a:hover {
color: yellow;

12. Write a JavaScript function named isEven(num) that checks if a number is even. The function should:
• Take a number as input

• Return "Even" if the number is even

• Return "Odd" if the number is odd

Example: console.log(isEven(4)); // Output: "Even"

console.log(isEven(7)); // Output: "Odd"

CODE
function isEven(num) {

if (num % 2 === 0) {

return "Even";

} else {

return "Odd";

console.log(isEven(4));

console.log(isEven(7));

13. Write an HTML and JavaScript snippet where:

• A button with id="btn" exists.

• When the button is clicked, it should change the background color of the webpage to red.

CODE
<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Change Background Color</title>

</head>

<body>

<button id="btn">Click me to change background color</button>

<script>

document.getElementById('btn').onclick = function() {

document.body.style.backgroundColor = 'red';

};

</script>

</body>

</html>

You might also like