1. Home
  2. Docs
  3. Web Technology I
  4. Model Question Solutions
  5. Model Question 2023 Solution

Model Question 2023 Solution

bim 3rd sem model question 2023 solutions

Group “A”

Thank you for reading this post, don't forget to subscribe!

Group “B”

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example HTML Document</title>
    <!-- Additional head elements (stylesheets, scripts, etc.) can be added here -->
</head>
<body>
    <header>
        <h1>Welcome to My Website</h1>
        <!-- Additional header content can be added here -->
    </header>
    
    <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>

    <main>
        <section id="home">
            <h2>Home Section</h2>
            <p>This is the home section of the website.</p>
        </section>

        <section id="about">
            <h2>About Section</h2>
            <p>Learn more about our website and its purpose.</p>
        </section>

        <section id="contact">
            <h2>Contact Section</h2>
            <p>Feel free to reach out to us through the contact form.</p>
        </section>
    </main>

    <footer>
        <p>© 2024 My Website. All rights reserved.</p>
    </footer>
</body>
</html>
image 39
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Website</title>

    <!-- External Style Sheet -->
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <h1>Welcome to My Website</h1>
    <p>This is a sample HTML page with an external style sheet.</p>
</body>
</html>
{
  "name": "John Doe",
  "age": 25,
  "city": "Example City",
  "isStudent": false,
  "grades": [90, 85, 92],
  "address": {
    "street": "123 Main Street",
    "zipCode": "12345"
  },
  "isEmployed": null
}
image 40
// Sample JSON string (can be read from a file or an API response)
const jsonString = '{"name": "John Doe", "age": 25, "city": "Example City"}';

// Parse the JSON string into a JavaScript object
const jsonObject = JSON.parse(jsonString);

// Access the values using object properties
console.log(jsonObject.name); // Output: John Doe
console.log(jsonObject.age);  // Output: 25
console.log(jsonObject.city); // Output: Example City
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
  <book category="fiction">
    <title lang="en">Harry Potter</title>
    <author>J.K. Rowling</author>
    <price>29.99</price>
  </book>
  <book category="non-fiction">
    <title lang="es">Cien años de soledad</title>
    <author>Gabriel García Márquez</author>
    <price>19.95</price>
  </book>
</bookstore>
image 41

Group “C”

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }

        form {
            width: 300px;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        label {
            display: block;
            margin-bottom: 8px;
        }

        input, select {
            width: 100%;
            padding: 8px;
            margin-bottom: 16px;
            box-sizing: border-box;
        }

        button {
            background-color: #4caf50;
            color: #fff;
            padding: 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        button:hover {
            background-color: #45a049;
        }
    </style>
    <title>User Input Form</title>
</head>
<body>

    <form>
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required>

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

        <label for="gender">Gender:</label>
        <select id="gender" name="gender" required>
            <option value="male">Male</option>
            <option value="female">Female</option>
            <option value="other">Other</option>
        </select>

        <button type="submit">Submit</button>
    </form>

</body>
</html>
  • Content: The actual content of the box, where text and images appear.
  • Padding: The space between the content and the border.
  • Border: A border surrounding the padding (if any).
  • Margin: The space between the border and the surrounding elements.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .box {
            width: 200px;
            height: 100px;
            padding: 20px;
            border: 2px solid #333;
            margin: 30px;
        }
    </style>
    <title>Box Model Example</title>
</head>
<body>

    <div class="box">
        This is the content inside the box.
    </div>

</body>
</html>
// Function to set a cookie
function setCookie(name, value, daysToExpire) {
    const expirationDate = new Date();
    expirationDate.setDate(expirationDate.getDate() + daysToExpire);

    const cookieString = `${name}=${value}; expires=${expirationDate.toUTCString()}; path=/`;
    document.cookie = cookieString;
}

// Function to get a cookie value by name
function getCookie(name) {
    const cookies = document.cookie.split(';');
    for (const cookie of cookies) {
        const [cookieName, cookieValue] = cookie.trim().split('=');
        if (cookieName === name) {
            return cookieValue;
        }
    }
    return null;
}

// Example: Set username and password cookies for 7 days
setCookie('username', 'john_doe', 7);
setCookie('password', 'secure_password', 7);

// Example: Get and display username and password from cookies
const username = getCookie('username');
const password = getCookie('password');

console.log('Username:', username);
console.log('Password:', password);
<!-- Bookstore.xsd -->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <!-- Define the elements and their types -->
  <xs:element name="bookstore">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="book" type="BookType" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name="BookType">
    <xs:sequence>
      <xs:element name="title" type="xs:string"/>
      <xs:element name="author" type="xs:string"/>
      <xs:element name="price" type="xs:decimal"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>

Group “D”

  • Inline Styles:
<p style="color: red; font-size: 16px;">This is a paragraph with inline styles.</p>
  • Internal Styles:
<head>
  <style>
    p {
      color: blue;
      font-size: 18px;
    }
  </style>
</head>
  • External Styles (Linked CSS file):
<head>
  <link rel="stylesheet" href="styles.css">
</head>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Form Validation</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #f0f0f0;
        }

        form {
            width: 300px;
            padding: 20px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        label {
            display: block;
            margin-bottom: 8px;
        }

        input, select {
            width: 100%;
            padding: 8px;
            margin-bottom: 16px;
            box-sizing: border-box;
        }

        button {
            background-color: #4caf50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        button:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>

    <form id="myForm" onsubmit="return validateForm()">
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <label for="country">Country:</label>
        <select id="country" name="country" required>
            <option value="">Select Country</option>
            <option value="usa">USA</option>
            <option value="canada">Canada</option>
            <option value="uk">UK</option>
            <!-- Add more countries as needed -->
        </select>

        <button type="submit">Submit</button>
    </form>

    <script>
        function validateForm() {
            var username = document.getElementById('username').value;
            var password = document.getElementById('password').value;
            var country = document.getElementById('country').value;

            // Validate username
            if (username.length ! = = 8) {
                alert('Username should be of length 8');
                return false;
            }

            // Validate password
            if (!/^\d/.test(password) || !/^[a-zA-Z0-9]+$/.test(password)) {
                alert('Password should start with a digit and be alphanumeric');
                return false;
            }

            // Validate country
            if (country = = = '') {
                alert('Please select a country');
                return false;
            }

            // If all validations pass, the form is submitted
            return true;
        }
    </script>

</body>
</html>

How can we help?