stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Quiz 4: Advanced JavaScript & Web APIs Flashcards | StudBud
Explore
/
Quiz 4: Advanced JavaScript & Web APIs
Quiz 4: Advanced JavaScript & Web APIs
18 terms
·
StudBud Administration
·
316 plays
Imported from external platform
Flashcards
18 cards
F
Practice quiz
P
Host live
L
Questions
18
Answers
1
Which of the following can be used to call a Web API?
All of the above
Axios
`fetch`
`XMLHttpRequest`
2
What does `event.preventDefault()` do?
Stops the default behaviour of an event from occurring
Immediately returns from the event handler function
Detaches any existing handlers for that type of event
Waits for an asynchronous operation before continuing
3
What is a Web API?
A strategy for organizing server-side code
A set of methods used to manipulate the DOM using JavaScript
A server accessed using remote procedure calls (RPC)
An API on a server, accessed by making HTTP requests to some URL endpoints
4
In a form submit handler function, what property can be used to access the values of the form inputs?
`FormData`
`event.target`
`form.element`
None - the input elements must be directly selected using the DOM
5
What technique should be used to handle any errors that may occur when calling a Web API?
Wrap the call to the Web API in a `try/catch` block
Nothing; an error cannot occur when calling a Web API
Use `console.error`
Use `await` with Axios
6
Which of the following takes a function as an argument and calls it after a period of time has elapsed?
`timeout`
`setTimeout`
`then`
`delay`
7
What does API stand for?
Asynchronous Program Interpreter
Application Programming Interface
Asynchronous Project Iteration
Artificial Primary Intelligence
8
Is an empty string truthy or falsy?
Falsy
Truthy
9
What method converts a JavaScript object into its JSON representation?
`JSON.stringify()`
`JSON.format()`
`JSON.parse()`
`object.toString()`
10
What does `forEach` do?
Provides an index value that counts from 0 to the length of an array
Iterates over an array, calling the provided function with each item
Prints out a list of items to the console
Nothing; it's deprecated
11
Which of the following array methods is a higher order function?
`slice`
`map`
`push`
`splice`
12
Which statement about asynchronous JavaScript is true?
The result of an async operation is available immediately when it is run
Async operations always finish in the same sequence in which they were run
An async function gives control back to the calling code before it returns
Async functions always take the same amount of time
13
What is JSON?
A tool for viewing complex data structures in the browser
A way of describing data in plain text using an object-like notation
A tool for formatting JavaScript code
A deprecated way of defining objects in JavaScript
14
What does `Promise.all` do?
Runs a sequence of tasks, returning the first one that resolves
Runs multiple asynchronous tasks in parallel
Returns a boolean indicating whether multiple async tasks have all resolved
Turns an array of values into an array of promises
15
Which combination of event type and element should be used to handle a form submission?
A `click` event on the submit button
A `change` event on the last text input
A `submit` event on the submit button
A `submit` event on the form element
16
What will this code log to the console?
undefined
Charlie
Alice
Bob
17
What is an API?
A technique that allows AI to write programs
A form that must be completed to obtain a developer licence
A way for users to easily interact with a program in the browser
A set of methods that defines how code can interact with other software
18
In which order will the letters be logged when this code runs?
X, Y, Z
X, Z, Y
Y, X, Z