Вы находитесь на странице: 1из 5

Dated:07-11-2018

University of Agriculture Faisalabad


Sub Campus Burewala
Department of Computer Science
(Winter-2018)
Class: MSc(CS) Semester: 3th (A,B)
Subject: E-Commerce and Web Programming Course Code: CS-633
Max. Marks: 12 Instructor: M.Shakeel
Allowed Time: 50 Min. Exam: Mid Term
1. Justify you answer carefully, Answers without justification do not give any credits.
2. Plan your time wisely. Do not spend too much time on any one problem. Read thoroughly all of them
first and attach them in the order that allows you to make the most progress.
_____________________________________________________________________________________________

(Q.1) (4)

(i) Metadata does not define _________


a) character set b) links c) scripts d) color
(ii) Which element defines preformatted text?
a) <p> b) <pre> c) <hr> d) <ins>
(iii) Which types of form elements can be excluded from the HTTP request?
a)text, radio, and check box b)text, submit, and hidden
c)submit and hidden d)radio and check box
(iv) Which is not a property of attribute Behavior of <Marquee> tag?
a.) alternate b.) blur c.) scroll d.) slide
(v) What is the preferred way for adding a background color in HTML?
a) <body background="yellow"> b) <background>yellow</background>
c) < body style="background-color:yellow"> d) <background
color="yellow">text<background>
(vi) Who is Known as the father of PHP?
a) Rasmus Lerdorf b) Tim Thompson c)Charles Darwin d)Tim Berners-Lee
(vii) HTML web pages can be read and rendered by _____________.
a)Compiler b)Server c)Web Browser d)Interpreter
(viii) How can you make a bulleted list?
a) <list> b) <nl> c) <ul> d) <ol>
(ix) What is an ISP?
a) Internet System Protocol b) Internal System Program c) Internet Service Provider
d) None of the above
(x) XML stands for ______________ extensible Markup Language ______________.
(xi) &nbsp is used for ____to create a space in a line _____________________________.
(xii) URL stands for ______Uniform Resource Locator ________________.

Best of Luck
Dated:07-11-2018

(Q.2) (4)

(i) How we can count the words in any string in PHP?

<?php echo str_word_count("Hello world!"); // outputs 2 ?>

(ii) How we can find the string position in any paragraph in PHP?

<?php echo strpos("Hello world!", "world"); // outputs 6 ?>

(iii)How we can set the date between 31, December,2015 and 31, December,2018 in HTML?

<input type="date" name="bday" max="2018-12-31” min=”2015-12-31” />

(iv) How we can select multiple pictures in input field file in HTML?

<input type="file" name="img" multiple>

(v)How we can set three letter country code(PAK) with regular Expression on input field in
HTML?

<input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three


letter country code">

(vi)How we set image with height(200px) and width(150px) align(right,top) in CSS?

Body{
background-image: url("img_tree.png"); background-repeat: no-repeat;
background-position: right top; background-attachment: fixed;
}

(vii)Difference between Padding and Margin?

The CSS margin properties are used to create space around elements, outside of any
defined borders.

There are properties for setting the margin for each side of an element (top, right,
bottom, and left).

The CSS padding properties are used to create space inside elements, inside of any
defined borders.

There are properties for setting the margin for each side of an element (top, right,
bottom, and left).

Best of Luck
Dated:07-11-2018

(viii)How to create an array of a group of items inside an HTML form ?

<input type="checkbox" name="delid[]" />

(ix)What is the difference between unset() and unlink() function?

Variable empty or veriable undefined


Delete File from folder

(x)What is session and why do we use it?

When data is required at another page we store it in session variable and we can
access it on another page by session_start, we do not use any database for this
purpose

(xi)What is Open Source Software?

Those software , anyone can use it without any certification, anyone can use by
downloading from website and work on it …

(xii)Why do we use multipart/form-data in html form?

We use it when we upload any file data to server , by Using $_FILES on server side
langugage

(Q.3) (4)

(i) A lecturer of University of Agriculture Faisalabad, wishes to accept an assignment online


which is sent by every student. The assignment should be in .pdf format either .doc
format. The file size should not be greater than the 0.3GB.If the file size greater than
that size there is an error message show on screen. Write down the code for upload
the file in HTML with client side validation in JavaScript and restrict that file size
should not be greater than that size in PHP code and save it into database.

JavaScript Code:
<script>
function fileValidation(){
var fileInput = document.getElementById('fileToUpload');
var filePath = fileInput.value;
var allowedExtensions = /(\.pdf)$/i;
Best of Luck
Dated:07-11-2018

if(!allowedExtensions.exec(filePath)){
alert('Please upload file having extensions .jpeg/.jpg/.png/.gif only.');
fileInput.value = '';
return false;
}
else
{
alert("ok");
}
}
</script>

HTML Code:
<form action="insert.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload"
onchange="return fileValidation()">
<input type="submit" value="Upload Picture" name="submit">
</form>

PHP Code:
<?php
$con=mysqli_connect("localhost","root","");
mysqli_select_db($con, "test");

$name = $_FILES["fileToUpload"]["name"];
$target_dir = "upload/";
$pic_Size = $_FILES["fileToUpload"]["Size"];

/////As we know that 0.5 GB = 500000000 B

If ($pic_Size <= 500000000 )


{
// Insert record
$query = "insert into student(image) values('".$name."')";
mysqli_query($con,$query);

if (file_exists($target_dir.$name)) {
unlink($target_dir.$name);

}
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$target_dir.$name);
}
?>

Best of Luck
Dated:07-11-2018

(ii) CSS can be added to HTML elements in 3 ways, Explain? 1

CSS can be added to HTML elements in 3 ways:


Inline - by using the style attribute in HTML elements
Internal - by using a <style> element in the <head> section
External - by using an external CSS file
The most common way to add CSS, is to keep the styles in separate CSS files.
However, here we will use inline and internal styling, because this is easier to
demonstrate, and easier for you to try it yourself.

Best of Luck

Вам также может понравиться