Tentin tekstisisältö

TIE-23500 Web-ohjelmointi - 26.02.2018

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
HTML & CSS

1. (2 points)

x
What is HTML used for? What is CSS used for? Why two different languages? + W 4

44 (

-&

eL ä
s N
2. (2 points) (3 (, utto W

 

|

Write down a simple HTML document that includes/references external CSS and JavaScript.
In the document you should have a title, a heading, some text, an image, and a button.

Before starting to write the HTML, read the next two guestions. It might be useful.

3. (2 points)

Write down a CSS file that styles all elements in the HTML page you came up with in the
previous guestion. Explain what your stylesheet does. Try to be specific in your explanation.

JavaScript

4. (2 points)

Earlier you defined HTML for a page that had a button and an image. Now write JavaScript
which gives the page this interactivity:

When the button is clicked, the picture gets hidden. Clicking again shows the picture.
And so on.

Hints:
Both vanilla JavaScript and jOuery are fine.

If you reference an HTML element from JavaScript, you can access and modify its CSS
properties for instance in this way:

elemRef.style.display = "none";

A CSS property may be removed by setting its value to an empty string (”).
5. (2 points)
What is JavaScript used for? Give some (simple) examples of different use cases.

In terms of web applications and web software development, how is JavaScript running in a
browser (client) fundamentally different from some code (eg. Django application) running on
a server?

HTTP

6. (4 points)

  
 

GET /file

Explain what happens in the picture and why it is useful.
Specifically tell what the 200 OK, Cache-Control, ETag, and Resource cache are, and what
different scenarios might happen in the future.
Sessions & Security

7. (2 points)

aps is writing a blog post on a blogging service where he wrote the following as a title for th6
post. The beginnings of the texts he wrote are shown below. What is he trying to do in the
two cases? When and where is the attack code executed?

E)Mcat<script> rest of the text not shown ....
b) sau PSE Of the text not shown «...
8. (2 points)

Briefly explain the basic idea of Cross-Site Reguest Forgery (CSRF) protection. Be specific
enough but don't write more than % page.

Web Services

 

9. (4 points)

In HTTP there are a couple of different methods/verbs (listed below).

In terms of REST APIs, for what sort of interactions should they be used for?

For each of the verbs, give an example of a good use case and also write down the URL for
it. You can for instance describe a webshop API or a student records API.

The verbs are: GET, POST, PUT, DELETE

Django

10. (4 points)

Explain models, templates, and views in Django (MTV).
How do they relate to each other?

What are they used for?

What problems do each of them (try to) solve?


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