
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.
Access all questions and much more by creating a free account
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
10 questions
Computer Hardware
Quiz
•
3rd - 11th Grade
10 questions
ม.2 แบบทดสอบก่อนเรียน หน่วย 2
Quiz
•
6th - 8th Grade
15 questions
HTML & CSS 1
Quiz
•
8th Grade
10 questions
Word basics
Quiz
•
8th - 12th Grade
10 questions
KS4 Programming Techniques (1)
Quiz
•
8th - 10th Grade
15 questions
Evaluare sumativă cl7modulul2
Quiz
•
7th Grade
10 questions
Internet
Quiz
•
7th - 10th Grade
10 questions
Chapter 4 - Latihan
Quiz
•
1st - 12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
