• Ei tuloksia

0, of of

N/A
N/A
Info
Lataa
Protected

Academic year: 2022

Jaa "0, of of"

Copied!
4
0
0

Kokoteksti

(1)

CS-C3170 Web Software Development: Exam 19.12.2019

• All answers should easily fit on a single answer sheet.

• Write on each paper your name, your student number including any checking characters, the code and name of this course, examination hall, date, the number of papers returned and your signature.

• If the question number is followed by an asterisk

0 ,

you should select all options that apply. If there is no asterisk, select only one.

• No additional materials, calculators etc. allowed.

(2)

HTML&CSS

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

2. What does the following CSS snippet do to the given HTML?

HTTP

More specifically, how are the words Cat, Dog and Octopus styled?

(correct outcome, 1 point) (explanation, 1 point)

hl {

color : green ;

}

hl . calm { color: blue;

}

hl , h2 {

}

color : red ;

font-style: italic;

Hl, .calm { color : yellow;

}

<hl class="calm" > Cat</hl >

<h2 class="hot" > Dog< /h2 >

<hl > Octopus < /hl >

3) When a web form is submitted, we often get an HTTP response code 302 Found which redirects the browser to another page. Give two reasons why we want to redirect the user.

(1.5 points). When would we not redirect? (0.5 points)

(max 5 sentences, 2 points)

4) Consider the URL https://sample:stuff@aalto.fi/access?error=404 Explain briefly what are the following parts of the URL (2 points)

a)

https://

b)

sample : stuff@

c)

aalt o.fi

d)

/access

e)

?error=404

5) Please describe how GET and POST differ in parameter passing? (1 point)

(3)

Java Script

6) The following JavaScript code is executed. What, (if anything) is printed in the console on lines 4, 6 and 8? (3 points)

A Pis

1) var text = "Hello"

2)

3) function example() { 4) console.log( text ); 5)

6) 7) 8) 9)

var text = "World"

console.log( this.text );

function other() { console.log( text );

} 10) other();

11) } 12)

13) example();

7) Explain briefly how the HTTP methods GET, PUT and POST are typically used in a RESTful service when used with an instance resource.

(max 5 sentences, 2 points) Sessions & Security

8) Consider the four attacks below and possible countermeasures in bold. (3 points) State for each pair if the countermeasure is effective/ineffective and justify your choice with max 2 sentences per each attack-countermeasure pair.

a) Session hijacking (stealing cookies) vs HTTPS b) Stored XSS vs. Same-origin policy

c) CSRF vs. HTTPS

d) SOL Injection vs. Escaping user-supplied data in templates Django

9)

0

Which of the following statements are true for Django templates? (1 point) a) Templates cannot contain inline javascript as it gets escaped

b) Templates can specify HTTP Headers for the response c) Templates have if statements and for-loops

d) Templates can contain and execute arbitrary Python code a) All CSS code should be placed in the templates

-

"·'

(4)

10)(total4 points)

The following snippets are a Django view and the corresponding urls.py that could have been in someone's course project (they weren't) The service hosts private photo albums for a number of users. There are no syntax or other errors in the code.

1 @login_ required (login_ url=" I login/") 2 def del_page(request, album, page_num):

3 page= Page.objects.get_object_or_404(album=album,number=page_num)

4 page.delete()

5 return HttpResponseRedirect("/albums/")

urlpatterns = [

path('delete/<str:album>/<int:page_num>/', views.del_page) , ... other urls ...

(3 points) Briefly explain 3 fundamentally different scenarios that can what happen when a user visits the URL:

http://someserver.com/delete/vacation/5 Use the line numbers if necessary.

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

Viittaukset

LIITTYVÄT TIEDOSTOT

Your solution should consist of a brief explanation of the observations you made, a couple of representative plots to support this, and a printout of your program

→ Write the definitions of the main concepts for your final

Write your answer under each problem number. If you do NOT know the answer, leave the space empty. For each WRONG answer, 1/4 of the points is deducted.. Erkki wants to fill the bigger

Myös historian opetuksen osalta 2010-luvulla laaditut opetus- suunnitelmat sekä perusopetuksessa että lukiokoulutuksessa korostavat sisältötavoitteiden rinnalla sekä

The filename (or files) need to have your name in it. Your name and student number should be in the file too. Most common file types, like .doc .pdf are OK. The answers can be hand

CIV-E2040 Maintenance and Repair of Structures L (5 cr) Please write in every handwritten answer paper:.. o the name and the number of the course o the date of

If you want to replace the old course T-121.2I00 Introduction to User-Centred Product Development with this exam, write the new code to your papers, but in addition,

Now, type your student number and press Enter. If your student number ends with an alphabetical letter, you should type the numerical part of your student number, e.g., if