Professional Documents
Culture Documents
FFFFFFF FFFFFFF FFFFFFF
FFFFFFF FFFFFFF FFFFFFF
Dashboard / Courses / SoEN / Web Programming and Technologies( Tripoli - Section A - 193100) Fall 2021 - 2022 / CENG420 Final
Question 1
Not yet answered
Question 2
Not yet answered
echo $var;
Select one:
a. Parse Error
b. 420
c. Welcome to CENG
d. Welcome to CENG420
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 1/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 3
Which syntax would you use to assign the class myclass to the paragraph having the id par1?
Select one:
a. document.getElementById("par1").class("myclass")
b. document.getElementById("par1").class.add("myclass")
c. document.getElementById("par1").classList.add("myclass")
d. document.getElementById("par1").classList("myclass")
Question 4
Not yet answered
Set the max numbers of characters allowed in the input field to 40.
<form action="go.php">
< /form>
Question 5
Select one:
a. px
c. em
d. percentage
Question 6
Not yet answered
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 2/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 7
Consider the following form, what happens when click on the button?
</form>
Select one:
a. the page itself refreshes
c. An alert appears
d. nothing happens
Question 8
Not yet answered
</form>
Select one:
a.
b.
c.
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 3/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 9
If you want the webpage to remember your credentials as long as you do not close the browser, you use:
Select one:
a. cookies work or sessions work
b. sessions only
c. cookies only
Question 10
Select one:
a. True
b. False
Question 11
print_r($web);
Select one:
a. HTML , CSS, JavaScript, PHP
b. Array ( [0] => HTML [1] => CSS [2] => JavaScript [3] => PHP )
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 4/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 12
When using the shorthand property, the order of the values are
Select one:
a. font-family font-variant font-weight font-size font-style
Question 13
Not yet answered
Fill in the blanks such that the below Javascript code creates <option> and appends it to the select list having id "mySelect".
<script>
option.value=0;
option.text="A";
mySelect. (option);
</script>
Question 14
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 5/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 15
Complete the code such that it validates the inputs on form submit as follows:
1. The name can not be empty and must contain only lowercase alphabets
If the above restrictions are satisfied, the user will be redirected to the next page, otherwise, the function returns false and an error alert
<body>
< >
validate_inputs(){
"). ;
if ( ==""){
</script>
;" >
</form>
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 6/15
1/25/22, 8:12 AM CENG420 Final Exam
</body>
Question 16
Not yet answered
Select tag that does not include the "multiple" is similar to:
Select one:
a. Checkboxes
b. textarea
c.
Radio
Question 17
in HTML body, the <span> tag can be nested inside the <em> tag.
Select one:
True
False
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 7/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 18
We wish to build a website for Buy and Sell for Free of goods, in which users are able to login, buy or sell an item (we are interested here on
the Sell part).
Assume that in the database (‘goods_db’), we have 3 tables:
Assume that the connection file is called connection.php. Assume also that all the tables are already created and the table users is filled with
data. The webserver and the database server are on the same physical machine.
Part 1. Compete the code for connection.php.
<?php
$con =
('
if(
){
?>
Part 2: The index.php page contains a form for the user to login as below:
Complete the code below such that if the login is successful, a session is created and filled with name and user_id, and the user is
navigated to a page called home.php. if not successful, he/she is directed back to index.php.
<?php
require_once "
";
if (isset(
) && isset(
)) {
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 8/15
1/25/22, 8:12 AM CENG420 Final Exam
$user = $_POST['user'];
$password =
;
$query = "
";
$result = mysqli_query($con, $query);
$nbr_row =
if ($nbr_row == 1) {
$row =
;
$user_id =
;
$_SESSION['user_id'] = $user_id;
$_SESSION['username'] = $user;
$_SESSION['isLogin'] = True;
header("
");
} else {
header("
");
}
}
?>
<html>
<body>
<h3 >SignIn Form</h3>
>
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 9/15
1/25/22, 8:12 AM CENG420 Final Exam
</form>
</body>
</html>
Part 3.The home.php page contains a greeting to the user “Welcome username to Buy and Sell Goods for Free ” and 2 parts as shown below:
The second part contains 2 links one for buy.php and the other for sell.php.
The last part is a link to "logout.php".
Complete the home.php code below (Note that it is necessary to make sure that a session is established or not. if not navigate the user back
to index.php)
<?php
require_once 'connection.php';
if (isset(
)){
$user_id =
;
$user = $_SESSION['username'];
echo '<hr/>';
echo '<p> To BUY <a href= "buy.php">click here </a></p>';
</p>';
echo '<hr/>';
header('Location: index.php');
}
?>
Complete the code of logout.php page; once the user logout it is redirected back to index.php.
<?php
;
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 10/15
1/25/22, 8:12 AM CENG420 Final Exam
unset($_SESSION['name']);
unset(
);
unset($_SESSION['user_id']);
header('Location: index.php');
?>
Part 4: The sell.php contains a form that takes an item, its price and a category (the category list is filled from the table category) and a
button ADD. when the user click on the button, the item is inserted into the table goods and the user is redirected back to home.php.
<?php
session_start();
require_once 'connection.php';
if (isset($_SESSION['isLogin'])) {
$select_query = "
";
$r =
" method="POST">';
$row =
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 11/15
1/25/22, 8:12 AM CENG420 Final Exam
$category_id = $row['category_id'];
$category_name =
echo '</select>';
echo '</form>';
else {
header('Location: index.php');
if (isset(
)&&isset($_POST['item']))
$category_id =
$item = $_POST['item'];
$price = $_POST['price'];
$insert_query = "
";
$result =
('location:home.php');
?>
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 12/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 19
The JavaScript prompt() method is used to ask the user to enter something.
Select one:
True
False
Question 20
Not yet answered
document.write(result);
</script>
Select one:
a. WY,Y,Y
b. W,WY,Y
c. W,WYZ,YZ,Y
Question 21
Not yet answered
Fill in the blank the appropriate JS method to obtain the output Writing
<script type="text/javascript">
document.write(hobbies. );
</script>
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 13/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 22
Select one:
a. emphasis
b. weight
c. variant
d. style
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 14/15
1/25/22, 8:12 AM CENG420 Final Exam
Question 23
Fill in the blanks such that the JavaScript code does the following:
2-Calculate cos(a)/b3
<body>
<p ="myparagraph"></p>
< >
EvaluteValue(a, b){
if ( (a))
else
if ( (b))
else
</script>
</body>
Jump to...
https://ems.liu.edu.lb/mod/quiz/attempt.php?attempt=35084&cmid=3988 15/15