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.
- Q1.10 marksArrayHideAnswer
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]
- Q2.10 marksEvent Handling and Form ValidationHideAnswer
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]
- Q3.10 marksInserting CSSHideAnswer
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
.cssfile 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
Property Element Value Description 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 theiridattribute. Sinceidvalues are unique per page,#p1,#p2, and#dv1target exactly those specific elements. - Q4.5 marksWeb 2.0HideAnswer
What are the services provided under web2.0? [5]
- Q5.5 marksjQuery SelectorsHideAnswer
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]
- Q6.5 marksIntroduction to JSONHideAnswer
Discuss about different JSON data types. [5]
- Q7.5 marksXML schema languagesHideAnswer
What is DTD? Create a XML file and write its equivalent DTD. [5]
- Q8.5 marksFunctionsHideAnswer
How can you define function in PHP? Create a function that will take two integers as argument and will return product of them. [5]
- Q9.5 marksCSS Box ModelHideAnswer
Describe CSS Box model with example. [5]
- Q10.5 marksImage elementHideAnswer
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]
- Q11.5 marksListsHideAnswer
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]