PI01 – Part 2

1. What is true regarding communication over http? (multiple choice)

  • The server initiates the request to the client
  • The server sends a response to the client request
  • The client sends a response to the server request
  • The client initiates the request to the server

2. What is an example of a http method

  • application/json
  • 200 OK
  • DELETE
  • XMLHttpRequest

3. Which browser component is responsible for drawing on the screen?

  • Javascript Engine
  • Network stack
  • Rendering Engine
  • UI Backend
  • Browser Engine

4. Why do we not want styling to be done in our javascript files? (Multiple choice)

  • CSS generated from javascript will not be rendered
  • Modern browsers won’t accept CSS manipulation in javascript code as it opens up for security issues
  • Seperation Of Concern is a design goal that simplifies the maintenance of an application
  • Designers would probably like to have CSS separeted from javascript

5. Why is it recommended to place script-tags at the bottom of the html file?  (Multiple choice)

  • The script will have increased performance
  • The HTML code will be easier to read
  • Loading of the script will not block rendering of html
  • The DOM is rendered before we try to manipulate it.

6. Which object is the “global object” in the browser?

  • document
  • window
  • object
  • module

7. Can we use node-modules (modules.export/require) out of the box in the browser?

  • No
  • Yes

8. Can we use Ecma Script-modules (exports/imports) out of the box in the browser?

  • No
  • Yes

9. What is true? (Multiple choice)

  • The only way to debug in the browser is to use console.log or alert
  • Docker is needed to be able to build javascript applications for the browser
  • Webpack is needed to be able to build javascript applications for the browser
  • Javascript can run both on client and server

10. DOM is an abbrevation for….

  • Dynamic Object Moderation
  • Document Over Modulation
  • Document Object Model
  • Dynamic Over Model

11. Which options do you have to select the li element containing the text node “Second one”

  • document.querySelector(“#SecondOne”)
  • document.querySelectorAll(“li”)[1]
  • document.getElementById(“numberlist”).firstChild.nextSibling
  • document.getElementById(“numberlist”).children[1]

12. How do you create a new ELEMENT_NODE using javascript? (Multiple choice)

  • document.createElement()
  • document.createTextNode()
  • anotherNode.cloneNode()
  • node:create “ELEMENT_NODE”

13. Given HTML and CSS…Which class/classes is set on the div?

  • red, blue, tiger
  • blue, number, tiger
  • blue, tiger
  • red, number
  • number, red, blue, number, tiger

14. Why do we use templates?

  • Better performance than creating nodes using js
  • They help us separate html from js
  • It is a better version of flash
  • Templates are cached in the browser. JS-code is not.

15. What is an event listener?

  • An asynchronous call to a synchronous object-prototype using the built in document.xhr-function
  • the string “click”, “load” etc.
  • A function added to the event queue when an event of a specified type occurs in the browser
  • A tree describing the modular parts of the browser including mouse and keyboard

16. Given code…In what order will the animals be logged?

  • dog, bird, cat
  • bird, dog, cat
  • dog, cat, bird
  • cat, dog, bird

17. Given code…What is written in the log when the button is clicked:

  • The div The button
  • The button The div
  • The button
  • The div

18.   What is wrong with this code?

  • Nothing. It will work
  • XMLHttpRequest object is deprecated
  • You do not know how long the response time is
  • The code will only work in Chrome

Answers and last years recording

Recording of 2017: https://youtu.be/dy2bHVry6oI

Correct answers:

1: 2, 4

2: 3

3: 4

4: 3, 4

5: 3, 4

6: 2

7: 1

8: 2

9: 4

10: 3

11: 2, 4

12: 1,3

13: 2

14: 2

15: 3

16: 3

17: 3

18: 3

Welcome to CoursePress

en utav Linnéuniversitets lärplattformar. Som inloggad student kan du kommunicera, hålla koll på dina kurser och mycket mer. Du som är gäst kan nå de flesta kurser och dess innehåll utan att logga in.

Läs mer lärplattformar vid Linnéuniversitetet

Student account

To log in you need a student account at Linnaeus University.

Read more about collecting your account

Log in LNU