0% found this document useful (0 votes)
55 views

CS283-FinalExam Spring23

This document provides instructions for a final exam for a Web Programming course taken at October University in the Spring 2023 semester. The exam consists of 4 multiple choice questions worth a total of 100 marks. It allows 180 minutes for completion and specifies that only an answer sheet is permitted. The questions cover topics related to web standards, protocols, and programming including HTML, CSS, JavaScript, PHP and databases.

Uploaded by

lina.elmihi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

CS283-FinalExam Spring23

This document provides instructions for a final exam for a Web Programming course taken at October University in the Spring 2023 semester. The exam consists of 4 multiple choice questions worth a total of 100 marks. It allows 180 minutes for completion and specifies that only an answer sheet is permitted. The questions cover topics related to web standards, protocols, and programming including HTML, CSS, JavaScript, PHP and databases.

Uploaded by

lina.elmihi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

October University for Modern Sciences & Arts

CS283

Web Programming

Final Exam
Faculty Computer Science
Semester Spring 2023
Time Allowed
Total Mark 100
Mark Distribution Question 1 ……… 24 Marks
Question 2 ……… 20 Marks
Question 3 …… 30 Marks
Question 4 …… 26 Marks
No. of Pages (including 10 Pages
cover page)
Material provided
Equipment permitted None
Additional Instructions Answer sheet is needed
No books, paper or electronic devices are permitted to be brought into the examination
room other than those specified above.
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

Answer ALL the following questions.

QUESTION#1 : [24 Marks- 2 Marks each]

Choose the correct Answer(s):

1) ____________ determines the internet protocol standards.

a. Internet Corporation for Assigned Names and Numbers (ICANN)


b. World Wide Web Consortium (W3C)
c. Internet Engineering Task Force (IETF)
d. World Wide Web Institute (W3I)

2) ___________________ a method that the client uses to send a request to the


server where request is sent within the URL and has a limited size.

a. GET.
b. LOAD
c. PUT
d. POST

3) The below HTML code is an example of _______________

<img src ="myImage.jpg">

a. An Absolute URL.
b. A Relative URL.

4) The website source codes are located in ___________________

a. Server.
b. Client.
c. Database server.
d. None of these answers is correct.

Page 1 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

5) Considering the below line of javascript code, the value of x is__________

let x = 70+100 + "9"+ 5;

a. 184
b. 17014
c. 17095
d. This code has a syntax error.

6) HTTP request and HTTP response are the main components of__________
_______

a. HTTP protocol
b. Web development standards
c. Cyber Security protocols
d. None of the above

7) _________________ is the entire process of developing a web application


from start to finish (backend and frontend).

a. Hybrid web development.


b. Complex web development.
c. Full-stack development.
d. Complete web development.

8) A JQuery selector can be ____________


a. class
b. id
c. JQuery does not use selectors.
d. Both a and b are correct.

9) getElementbyID (“elementID”); is considered a DOM method.

a. True.
b. False.

Page 2 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

10) Given the below Javascript code, the value printed in the “demo” element
is__________________

a. This code will produce a syntax error.


b. CS ! and Engineering !
c. CS Students and Engineering Students !
d. !

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
let text1 = "CS Students and Engineering Students";
let text2 = "!";
let text3 = text1.concat(" ",text2);
document.getElementById("demo").innerHTML = text3;
</script>

</body></html>

11) Cookies expire as soon as the user closes his browser or end his session.

a. True
b. False

12) _________________ run on client side.

a. HTML
b. Javascript
c. PHP
d. Cascading Style sheets.

Page 3 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

QUESTION#2 [20 Marks]

1. Write an HTML code that exactly displays the form illustrated above. [4 Marks]

2. Write a CSS class that defines an error styling class that display the element text

in red color. Use this class in your HTML code to display the errors. (e.g. “You

Must Enter a valid Name”) and this error must be displayed in red next to the

Name element. [4 Marks]

3. Write a PHP code that receives the above form values and check if they are valid.

Assume that the form uses a POST method. Noting that, a “Name” is valid if it is

not empty; And An email is only valid if it matches the regular email format AND

not empty. [4 Marks]

4. Write a PHP code that inserts the values inserted within this form into the

Database (the database table is called users). You can make any assumptions of

the variables needed. [4 Marks]

5. Write a PHP code that creates session variables and save the data inserted within

the form. [4 Marks]

Page 4 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

QUESTION#3 [30 Marks – 3 Marks each]

Write a short code for the below requirements:

1. Use a DOM function that changes the source attribute of an image element.

2. Create an HTML element that refers to a URL (www.msa.edu.eg).

3. Write a CSS code that applies blue font color to all paragraph elements.

4. Write a PHP code that deletes a cookie called “userName”.

5. Write a PHP code that retrieves the value of “favorite_color” from a session

variable.

6. Use HTML to create an unordered list of this item (shirt, pants, shoes, cap).

7. Given this array [Professors, Assistants, Students, Subjects, Grades] , write a

Javascript function for sorting this array and printing it as a numbered list.

8. Write a sample CSS code that uses the element ID as a selector.

9. Write a JavaScript code that display a message says, “ Thank you for reaching

out!” in a message window.

10. Write an example of exception handling using PHP.

Page 5 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

QUESTION#4 [26 Marks]

Answer the following questions.

1. Given the below PHP code. [2 Marks]


a. What does line#4 of the below code do?
b. What would happen if include in line#4 was replaced by require ?

1. <html>
2. <body>

3. <h1>Welcome to MSA!</h1>
4. <? php include ‘mainMenu.php' ;?>

5. </body>
6. </html>

2. What is the displayed output of the below HTML code? [2 Marks]

<html>
<body>
<table>
<caption>My important data</caption>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Ahmed</td><td>20</td></tr>
<tr><td>Mohamed</td><td>15</td></tr>
</table>
</body>
<html>

3. Given the below PHP code [3 Marks]

a- What does the “die” function do?


b- What is the alternative of using the die() function? Please elaborate using
code.
c- What does the “a” parameter mean in the fopen function?

<?php
$myfile = fopen(“myData.txt", "a") or die(“file is not accessible");
?>

Page 6 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

4. Given the below CSS and HTML codes, [3 Marks]


a. what does Div ~ p in the second line of the CSS file mean?
b. What is the type of this CSS selector?
c. Given the below HTML code, which paragraph (s) shall be affected by
the given CSS?

/* this is a part of the CSS file*/


Div ~ p {
background-color: pink;
}

<body>
<div>
<p>Paragraph 1 </p>
<p>Paragraph 2 </p>
<section><p>Paragraph 3</p></section>
</div>
<p>Paragraph 4. </p>
<p>Paragraph 5. </p>
</body>

5. Given the Javascript code below: [3 Marks]

let str = "Banana,Apple,Mango";


let part = str.substr(7,11);

a- What is the value of the variable part?


b- What would be the output if line#2 became: let part = str.slice(7, 11);
c- What would be the output if line#2 became: let part = str.slice(-5);

Page 7 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

6. Given the below Javascript code: [2 Marks]


a. what is the value printed in the “demo” element ?
b. what would be the value printed in the “demo” element if “var” was used
instead of “let”?

<body>

<p id="demo"></p>

<script>
let x = 10; End of Exam Questions
{
let x = 100;
}
document.getElementById("demo").innerHTML = x;
</script>
</body>

7. Given the below JQuery code: [3 Marks]

a. What does the “hide” function do?


b. What does the 4000 parameter mean?
c. What would be the effect if the “hide" function was replaced by a “toggle”
function?

<script>
$(document).ready(function(){
$("button").click(function(){
$("p").hide(4000);
});
});
</script>

Page 8 of 9
October University for Modern Sciences & Arts Module Code: CS283
Faculty of Web Programming
Final -Spring 2023 Time Allowed: 180 Minutes

8. Briefly explain what the below code does. [2 Marks]

<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>

9. Given the below CSS code. [3 Marks]


a. What is the name and type of this selector?
b. What does this selector do?
c. What would happen if the * was replaced by P?

*{
text-align: center;
color: blue;
}

10. Given the below JavaScript code. [3 Marks]


a. What is the output displayed in the demo element?
b. write the output displayed in the demo if the second line in the script became:
points.sort(function(a, b){return b - a});
c. write the output displayed in the demo if the second line in the script became:
points.sort();

<p id="demo"></p>

<script>
const points = [500,1000,20,15,9];
points.sort(function(a, b){return a - b});
document.getElementById("demo").innerHTML = points.sort(function(a,
b){return a - b});
</script>

End of Exam Questions


Best of luck!
Dr. Nehal Ali

Page 9 of 9

You might also like