W2. Computation Flashcards

1
Q

Describe the OG web model

A
  • client sends request
  • server returns page
  • web pages stored in files on server
    Everything is static!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe the modern web model

A
  • dynamic content/input
  • personalised data on pages
  • can upload info from client to server (info in both directions)
  • client-side state (asynch & caching)
  • validation on client & server sides
  • fetch new info dynamically
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

List technologies needed to create dynamic web pages

A
  • Event handlers in HTML
  • Handlers calling client-side JS
  • JS manipulates the DOM
  • Some language server-side (JS for code re-usability)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In JS, what does dynamic typing mean?

A

Type of a variable is assigned when the value is assigned
- type may also be changed if value is re-assigned
(but typing is strong)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In JS, what are the primitive types?

A
  • numbers
  • strings
  • booleans
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In JS, what are the trivial types?

A
  • null

- undefined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In JS, what are the composite types?

A
  • objects

- arrays

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In JS, what properties do functions have as types?

A
  • functions are first-class values

- there are multiple ways of defining functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between using == and === in JS?

A

== checks if two values are the same regardless of type (coercion to same type before comparison)
=== checks type as well as value - strict equality
(also used for strings)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What properties does the keyword “let” have in JS?

A
  • to introduce a declaration

- smallest scope (block scope { } )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What properties does the keyword “var” have in JS?

A
  • to introduce a declaration

- global/function scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What properties does the keyword “const” have in JS?

A
  • to introduce a declaration
  • block scope { }
  • cannot be updated - like final in Java
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are variables declared if let, var and const are NOT used?

A

Variable will be globally scoped

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

List 4 objects that are accessible via the JS DOM API

A
  • document
  • window
  • navigator
  • screen
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Where in HTML should a script tag for JS be placed?

A

At the bottom of the page (just before

How well did you know this?
1
Not at all
2
3
4
5
Perfectly