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

Web Programming Assignment Guide

The document outlines a comprehensive programming assignment for the Web Programming course at the University of Global Village, detailing various tasks related to HTML, CSS, JavaScript, PHP, Ruby, and Python. It specifies the submission requirements, including both printed and digital formats, and provides a list of topics and coding tasks to be completed by students. The assignment is due on November 13, 2025.
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)
7 views3 pages

Web Programming Assignment Guide

The document outlines a comprehensive programming assignment for the Web Programming course at the University of Global Village, detailing various tasks related to HTML, CSS, JavaScript, PHP, Ruby, and Python. It specifies the submission requirements, including both printed and digital formats, and provides a list of topics and coding tasks to be completed by students. The assignment is due on November 13, 2025.
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

University of Global Village (UGV), Barishal

Department of CSE
Course Title: Web Programming
Semester: 4th
Assignment: Comprehensive Programming Assignment on Web and Scripting Languages
Submission Deadline: 09 November 2025

1. Explain the structure of an HTML document. Write a complete HTML code that includes a heading, paragraph,
image, and hyperlink.
2. Differentiate between block-level and inline elements in HTML. Provide at least three examples of each and
explain how they affect webpage layout.
3. Write an HTML and CSS code to create a simple student registration form containing fields for Name, Email,
and Password with styled labels and input boxes.
4. Explain the concept of CSS selectors and their types. Provide examples of class selectors, ID selectors, and
descendant selectors.
5. What are the different types of CSS positioning? Explain static, relative, absolute, and fixed positioning with
short examples showing how each works.
6. Explain the concept of event handling in JavaScript. Give an example using onclick or addEventListener() to
handle a button click event.
7. Differentiate between var, let, and const. Give examples where the difference matters.
8. Write a JavaScript function that takes an array of numbers and returns the sum of even numbers only.
9. What is DOM manipulation? Write JavaScript code to change the text of a <p> element with id "demo" to
"Hello JavaScript".
[Link] the concept of asynchronous programming in JavaScript. Compare callbacks, promises, and
async/await with examples.
[Link] the difference between GET and POST methods in PHP. Provide an example of form submission
using both.
[Link] a PHP script to connect to a MySQL database and display all records from a table named students.
[Link] the concept of sessions and cookies in PHP. Write a short code example showing how to set and
retrieve a session variable.
[Link] the use of arrays in PHP. Write a script that stores names of students in an array and displays them
using a foreach loop.
[Link] are include and require statements in PHP? Explain their differences with an example use case.
[Link] the concept of blocks and iterators in Ruby. Provide an example using .each or .map.
[Link] a Ruby program that checks whether a given number is prime or not.
[Link] object-oriented features in Ruby. Write a simple class named Student with attributes and a method to
display details.
[Link] between puts, print, and p in Ruby with examples.
[Link] exception handling in Ruby. Write a program that handles division by zero error using begin-rescue.
[Link] the difference between mutable and immutable data types in Python with examples.
[Link] a Python program that reads a text file and counts the number of words.
[Link] is a decorator in Python? Write an example that shows how a decorator can modify a function’s behavior.
[Link] inheritance in Python OOP. Write a base class and a derived class to demonstrate single inheritance.
[Link] list comprehension in Python. Write code to generate a list of squares for numbers from 1 to 10.
Submission Type:

 Printed Hard Copy of your answers.


 Soft Copy (PDF) to be uploaded/submitted via the university portal or sent by email

Assignment Cover Page Must Include:

 Course Name: Web Programming & Scripting Languages


 Assignment Title: Comprehensive Programming Assignment on Web and Scripting Languages
 Student Name & ID
 Department
 Semester & Year
 Instructor Name
 Submission Date

Submission Deadline: 13 November 2025

Common questions

Powered by AI

Asynchronous programming in JavaScript allows non-blocking execution, enabling programs to run multiple tasks simultaneously, improving performance. Callbacks involve passing a function as an argument to another function to execute later, which can lead to callback hell due to nested structures. Promises offer better readability by allowing chaining with .then() and .catch(). An example is: ```javascript fetch('api/data').then(response => response.json()).then(data => console.log(data)); ``` Async/await, built on promises, allows writing asynchronous code as if it were synchronous, improving clarity. Example: ```javascript async function fetchData() { const response = await fetch('api/data'); const data = await response.json(); console.log(data); } ``` Async/await provides cleaner and more manageable code compared to callbacks and promises .

Event handling in JavaScript is the process of responding to events triggered by actions like mouse clicks, keyboard inputs, or window resizing. The addEventListener method attaches an event handler to a specific element without overwriting existing events. An example of handling a click event is: ```javascript const button = document.getElementById('myButton'); button.addEventListener('click', function() { alert('Button clicked!'); }); ``` Here, clicking the button with id='myButton' shows an alert box .

In JavaScript, var, let, and const are used to declare variables but have different scopes and properties. 'var' is function-scoped and can lead to issues like hoisting, where a variable can be referenced before its declaration. 'let' is block-scoped, meaning its visibility is limited to the block it is defined in, thus preventing hoisting problems. 'const' is also block-scoped but is used for variables whose values should not change after initialization. The differences are significant in situations involving loops or conditional blocks, where 'let' and 'const' prevent accidental global declarations that can happen with 'var'. Additionally, using 'const' ensures constancy in variables that should not change .

Sessions and cookies in PHP are mechanisms to manage user data across requests. Sessions store data on the server side, preserving state across pages via a unique session id. Example: ```php session_start(); $_SESSION['username'] = 'JohnDoe'; echo $_SESSION['username']; ``` Cookies store data on the client-side, sent with each request. Example: ```php setcookie('username', 'JohnDoe', time() + 3600); echo $_COOKIE['username']; ``` Sessions provide more security as data isn't exposed to client access, unlike cookies, which can be manipulated by users .

Inheritance in Python's OOP allows a class (derived) to inherit properties and methods from another class (base), facilitating code reuse and logical hierarchy. Example: ```python class Animal: def __init__(self, species): self.species = species def make_sound(self): return 'Sound' class Dog(Animal): def make_sound(self): return 'Bark' my_dog = Dog('Canine') print(my_dog.species) # Output: Canine print(my_dog.make_sound()) # Output: Bark ``` Here, 'Dog' inherits from 'Animal', overriding the make_sound method, illustrating single inheritance .

Block-level elements in HTML are those that occupy the entire width of their parent container and start on a new line. Examples include <div>, <h1> through <h6>, <p>, and <form>. These elements are typically used to structure the main parts of a webpage, like sections and articles. In contrast, inline elements do not start on a new line and only occupy as much width as necessary. Examples include <span>, <a>, and <img>. Inline elements generally contain other content within block-level elements, such as links or formatting text within a paragraph .

There are four main types of CSS positioning: static, relative, absolute, and fixed. Static positioning is the default positioning; elements follow the normal flow of the document. Relative positioning positions elements relative to their original position without affecting other elements. For example, position: relative; top: 10px; moves an element 10 pixels down. Absolute positioning removes the element from the document flow and positions it relative to its closest positioned ancestor, or the initial containing block if there's no ancestor. For instance, position: absolute; top: 20px; positions an element 20 pixels from the top of its ancestor. Fixed positioning positions an element relative to the viewport, unaffected by scrolling. An example is position: fixed; bottom: 10px; which keeps the element 10 pixels from the bottom of the viewport .

CSS selectors are patterns used to select the elements to style in a web page. Class selectors are defined with a preceding dot (.) and can be used on multiple elements. For example, .myClass applies styles to all elements with class="myClass". ID selectors use a preceding hash (#) and apply to a unique element with that specific ID; for example, #myId applies styles to the element with id="myId". Descendant selectors apply styles to elements nested within a specified hierarchy, such as div p, which would apply styles to <p> elements that are descendants of <div> elements .

GET and POST are methods used in PHP to submit form data. GET appends form data to the URL, making it visible and suitable for non-sensitive information. It's accessed via $_GET superglobal and limits data length. POST submits data within the request body, suitable for sensitive or large data, and uses $_POST superglobal. Example of GET: ```html <form method="GET" action="process.php"> <input type="text" name="name" /> <input type="submit" value="Submit" /> </form> ``` Example of POST: ```html <form method="POST" action="process.php"> <input type="text" name="name" /> <input type="submit" value="Submit" /> </form> ``` POST provides enhanced security over GET by not displaying data in the URL .

Decorators in Python are a design pattern that allows the modification of functions or methods. They enable code reuse by wrapping a function to extend or modify its behavior without altering its structure. A decorator is applied with the '@decorator_function' syntax. Example: ```python def my_decorator(func): def wrapper(): print('Before function execution') func() print('After function execution') return wrapper @my_decorator def say_hello(): print('Hello!') say_hello() ``` Here, 'my_decorator' modifies 'say_hello' by adding prints around its execution .

You might also like