• Stars
    star
    316
  • Rank 132,587 (Top 3 %)
  • Language
  • Created over 1 year ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ”ฅ Repo related to my FrontendMasters course. An Advanced Web Dev Quiz that covers a wide range of the things web devs get to deal with on a daily basis.

Advanced Web Dev Quiz


This repo is related to my FrontendMasters course.
You'll find the questions and additional resources to get a better understanding of the concepts.

This Advanced Web Dev Quiz covers a wide range of the things web devs get to deal with on a daily basis. The goal is to (re)introduce you to certain concepts that you may have forgotten over the years or simply don't get exposed to that often ๐Ÿ™‚

Have fun, and hopefully you'll learn something new today! Good luck! ๐Ÿ’ช

โš ๏ธ This repo does not contain the answers(!), only the questions and useful resources on the question's topic!
To see the answers and watch visualized explanations for each question, please watch the FrontendMasters course! ๐Ÿ™

Overview


All Questions

1. Put the scripts in the right order of execution

  • A. <script defer src="defer1.js" /> (loads in 300ms)
  • B. <script defer src="defer2.js" /> (loads in 200ms)
  • C. <script async src="async1.js" /> (loads in 300ms)
  • D. <script async src="async2.js" /> (loads in 50ms)
  • E. <script async defer src="asyncdefer1.js" /> (loads in 60ms)
๐Ÿ’ก Resources

Answer:

Further reading:


2. Which statements are true?

  • A. The render tree contains all elements from the DOM and CSSOM combined
  • B. Compositing is the process of separating layers based on z-index, which are then combined to form the final image displayed on the screen
  • C. The layout process assigns colors and images to the visual elements in the render tree
  • D. The composting process happens on the compositor thread
  • E. Elements that aren't visible on the page, for example display: hidden, aren't part of the DOM tree
๐Ÿ’ก Resources

Answer:

Further reading:


3. Fill in the gaps

- Browser sends request to [A]
- [A] queries [B]
- [B] responds with [C] IP address
- [A] queries [C]
- [C] responds with [D] IP address
- [A] queries [D]
- [D] responds with website's [E]
  1. Recursive DNS Resolver
  2. Root Name Server
  3. IP Address
  4. Top Level Domain Name Server
  5. Autoritative Name Server
๐Ÿ’ก Resources

Answer:

Further reading:


4. What gets logged?

setTimeout(() => console.log(1));
Promise.resolve().then(() => console.log(2));
Promise.resolve().then(() => setTimeout(() => console.log(3));
new Promise(() => console.log(4));
setTimeout(() => console.log(5));
  • A. 1 2 3 4 5
  • B. 1 5 2 4 3
  • C. 3 2 4 1 5
  • D. 4 2 1 5 3
  • E. 2 4 3 1 5
๐Ÿ’ก Resources

Answer:

Further reading:


5. Match the resource hints with their definitions

  • A. dns-prefetch
  • B. preconnect
  • C. prefetch
  • D. preload
  1. prioritizes fetching of critical resources needed for the current navigation
  2. performs domain name resolution in the background
  3. proactively performs DNS resolution and TCP/TLS handshake
  4. requests non-critical resources in the background
๐Ÿ’ก Resources

Answer:

Further reading:


6. What's the output?

const member = { 
  name: "Jane", 
  address: { street: "101 Main St" }
};
const member2 = { ...member };
member.address.street = "102 Main St";
member.name = "Sarah";

console.log(member2);
  • A. { name: "Jane", address: { street: "101 Main St" }}
  • B. { name: "Jane", address: { street: "102 Main St" }}
  • C. { name: "Sarah", address: { street: "101 Main St" }}
  • D. { name: "Sarah", address: { street: "102 Main St" }}
๐Ÿ’ก Resources

Answer:

Further reading:


7. Put the PerformanceNavigationTimings in the right order

  • A. loadEventStart
  • B. domComplete
  • C. domContentLoadedEventStart
  • D. fetchStart
  • E. connectEnd
  • F. domInteractive
๐Ÿ’ก Resources

Answer:

Further reading:


8. Match the caching directives to their definitions

  • A. no-cache
  • B. must-revalidate
  • C. no-store
  • D. private
  • E. stale-while-revalidate
  1. validates a stale response with the origin server before using it
  2. serves stale content while validating the cached response with the origin server
  3. doesn't cache any part of the request or response
  4. validates a cached response with the origin server before using it, even if it is still fresh
  5. prevents caching on shared caches
๐Ÿ’ก Resources

Answer:

Further reading:


9. What statements are true about this code block?

function addMember(name) {
  return { name, createdAt: Date.now() }
}

let obj1 = addMember("John");
let obj2 = addMember("Sarah");

obj1.friend = obj2;
obj2.friend = obj1;

obj1 = null;
obj2 = null;
  • A. obj1 and obj2 cannot be garbage collected, leading to a memory leak
  • B. obj1 and obj2 will be garbage collected immediately after setting them to null
  • C. obj1 and obj2 will only be garbage collected after closing the browser tab
  • D. obj1 and obj2 can be garbage collected during the next garbage collection cycle
๐Ÿ’ก Resources

Answer:

Further reading:


10. When animating the following properties, which have the correctly listed rendering costs?

  • A. width: Layout, Paint, Composite
  • B. opacity: Paint, Composite
  • C. background-image: Composite
  • D. left: Layout, Paint, Composite
  • E. transform: Paint, Composite
๐Ÿ’ก Resources

Answer:

Further reading:


11. What gets logged when clicking button?

<div class="outer">
ย  <div class="inner">
ย  ย  <button>Click me!</button>
ย  </div>
</div>
outer.addEventListener("click", () => log("A"), true);
outer.addEventListener("click", () => log("B"));
inner.addEventListener("click", () => log("C"), true);
inner.addEventListener("click", (e) => {
ย  ย log("D");
ย  ย e.stopPropagation();
ย  ย log("E");
});
button.addEventListener("click", () => log("F"));
button.addEventListener("click", () => log("G"), true);
  • A. A B C D E F G
  • B. A C G F D
  • C. B D E F G C A
  • D. A C G F
  • E. A C G F D E
๐Ÿ’ก Resources

Answer:

Further reading:


12. Order the CSS selectors by ascending specificity

  • A. div h1.large-text::before
  • B. div h1:first-child
  • C. h1:not(.small-text)
  • D. .large-text:nth-child(1)
  • E. h1.large-text[id="title"]
  • F. h1.large-text#title
๐Ÿ’ก Resources

Answer:

Further reading:


13. What statements are true?

const userTokenMap = new WeakMap();

let user = { 
  name: "Jane Doe", 
  age: 24 
};

userTokenMap.set(user, "secret_token");
  • A. userTokenMap implements the iterator protocol
  • B. When setting user to null, userTokenMap returns 0
  • C. If theย userย object is set toย null, itsย userTokenMapย  entry can be be garbage collected.
  • D. [...userTokenMap] returns an array of userTokenMap entries
๐Ÿ’ก Resources

Answer:

Further reading:


14. Match the Web Vitals to the correct descriptions

  • A. TTFB
  • B. FID
  • C. TTI
  • D. TBT
  • E. CLS
  • F. INP
  1. the time it takes for a webpage to respond to a user's first interaction.
  2. the time that the main thread is blocked from responding to user input.
  3. the average time it takes for a webpage to update its visuals after a user interacts with it.ย 
  4. the time it takes for the server to respond to a request and start sending data back to the client
  5. the time it takes for a webpage to be fully loaded and responsive to user input.
  6. the stability of a webpage's layout, or the unexpected layout shifts that occur on a webpage as it loads.
๐Ÿ’ก Resources

Answer:

Further reading:


15. Which resources will be allowed with the following CSP header?

default-src "none"; script-src "self"; img-src "self" example.com; style-src fonts.googleapis.com; font-src fonts.gstatic.com;
  • A. <script src="/js/app.js"></script>
  • B. fetch("https://api.website.com/data")
  • C. @font-face { url("fonts/my-font.woff") }
  • D. <img src="data:image/svg+xml;..." />
  • E. <style>body { font-family: 'Roboto' }</style>
  • F. <iframe src="https://embed.example.com"></iframe>
  • G. <link rel="stylesheet" href="https://fonts.googleapis.com..>
  • H. <video src="https://videos.example.com/..."></video>
๐Ÿ’ก Resources

Answer:

Further reading:


16. Which statements are true?

  • A. rel="noopener" is used to prevent the original page from accessing the window object of the newly opened page
  • B. rel="noreferrer" can be used to prevent the newly opened page from accessing the window object of the original page
  • C. rel="noopener" and rel="noreferrer" can only be used with HTTPS
  • D. rel="noopener" can be used to prevent tabnabbing
  • E. The default Referrer-Policy is no-referrer-when-downgrade
๐Ÿ’ก Resources

Answer:

Further reading:


17. When does "In log: My input!" get logged?

function* generatorFunc() {
  const result = yield "My input!";
  console.log("In log:", result);
  return "All done!"
};

const it = generatorFunc();
  • A. it.next()
  • B. it.next("My input!") it.next()
  • C. it.next() it.next("My input!")
  • D. it.next() it.next()
๐Ÿ’ก Resources

Answer:

Further reading:


18. Connect the Promise methods to the right output

const promises = [
   new Promise(res => setTimeout(() => res(1), 200),
   new Promise(res => setTimeout(() => res(2), 100),
   new Promise((_, rej) => setTimeout(() => rej(3), 100),
   new Promise(res => setTimeout(() => res(4), 300)
];

Promise[โ“]
   .then(res => console.log("Result: ", res))
   .catch(err => console.log("Error: ", err)
  • A. all
  • B. any
  • C. race
  • D. allSettled
  1. Result: 2
  2. Error: 3
  3. Result: [{}, {}, {}, {}]
  4. Result: 2
๐Ÿ’ก Resources

Answer:

Further reading:


19. Which of the following values will always make your page ineligible for bfcache?

  • A. unload
  • B. pagehide
  • C. onbeforeunload
  • D. pageshow
  • E. All of the above
  • F. None of the above
๐Ÿ’ก Resources

Answer:

Further reading:


20. Connect the terms with their definitions

  • A. XSS
  • B. CSRF
  • C. UI Redressing
  • D. MITM
  1. allows attackers to inject malicious scripts into web pages viewed by others
  2. tricks users into interacting with disguised or hidden elements
  3. tricks users into executing unwanted actions by exploiting their authenticated session
  4. allows attackers to intercept and modify communication between two parties without their knowledge
๐Ÿ’ก Resources

Answer:

Further reading:


21. Connect the font strategies to their definition

  • A. font-display: block
  • B. font-display: swap
  • C. font-display: fallback
  • D. font-display: optional
  • E. font-display: auto
  1. temporarily render an invisible font until the custom font has been downloaded
  2. use a fallback font while the custom font is downloading, switch to the custom font when available
  3. only use the custom font if it is available, otherwise use a fallback font
  4. allows the browser to determine the most appropriate behavior for font loading
  5. use the custom font if it is available, use a fallback font if the custom font is not available
๐Ÿ’ก Resources

Answer:

Further reading:


22. What statements are true about the following cookie header?

Set-Cookie: my-cookie="value"; Domain="website.com"; Secure; HttpOnly;
  • A. This cookie is accessible from www.website.com, but not from blog.website.com
  • B. This cookie can only be set client-side on the website.com domain
  • C. This cookie gets treated like a session cookie
  • D. This cookie will be sent when navigating from another website to www.website.com
๐Ÿ’ก Resources

Answer:

Further reading:


23. Which of the CSS (pseudo)selectors can we use to only target the first list item <li>One</li>?

<div>
  <ul>
    <li>One</li>
    <ul>
      <li>Two</li>
      <li>Three</li>
    </ul>
  </ul>
  <ul>
    <li>Four</li>
  </ul>
</div>
  • A. ul:first-child > li
  • B. ul:first-child + li
  • C. ul:first-child > li:first-child
  • D. ul:first-of-type > li:first-of-type
  • E. ul:first-child + li:first-child
๐Ÿ’ก Resources

Answer:

Further reading:


24. What is true about the following header?

Strict-Transport-Security: max-age=31536000; includeSubdomains;
  • A. The header enforces HTTPS for one year on the domain and its subdomains
  • B. When max-age expires, browsers will default to HTTP
  • C. The max-age is refreshed every time the browser reads the header
  • D. Insecure requests to subdomains are allowed
๐Ÿ’ก Resources

Answer:

Further reading:


25. Which of the following properties causes the element to be promoted to its own RenderLayer?

  • A. z-index: 1
  • B. translate3d: (0, 0, 0)
  • C. will-change: transform
  • D. transform: rotate(45deg)
  • E. position: fixed
  • F. position: absolute
๐Ÿ’ก Resources

Answer:

Further reading:


26. Match the image formats to the descriptions

  • A. JPEG
  • B. PNG
  • C. WebP
  • D. AVIF
  1. Both lossy and lossless compression, supports HDR and WCG, supports transparency
  2. Both lossy and lossless compression, supports transparency, supports progressive rendering
  3. Lossless compression, high quality, supports transparency, larger file size
  4. Lossy compression, supports progressive rendering
๐Ÿ’ก Resources

Answer:

Further reading:


27. What is true about the following CORS config?

Access-Control-Allow-Origin: https://www.website.com
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: *
Access-Control-Expose-Headers: X-Custom-Header
Access-Control-Max-Age: 600
  • A. A preflight request is required
  • B. Only requests from https://www.website.com are allowed
  • C. Requests with cookies are allowed
  • D. The actual response is cached for 600ms
  • E. X-Custom-Header will be the only included response header
  • F. GET, POST, PATCH and PUT methods are allowed, but not DELETE
๐Ÿ’ก Resources

Answer:

Further reading:


28. What gets logged?

setTimeout(() => console.log(1));

(async () => {
  console.log(2);
  await Promise.resolve();
  console.log(3);
})()

Promise.resolve().then(() => Promise.resolve().then(() => console.log(4)))
  • A. 1 2 3 4
  • B. 2 4 3 1
  • C. 2 3 4 1
  • D. 2 3 1 4
๐Ÿ’ก Resources

Answer:

Further reading:


29. What statements are correct?

  • A. HTTP/2 allows multiple requests and responses concurrently over a single TCP connection
  • B. HTTP/3 can only be used with HTTPS
  • C. HTTP/2 is backward compatible with HTTP/1.1
  • D. HTTP/1.1 requires multiple TCP connections to process multiple requests simultaneously
๐Ÿ’ก Resources

Answer:

Further reading:


30. What gets logged?

const objA = { 
  type: "A",
  foo() { 
    console.log(this.type) 
  }
}

const objB = { 
  type: "B",
  foo: objA.foo,
  bar: () => objA.foo(),
  baz() { objA.foo() }
}

objB.foo();
objB.bar();
objB.baz(); 
  • A. A B B
  • B. B A A
  • C. A A A
  • D. A undefined A
  • E. B undefined B
๐Ÿ’ก Resources

Answer:

Further reading:

More Repositories

1

javascript-questions

A long list of (advanced) JavaScript questions, and their explanations โœจ
62,567
star
2

javascript-react-patterns

Repo related to the FrontendMasters course on JavaScript and React patterns
TypeScript
1,061
star
3

algo-data-structures

๐ŸŽ‰Common data structures and algorithms using JS.
JavaScript
440
star
4

React-Ecommerce

๐Ÿ‘› Personal Project: E-Commerce website with React
JavaScript
318
star
5

jsquiz

JS Quiz Website
TypeScript
213
star
6

byof-demo

WIP Demo
TypeScript
85
star
7

serverless-graphql

Setups for Serverless GraphQL ๐Ÿš€
TypeScript
79
star
8

graphql-workshop

JavaScript
41
star
9

codebuddy-fs

๐Ÿ™‹Personal Project: Social platform built with React, Redux, Node, Express, Passport, JWT, oAuth, MongoDB
JavaScript
39
star
10

CodeBuddy

๐Ÿšง WIP - Connect with developers and find projects ๐Ÿ‘ฏ
JavaScript
39
star
11

javascript-guide

๐Ÿ’ป A website for desktop to find the right, basic JavaScript methods
JavaScript
38
star
12

react-graphql-starter

Demo starter pack for React + Apollo Client + GraphQL Yoga
JavaScript
32
star
13

lydiahallie

29
star
14

serverless-components-gql

JavaScript
20
star
15

droplr-clone

WIP ๐Ÿšง Use firebase storage cloud and database for image storing app
JavaScript
18
star
16

firebase-react-example

JavaScript
17
star
17

js-resources

๐Ÿšง [UNMAINTAINED] Find the right JavaScript resources
JavaScript
14
star
18

aws-serverless

JavaScript
14
star
19

minimal-rsc

JavaScript
10
star
20

cloudinary-upload-prisma2

JavaScript
8
star
21

smart-meter-graph

๐Ÿ“ˆRead real-time energy/gas usage data using Raspberry Pi 3, Python, C++, React
JavaScript
8
star
22

go-rmq

Go
6
star
23

starter-gatsby-blog

Gatsby starter for a Contentful project from the community.
JavaScript
6
star
24

mystery-word

Hangman with Node.js
JavaScript
5
star
25

MLc

๐Ÿ’ป Python machine learning
Python
4
star
26

CircleCIPrisma

Boilerplate for Prisma CircleCI tutorial
TypeScript
4
star
27

first-cpp

First personal C++ projects
C++
4
star
28

react-threejs-3d

JavaScript
3
star
29

ondemand-isr-bug-reprod

Reprod for ondemand ISR issue
CSS
3
star
30

graphql-list

JavaScript
3
star
31

asm

Python
3
star
32

date-facts

Node.js practice
JavaScript
3
star
33

daily-login

Create a login website with Node.js
JavaScript
2
star
34

node-raspberrypi

JavaScript
2
star
35

pc

GraphQL TS schema generator
TypeScript
2
star
36

dodge-game-react

Make a dodge game with React: Sweden vs. Denmark
JavaScript
1
star
37

user-directory

Create a user directory using Express.js
HTML
1
star
38

form-react-redux

Create a form with React Redux
JavaScript
1
star