
APIs

Quiz
•
Computers
•
6th - 8th Grade
•
Easy
Alaa Ahmad
Used 1+ times
FREE Resource
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
Similar Resources on Wayground
10 questions
Simple Easy Basic Lua Quiz

Quiz
•
4th Grade - Professio...
11 questions
Computer/Unity Navigation + More

Quiz
•
6th - 8th Grade
10 questions
Программирование C#

Quiz
•
1st - 10th Grade
15 questions
FSWI - CH4 T1

Quiz
•
KG - Professional Dev...
10 questions
Lección 4 Variables Laboratorio de Aplicaciones

Quiz
•
6th Grade
10 questions
JavaScript quiz for beginners

Quiz
•
7th Grade
11 questions
JS 01

Quiz
•
7th - 9th Grade
10 questions
AppLab

Quiz
•
6th - 8th Grade
Popular Resources on Wayground
55 questions
CHS Student Handbook 25-26

Quiz
•
9th Grade
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
10 questions
Chaffey

Quiz
•
9th - 12th Grade
15 questions
PRIDE

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
22 questions
6-8 Digital Citizenship Review

Quiz
•
6th - 8th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade