APIs

APIs

6th - 8th Grade

10 Qs

quiz-placeholder

Similar activities

Spreadsheets

Spreadsheets

6th - 8th Grade

13 Qs

Computer Vocabulary 1

Computer Vocabulary 1

1st - 12th Grade

14 Qs

Basics of Graphic Arts & Gravit Designer

Basics of Graphic Arts & Gravit Designer

8th Grade

15 Qs

Revision Gr2-2025

Revision Gr2-2025

3rd Grade - University

12 Qs

Layout & Composition KS4

Layout & Composition KS4

6th - 11th Grade

15 Qs

Programs and Variables in Code and Play

Programs and Variables in Code and Play

5th - 9th Grade

7 Qs

B Words GCSE Computer Science

B Words GCSE Computer Science

1st - 10th Grade

15 Qs

Mrs O's Computer Architecture Quiz

Mrs O's Computer Architecture Quiz

KG - University

13 Qs

APIs

APIs

Assessment

Quiz

Computers

6th - 8th Grade

Practice Problem

Medium

Created by

Alaa Ahmad

Used 4+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?