2078

CSC329 · TU past paper

Web Technology 2078 question paper

The complete TU 2078 exam paper for Web Technology (CSC329), all 11 questions with solved model answers written to the mark scheme.

Tap a question to open its answer.

  1. 110 marksArrayAnswer

    How do you define an Array in PHP? write a PHP script to create a multidimensional array name Product that will contain pcode, pname, and price. Initialize the array with at least three instances. Also, Write an HTML script to display the initialized values of the array in an HTML Table.[10]

    As stated in the course notes: "An array is a special variable, which can hold more than one value at a time. An array can hold many values under a single name, and we can access the values by referring to an index number." --- According...

  2. 210 marksEvent Handling and Form ValidationAnswer

    Create an HTML signup form with fields Name, Email, Password, and Age. Validate the form using JavaScript. Write functions for validating each of the elements. All of the fields should not be empty. The Email address should be a valid email, the password should be of length at least 6 and should start with the alphabet and end with a digit. The age should be between 8 and 60.[10]

    --- - The <form tag's onsubmit="return validateForm()" calls validateForm() every time the user clicks Sign Up. If validateForm() returns false, the browser cancels the submission and the error messages stay visible next to each field. -...

  3. 310 marksInserting CSSAnswer

    How external CSS is inserted in an HTML page? Create an HTML page with two paragraph tags with id p1 and p2, and one div tag with id dv1. Write an external CSS file as per the description. the margin of the paragraphs should be 100px from the top and 80px from the left. Both of paragraphs should have the display set to block. The dv1 should have padding left and right set to 30px and 25px respectively, its background color should be blue and the font color should be red with the font type Verdana. Set the display of dv1 to none.[10]

    External CSS in HTML - Complete Answer

    How External CSS is Inserted in an HTML Page

    External CSS is a separate .css file that contains all the style rules. It is linked to an HTML page using the <link> tag inside the <head> section of the HTML document.

    Syntax:

    <link rel="stylesheet" type="text/css" href="filename.css">
    
    • rel="stylesheet" defines the relationship between the HTML file and the linked file.
    • type="text/css" specifies the media type (optional in HTML5).
    • href="filename.css" specifies the path to the external CSS file.

    Advantages of External CSS:

    • One CSS file can control the style of multiple HTML pages.
    • Changes made in one file reflect across all linked pages.
    • Keeps HTML structure and styling separate (clean code).

    HTML File (index.html)

    <!DOCTYPE html>
    <html>
      <head>
        <title>External CSS Example</title>
        <link rel="stylesheet" type="text/css" href="style.css">
      </head>
      <body>
    
        <p id="p1">This is Paragraph 1 (id = p1)</p>
    
        <p id="p2">This is Paragraph 2 (id = p2)</p>
    
        <div id="dv1">
          This is a div block (id = dv1)
        </div>
    
      </body>
    </html>
    

    External CSS File (style.css)

    /* Styles for paragraph with id p1 */
    #p1 {
        margin-top: 100px;
        margin-left: 80px;
        display: block;
    }
    
    /* Styles for paragraph with id p2 */
    #p2 {
        margin-top: 100px;
        margin-left: 80px;
        display: block;
    }
    
    /* Styles for div with id dv1 */
    #dv1 {
        padding-left: 30px;
        padding-right: 25px;
        background-color: blue;
        color: red;
        font-family: Verdana;
        display: none;
    }
    

    Explanation of CSS Properties Used

    PropertyElementValueDescription
    margin-top#p1, #p2100pxSets top margin to 100px
    margin-left#p1, #p280pxSets left margin to 80px
    display#p1, #p2blockDisplays paragraphs as block elements
    padding-left#dv130pxSets left padding to 30px
    padding-right#dv125pxSets right padding to 25px
    background-color#dv1blueSets background color to blue
    color#dv1redSets font/text color to red
    font-family#dv1VerdanaSets font type to Verdana
    display#dv1noneHides the div element completely

    Note: The # selector in CSS is used to target elements by their id attribute. Since id values are unique per page, #p1, #p2, and #dv1 target exactly those specific elements.

  4. 45 marksWeb 2.0Answer

    What are the services provided under web2.0? [5]

    Web 2.0 refers to the second generation of the World Wide Web that emphasizes user-generated content, usability, interoperability, and collaboration. Unlike Web 1.0 (static, read-only pages), Web 2.0 allows users to interact with and con...

  5. 55 marksjQuery SelectorsAnswer

    How jQuery id selector can be used to select specific element? Write an example with jQuery that will hide a paragraph on clicking a button. [5]

    The jQuery id selector uses the id attribute of an HTML tag to find and select a specific element. Since the id of an element is unique within a page, the id selector is used to select one unique element. Syntax: - The (hash) character i...

  6. 65 marksIntroduction to JSONAnswer

    Discuss about different JSON data types. [5]

    JSON (JavaScript Object Notation) supports the following six data types for values: --- A string is a sequence of characters written in double quotes. --- A number can be an integer or a floating-point value. It is written without quotes...

  7. 75 marksXML schema languagesAnswer

    What is DTD? Create a XML file and write its equivalent DTD. [5]

    DTD (Document Type Definition) is a set of rules or declarations that defines the structure, legal elements, and attributes of an XML document. It acts as a blueprint that specifies: - What elements are allowed in the XML document - The ...

  8. 85 marksFunctionsAnswer

    How can you define function in PHP? Create a function that will take two integers as argument and will return product of them. [5]

    A function is a block of statements that can be used repeatedly in a program. A function will not execute immediately when a page loads; it will be executed only when it is called. Besides built-in PHP functions, we can create our own us...

  9. 95 marksCSS Box ModelAnswer

    Describe CSS Box model with example. [5]

    The CSS Box Model is a fundamental concept in web design that describes how every HTML element is rendered as a rectangular box on a webpage. According to standard web technology principles, every element on a page is treated as a box co...

  10. 105 marksImage elementAnswer

    Create an HTML page with its body containing a div. The div should contain an image within it. Create a link on the image to redirect to the url http://www.tuiost.edu.np. Set the title of the page to “iost”. Add Meta tag on the page. [5]

    --- Part Tag / Attribute Purpose --------- Page Title <titleiost</title Sets the browser tab title to "iost" Meta Tags <meta ... Provides metadata about the page (charset, description, keywords, author, viewport) Div Container <div Block...

  11. 115 marksListsAnswer

    Create a HTML page containing ordered and unordered lists. Set the value of ordered list type to 'A'. The list should start at 'D'. [5]

    • Unordered list: Uses <ul tag; items marked with bullets by default using <li tag. - Ordered list: Uses <ol tag; items marked with numbers by default using <li tag. - The type attribute in <ol changes the marker style (e.g., type="A" fo...