Tentin tekstisisältö

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

Tentin tekstisisältö

Teksti on luotu tekstintunnistuksella alkuperäisestä tenttitiedostosta, joten se voi sisältää virheellistä tai puutteellista tietoa. Esimerkiksi matemaattisia merkkejä ei voida esitää oikein. Tekstiä käytetään pääasiassa hakutulosten luomiseen.

Alkuperäinen tentti
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.)

 


Käytämme evästeitä

Tämä sivusto käyttää evästeitä, mukaanlukien kolmansien puolten evästeitä, vain sivuston toiminnan kannalta välttämättömiin tarkoituksiin, kuten asetusten tallentamiseen käyttäjän laitteelle, käyttäjäistuntojen ylläpitoon ja palvelujen toiminnan mahdollistamiseen. Sivusto kerää käyttäjästä myös muuta tietoa, kuten käyttäjän IP-osoitteen ja selaimen tyypin. Tätä tietoa käytetään sivuston toiminnan ja tietoturvallisuuden varmistamiseen. Kerättyä tietoa voi päätyä myös kolmansien osapuolten käsiteltäväksi sivuston palvelujen tavanomaisen toiminnan seurauksena.

FI / EN