APIs

APIs

6th - 8th Grade

10 Qs

quiz-placeholder

Similar activities

O que vamos aprender?

O que vamos aprender?

1st Grade - University

11 Qs

JavaScript (control flow)

JavaScript (control flow)

8th Grade

15 Qs

Conditionals in JavaScript

Conditionals in JavaScript

7th - 8th Grade

14 Qs

TypeScript - змінні та типи

TypeScript - змінні та типи

8th Grade

11 Qs

JS Talks, Quiz #5

JS Talks, Quiz #5

1st - 12th Grade

15 Qs

JS general concepts - quiz 7th

JS general concepts - quiz 7th

7th Grade

11 Qs

Moringa JavaScript Arrays

Moringa JavaScript Arrays

5th Grade - Professional Development

10 Qs

JRDL - JS Variables, Datatypes, and Operators

JRDL - JS Variables, Datatypes, and Operators

6th Grade

13 Qs

APIs

APIs

Assessment

Quiz

Computers

6th - 8th Grade

Easy

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?