Exam text content

TIE-23500 Web-ohjelmointi - 02.03.2017 (Exam, Ihantola)

Exam text content

The text is generated with Optical Image Recognition from the original exam file and it can therefore contain erroneus or incomplete information. For example, mathematical symbols cannot be rendered correctly. The text is mainly used for generating search results.

Original exam
TIE-23500 / TIE-23506 Web Software Development : Exam

Date: 2.3.2017
Examiner: Petri Ihantola

e All answers should easily fit on a single answer sheet.
e Write on each paper your name and your student number
e Noadditional materials, calculators etc. allowed.
HTML & CSS

1:

HTTP

3)

4)

What is the key difference between div and span elements? (max 2 sentences)
(1 point)

What does the following CSS style definition make italic? (Max 1 sentence) (1 point)
Piti

font-style: italic;
)

When some web page is browsed for the first time, we get a HTTP response code
200 OK for most of the items the browser loads. The next time some items return a
response code 304 Not Modified. What is going on (1 point) and how does it work (1
point) ?

(max 2 sentences, 2 points)

Consider the URL https://www.example.com/foobar?g=banana&id=561 Explain
briefly what are the following parts of the URL (2 points)

a) https://
b) www.example.com
c) /foobar
d) ?g=banana&id=561
JavaScript & jauery

5) The following JavaScript code is executed. What (if anything) is printed
in the console? (2 points)

A
var foo = function () £
var i = 0; -
L
return function () £
console.log(i) O 3]
20i+t+;
po
305
fool);
foo();

6) Look at the code below. What happens when you click the link (2 points)

<!doctype html>
<html>
<head>
<title>Demo</title>
</head>
<body>
<a href="http://jauery.com/">jOuery</a>
<script src="jguery.js"></script>
<script>
$( document ).ready(function() £
$( "a" ).click(function( event ) £
alert( "Hello" );
D;
Ds
</script>
</body>
</html>
APIs

7) You see a client sending the following reguests to a REST API at example.com.
Explain what you assume each reguest to do. (one sentence per reguest, 3 points)
a. GET http://www.example.com/customers/12345
b. GET http:/www.example.com/customers/12345/orders
c. POST http:/www.example.com/customers/12345/orders

Sessions & Security

8) Mallory is writing a blog post on a blogging service where she wrote the following as
a title for the post. The beginnings of the texts she wrote are shown below. What is
she trying to do in the two cases? Explain briefly. (2 points, 1 for each)

a) GIasTAMIIe ..... rest of the text not shown ....
[MCat'); INSERT INTOIIN rest of the text not shown ....

Django

9) (total 4 points)
The following snippets are a Django view and the corresponding urls.py. The service
hosts private photo albums for a number of users.

Blogin reguired(login url="/login/')

def del page(reguest, album, page num):
page = Page.objects.get object or 404(album=album,number=page num)
page.delete()
return HttpResponseRedirect("/albums/")

urlpatterns = [
url (r'*delete/(?P<album>|w+) / (?P<page num>[0-9](2))$', views.del page),
+. sotherturlsi..

UK W N H

(3 points) Briefly explain 3 different scenarios that can what happen when a user
visits the URL: http://someserver.com/delete/vacation/42
Use the line numbers if necessary.

(1 point) There is an authorization problem in the code. What is it? (Max 2
sentences.)

 


We use cookies

This website uses cookies, including third-party cookies, only for necessary purposes such as saving settings on the user's device, keeping track of user sessions and for providing the services included on the website. This website also collects other data, such as the IP address of the user and the type of web browser used. This information is collected to ensure the operation and security of the website. The collected information can also be used by third parties to enable the ordinary operation of the website.

FI / EN