
APIs
Quiz
•
Computers
•
6th - 8th Grade
•
Practice Problem
•
Medium
Alaa Ahmad
Used 4+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
console.log("first line");
setTimeout(() => {
console.log("second line");
}, 3000);
console.log("third line");
What will be the correct order of output?
first line → second line → third line
first line → third line → second line
second line → first line → third line
third line → first line → second line
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
let x = new XMLHttpRequest();
x.open("GET", "https://jsonplaceholder.typicode.com/posts");
x.send();
x.addEventListener("load", function(){
console.log(x.responseText);
});
Which statement is correct?
This code runs synchronously
console.log(x.responseText) will run only after the data is fully loaded
console.log will never run
x.send() blocks the code until data is received
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why is callback() used ?
To delay sending the request
To run code after the data is fetched
To repeat the request multiple times
To convert data to JSON
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
console.log("first line");
setTimeout(() => { console.log("second line"); }, 3000);
setTimeout(() => { console.log("one"); }, 5000);
setTimeout(() => { console.log("two"); }, 2000);
console.log("third line");
What is the correct output order?
first line → third line → two → second line → one
first line → second line → two → third line → one
third line → first line → one → two → second line
first line → third line → second line → one → two
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
function a(){
console.log("a");
a();
}
a();
What will happen when this code runs?
It prints "a" once only
It prints "a" multiple times then stops after 5 times
Maximum call stack size exceeded error
Nothing will be printed
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the resolve() and reject() functions in the following promise?
resolve() logs the response, and reject() retries the request.
resolve() marks the promise as successful (proceeding to .then()), and reject() triggers .catch().
Both resolve() and reject() terminate the promise chain.
They are optional and have no effect on the promise.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is wrong with the following callback-based code compared to the promise version?
It uses fewer API calls.
It suffers from "callback hell" (nested, hard-to-read code)
It runs faster than the promise version.
It logs responses more clearly.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Excel Chapter 12 Charts
Quiz
•
8th - 9th Grade
15 questions
Internet Basics
Quiz
•
5th Grade - University
10 questions
Quiz: Print, Syntax and Comments in Python
Quiz
•
6th Grade
14 questions
การใช้ Internet อย่างปลอดภัย
Quiz
•
4th - 6th Grade
11 questions
Animations in Flash
Quiz
•
7th Grade
15 questions
Spreadsheets
Quiz
•
1st - 12th Grade
10 questions
MACAM-MACAM IKON PAINT
Quiz
•
5th - 12th Grade
10 questions
code.org Unit 2 Lesson 2 Intro to HTML Quiz 1
Quiz
•
7th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
