G I F T U N I V E R S I T Y

Similar documents
Question 1. (5 points) CSS

Problem Description Earned Max 1 PHP 25 2 JavaScript / DOM 25 3 Regular Expressions 25 TOTAL Total Points 100. Good luck! You can do it!

CSc 337 LECTURE 15: REVIEW

Problem Description Earned Max 1 HTML / CSS Tracing 20 2 CSS 20 3 PHP 20 4 JS / Ajax / JSON 20 5 SQL 20 X Extra Credit 1 TOTAL Total Points 100

a) <div id="coffee"> <p>*('o')*</p> <ul> <li>aaa</li> <li id="c">bbb</li> <li>ccc</li> </ul> </div>

Problem Description Earned Max 1 HTML/CSS Interpretation 30 2 HTML/CSS Programming 30 3 JavaScript Programming 40 X Extra Credit +1 TOTAL 100

Problem Description Earned Max 1 HTML/CSS Tracing 15 2 HTML/CSS Coding 15 3 JavaScript/DOM 15 TOTAL Day's Total Points 45

Problem Description Earned Max 1 HTML / CSS Tracing 20 2 CSS 20 3 PHP 20 4 JS / Ajax / JSON 20 5 SQL 20 X Extra Credit 1 TOTAL Total Points 100

Problem Description Earned Max 1 HTML/CSS Tracing 15 2 HTML/CSS Coding 15 3 JavaScript/DOM 20 TOTAL Day's Total Points 50

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

In the early days of the Web, designers just had the original 91 HTML tags to work with.

a) <div id="coffee"> <p>*('o')*</p> <ul> <li>aaa</li> <li id="c">bbb</li> <li>ccc</li> </ul> </div>

HTML and CSS: An Introduction

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

Introduction to using HTML to design webpages

Note: The screenshots in this document were taken on Windows in Firefox, which may differ from your system.

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Lab 2: Movie Review. overview.png background.png rottenbig.png rbg.png fresh.gif rotten.gif critic.gif

CSC 121 Computers and Scientific Thinking

Problem Description Earned Max 1 HTML/CSS 20 2 Javascript/DOM 20 3 Ajax/XML 20 5 PHP 20 4 SQL 20 X Extra Credit +1 TOTAL 100

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Taking Fireworks Template and Applying it to Dreamweaver

Web Design and Development Tutorial 03

Reading 2.2 Cascading Style Sheets

University of Washington, CSE 154 Section 10: Practice Final Exam Problems

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

Proper_Name Final Exam December 21, 2005 CS-081/Vickery Page 1 of 4

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

CSE 154: Web Programming Autumn 2018

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

CSS Design and Layout Basic Exercise instructions. Today's exercises. Part 1: Arrange Page into Sections. Part 1, details (screenshot below)

HTMLnotesS15.notebook. January 25, 2015

Adding CSS to your HTML

Guidelines for doing the short exercises

CSS: The Basics CISC 282 September 20, 2014

CSE 154: Web Programming Autumn 2018

Introduction to WEB PROGRAMMING

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Sample midterm extra questions

Problem Description Earned Max 1 CSS 20 2 PHP 20 3 SQL 10 TOTAL Total Points 50

What is the Box Model?

Lab Introduction to Cascading Style Sheets

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

Styles, Style Sheets, the Box Model and Liquid Layout

Block & Inline Elements

A Balanced Introduction to Computer Science, 3/E

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

Programmazione Web a.a. 2017/2018 HTML5

Student, Perfect Final Exam May 25, 2006 ID: Exam No CS-081/Vickery Page 1 of 6

CSS Selectors. element selectors. .class selectors. #id selectors

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

LING 408/508: Computational Techniques for Linguists. Lecture 14

ICT IGCSE Practical Revision Presentation Web Authoring

HTML and CSS COURSE SYLLABUS

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

Azon Master Class. By Ryan Stevenson Guidebook #8 Site Construction 1/3

Appendix D CSS Properties and Values

CSS Styles Quick Reference Guide

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Problem Description Earned Max 1 CSS 2 PHP 3 PHP/JSON 4 Ajax 5 Regular Expressions 6 SQL TOTAL Total Points 100

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

University of Washington, CSE 154 Homework Assignment 7: To-Do List

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

Zen Garden. CSS Zen Garden

HTML and CSS a further introduction

Part 3: Images & form styling NOMZAMO S WEBSITE

The internet is a worldwide collection of networks that link millions of computers. These links allow the computers to share and send data.

Problem Description Earned Max 1 PHP 20 2 JS 20 3 JS / Ajax / JSON 20 4 SQL 20 X Extra Credit 1 TOTAL Total Points 100

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

Introduction to CSS. Part 1: Simple Text Formatting. Source Files for this Exercise are available on the Course Website DW_CSS intro

CIS 228 (Spring, 2012) Final, 5/17/12

CSS. Shan-Hung Wu CS, NTHU

CMPT 165: More CSS Basics

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Controlling Appearance the Old Way

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

CSS.

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CSC309 Programming on the Web week 3: css, rwd

Media-Specific Styles

Getting Started with Eric Meyer's CSS Sculptor 1.0

CSS Module in 2 Parts

To illustrate how to set TAG styles the <body> and <h1> tags (for the BODY and the HEADING 1 styles) will be adjusted.

2005 WebGUI Users Conference

First Name Last Name CS-081 March 23, 2010 Midterm Exam

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

THE HITCHHIKERS GUIDE TO HTML

5. When the Plugin Installed Successfully message appears, click Activate Plugin. You re all set, so let s get started with your first recipe post.

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

=================== coffee-submit.php ==========================

Ministry of Higher Education and Scientific Research

CSS Cascading Style Sheets

Transcription:

G I F T U N I V E R S I T Y G U J R A N W A L A (Chartered by the Govt. of the Punjab, Recognized by HEC) Department of Computer Science BS Computer Science Web Development/Web Programming Mid Term Examination Spring 2015 Instructor: Numan Sheikh Time: 70 Minutes Candidate Name: Candidate Roll No: Instructions to Candidates: Candidates are required to sit on the seats assigned to them by the invigilators. Do not open this question paper until you have been told to do so by the Invigilator. Please fill in exam specific details in space provided. This is a Closed Book Exam. Closed book examinations. All the questions are compulsory. Please use the last pages on the back side of this exam for rough work. Write all the final answers in the space provided below the questions. Anything written on the backside will be ignored and anything (which may include wrong conclusions on the front side will be graded) There are 60 Marks and 70 minutes, so schedule yourself accordingly. Any violation of the rules will result in an F in the course. Question 1 2 3 Total Maximum 15 15 30 60 Obtained

1. HTML / CSS Tracing Draw a picture of how the following HTML/CSS code will look when the browser renders it on-screen. Assume that the HTML is wrapped in a valid full page with a head and body. Indicate a non-white background by shading lightly or by drawing diagonal lines like. a) <div id="foo"> <div id="bar">kkk <div class="baz">mmm <div class="baz">ooo div div { margin: 40px; background-color: yellow; div { padding: 20px; #foo { border: black 2px dashed; b) <div id="foo "> <div id="bar">kkk <div class="baz">mmm <div class="baz">ooo <div class="bar">hhh <div>ddd <div id="cat">^..^.baz { float: right;.bar { float: left; div { border: black solid 2px; #foo > div { background-color: red; #cat { clear: both;

2. HTML / CSS Coding Write the HTML and CSS code necessary to recreate the following appearance onscreen, between but not including the thick black lines. (No manual line breaks have been inserted into the text.) Assume that the code you're writing will be placed inside the body of the page. Part of your grade comes from choosing appropriate tags to match the semantics of the content. You should also write valid code that would pass the W3C validators, and separate stylistic information from HTML. Some details about the desired appearance: All text uses default sizes and fonts, except for the characters' names which are written in a sansserif font. The section of dialogue is 50px from the right edge of the page and occupies 16em in width. No manual line breaks have been inserted into the text. The text for each character's name is bold and underlined. The images come from the files inigo.jpg and rugen.jpg and are drawn at their default sizes. Rugen's lines are colored with a background of #DDDDDD or (red=221, green=221, blue=221). 5px separate these images from any surrounding content. 5px of vertical space separate each of the bulleted lines. Mark up the text on the next page with your HTML tags. If a tag can't physically be written in the space provided, write it in the margins and draw an arrow to where it should be inserted in the text. Write the CSS styles on the page after next.

HTML / CSS Coding (writing space) <ul><li><img src="images/inigo.jpg" alt="inigo" /> <strong>inigo:</strong> Hello. My name is Inigo Montoya. You killed my father. Prepare to die.</li> <li class="rugen"><img src="images/rugen.jpg" alt="rugen" /> <strong>count Rugen:</strong> No!</li> <li><strong>inigo:</strong> Offer me money! Power, too. Promise me that!</li> <li class="rugen"><strong>count Rugen:</strong> All that I have and more! Please!</li> <li><strong>inigo:</strong> Offer me everything I ask for!</li> <li class="rugen"><strong>count Rugen:</strong> Anything you want.</li> <li><strong>inigo:</strong> I want my father back, you son of a...</li></ul> ul { float: right; margin-right: 50px; width: 16em; img { float: left; margin-bottom: 5pt; margin-right: 5pt; li { clear: both; margin-bottom: 5pt; li.rugen { background-color: #DDDDDD; strong { font-family: sans-serif; text-decoration: underline;

3. PHP Write the PHP code for two partial web pages for ordering food from an online store. The first page you will write is a form named order.php that allows the user to choose what kind of food to buy and how many to buy. In your form, include a drop-down menu of food items available. Include a text box for the user to enter a quantity of the item to purchase (2-characters-wide), and an "Order" button to submit the form. The form should look like this: The food items to list should be based on what JPG food images are available in the current directory. For example, if the current directory contains apple.jpg and steak.jpg, then "apple" and "steak" appear in the drop-down list. Write the portion of order.php that would appear between <body> and </body>. You don't need to write any CSS. The second page you will write is named order-submit.php. The form in order.php submits its data as a POST request to order-submit.php. The output of order-submit.php is an HTML page fragment, a single paragraph indicating information about the order as described below. (Do not use print or echo.) The store's current inventory is stored in a file named inventory.txt on the server in the current directory. Each line of the file represents one item available in the store, its quantity available, and its price per unit, separated by tabs. Assume that the file exists, that its contents are valid, and that there are no duplicates. Here is an example inventory: apple 4 1.00 chicken 1 3.25 cookie 38 0.25 milk 9 4.50 tomato 27 0.50 In general your task is to look up the price per unit of the item the user is ordering, and use this price to compute the total order cost. For example, if the item costs $0.50 and the user orders 7 of them, the total order is 7 * 0.50 = $3.50. The page's output in the general successful case is to inform the user that the order was successful, display the total order cost (you do not need to round it), and show the user a series of images representing what was ordered. For example, if the user orders 4 apples, your output should display 4 copies of apple.jpg. Here is another output from ordering 15 of the item 'cookie'. (the output wraps to the next line in the browser) The store is only able to complete an order if that food item is in the inventory and the store has enough of that item in stock. For example, if the inventory matches the above text file (which has 9 'milk' in stock),

and the user tries to order 10 of 'milk', the following error should be displayed: The items in this inventory may overlap with the images that were listed previously, but there might be some images that don't have representation in the inventory text file and vice versa. If an item is not present in the inventory file, assume that its quantity available in stock is 0 and display the same sort of error message. You do not need to modify the inventory.txt file or update its quantity of the item being ordered. If the food item or quantity parameters are not passed, issue an HTTP 400 error. If they are present, you may assume that the food item value passed is a string and the quantity value passed is a positive integer. <!-- order.php --> <form action="order-submit.php" method="post"> <div> Food item: <select name="food"> <?php foreach (glob("*.jpg") as $image) {?> <option> <?= str_replace(".jpg", "", $image)?> </option> <?php?> </select> <div> Quantity: <input type="text" name="quantity" size="2" /> <div> <input type="submit" value="order" /> </form> <?php # order-submit.php if (!isset($_post["food"])!isset($_post["quantity"])) { header("http/1.1 400 Invalid Request"); die(); $food = $_POST["food"]; $quantity = $_POST["quantity"]; $found = FALSE; foreach (file("inventory.txt") as $line) { list($item, $number, $price) = explode("\t", $line); optional if ($item == $food && $number >= $quantity) { $total = $quantity * $price;?> # list() is <p> Order successful! $<?= $total?> is your total price. Here is what you ordered:

<?php for ($i = 0; $i < $quantity; $i++) {?> <img src="<?= $food?>.jpg" alt="food" /> <?php?> </p> <?php $found = TRUE; break; # optional if (!$found) {?> <p>sorry, we don't have <?= $quantity?> of '<?= $food?>' in stock.</p> <?php?>