Unit I: Modern JavaScript & the Web AI Landscape (2026)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:10 AM on 9/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

50 Terms

1
New cards

Which keyword should you use by default for a value you will not reassign?

a) const b) let c) var d) static

a

2
New cards

Complete the arrow function so it adds two numbers: const add = (a, b) => \_\_\_\_;

a) a - b b) a + b c) a * b d) a / b

b

3
New cards

Complete the template literal so it prints "Score: 95%": `Sore: ${\_\_\_\_}%`

a) "score" b) value c) score d) ${score}

c

4
New cards

What does const {className, probability} = prediction; do?

a) Creates a new prediction object b) Adds className and probability to prediction c) Deletes className and probability from prediction d) Extracts className and probability from the prediction object

d

5
New cards

What is the DOM?

a) The browser's live, tree-structured representation of the HTML page b) A JavaScript library for making HTTP requests c) A data format for exchanging data between web apps d) A browser API for running machine learning models

a

6
New cards

Complete the code to select the first element with id "result": const out = document.\_\_\_\_('#result');

a) getElementById b) querySelector c) querySelectorAll d) selectElement

b

7
New cards

What is a Promise?

a) A function that executes immediately b) A callback function c) An object representing a value that will be available later d) A built-in browser API for HTTP requests

c

8
New cards

Why do we need await twice in the model-loading example?

a) Because one await is for syntax, the other is for runtime b) Because model.classify() requires two awaits c) Because both calls return Promises that must be resolved separately d) Because loading the model and running the model are two separate slow operations, each returning its own Promise

d

9
New cards

What does await response.json() do?

a) Parses JSON into a JavaScript object b) Sends JSON to the server c) Checks if the response is valid JSON d) Throws an error on a 404 response

a

10
New cards

What is Web AI?

a) A cloud-based AI service b) Running ML models directly in the browser using JavaScript c) A server-side AI framework d) A Python library for machine learning

b

11
New cards

Which library is maintained by Hugging Face for running pre-trained transformer models client-side?

a) TensorFlow.js b) MediaPipe Tasks c) Transformers.js d) ONNX Runtime Web

c

12
New cards

Which library is maintained by Microsoft for running models exported in the ONNX open format?

a) TensorFlow.js b) Transformers.js c) MediaPipe Tasks d) ONNX Runtime Web

d

13
New cards

Which library is best for ready-made, highly-optimized real-time perception like hands, faces, and gestures?

a) MediaPipe Tasks b) TensorFlow.js c) Transformers.js d) ONNX Runtime Web

a

14
New cards

Which library is best for training AND running models in JavaScript?

a) MediaPipe Tasks b) TensorFlow.js c) Transformers.js d) ONNX Runtime Web

b

15
New cards

What is a pre-trained model?

a) A model currently being trained b) A model with no weights c) A model already trained by someone else on a large dataset d) A model that must be trained before use

c

16
New cards

What is inference?

a) Creating a new model b) Adjusting a model's weights c) Collecting training data d) Running a trained model on new input to get a prediction

d

17
New cards

What is a backend in the context of Web AI?

a) The low-level technology a Web AI library uses to do its math b) A server that hosts AI models c) A JavaScript framework d) A database that stores predictions

a

18
New cards

Which backend repurposes the browser's 3D-graphics API to do matrix math on the GPU?

a) WASM b) WebGL c) CPU d) WebGPU

b

19
New cards

Which backend runs near-native-speed code on the CPU inside the browser sandbox?

a) WebGL b) WebGPU c) WASM d) CPU

c

20
New cards

Which backend is the modern browser GPU API, designed for compute rather than just graphics?

a) WebGL b) WASM c) CPU d) WebGPU

d

21
New cards

Complete the code to log the active backend: console.log(tf.\_\_\_\_());

a) getBackend b) backend c) activeBackend d) currentBackend

a

22
New cards

Why does on-device AI have a strong privacy advantage?

a) It encrypts all data b) Data never leaves the user's machine c) It uses a private server d) It deletes data after processing

b

23
New cards

Why can a webcam pose-detection game not be built on a cloud API alone?

a) Cloud APIs are too expensive b) Cloud APIs cannot process images c) The network delay (latency) makes real-time frame-by-frame processing unusable d) Cloud APIs are less accurate

c

24
New cards

Which architecture is free to operate and scales to any number of users at zero server cost?

a) Cloud AI b) Hybrid AI c) Server-based AI d) On-device AI

d

25
New cards

Complete the fetch code so it parses the response into a JavaScript object: const data = await response.\_\_\_\_();

a) json() b) parse() c) text() d) data()

a

26
New cards

What did the Fetch API replace?

a) The DOM b) AJAX/XMLHttpRequest c) WebGL d) Promises

b

27
New cards

Complete the code to select an element by its id: const img = document.\_\_\_\_('photo');

a) querySelector b) selectById c) getElementById d) getById

c

28
New cards

In the instructor's analogy, what does the backend represent?

a) The chef b) The recipe c) The restaurant d) The kitchen equipment

d

29
New cards

What is the difference between inference and training?

a) Inference runs a trained model on new input; training creates or adjusts the model b) Inference creates the model; training uses it c) Inference and training are the same thing d) Inference is done in the cloud; training is done on-device

a

30
New cards

What format are model files, API responses, and datasets in this course delivered as?

a) XML only b) JSON or binary alongside JSON metadata c) CSV only d) YAML

b

31
New cards

Which library is used for gesture and landmark detection in this course?

a) Transformers.js b) ONNX Runtime Web c) MediaPipe Tasks d) TensorFlow.js

c

32
New cards

Which library is used for sentiment analysis, summarization, and Whisper speech-to-text?

a) TensorFlow.js b) MediaPipe Tasks c) ONNX Runtime Web d) Transformers.js

d

33
New cards

Complete the destructuring so it extracts className and probability from a prediction: const \_\_\_\_ = prediction;

a) {className, probability} b) [className, probability] c) (className, probability) d) className, probability

a

34
New cards

What is the purpose of a model hub?

a) To train models b) To provide an online repository of shareable pre-trained models c) To deploy models to the cloud d) To convert models between formats

b

35
New cards

Why are the four Web AI libraries described as complementary, not competitors?

a) Because they all do the same thing b) Because they are all made by Google c) Because a professional picks per task: MediaPipe for perception, Transformers.js for language/speech, TensorFlow.js for custom training, ONNX Runtime for PyTorch models d) Because they are all free

c

36
New cards

Complete the code that logs the model's predictions to the console: console.log(\_\_\_\_);

a) model b) img c) classify d) predictions

d

37
New cards

Which frameworks can ONNX Runtime Web run models from?

a) Any framework that exports to the ONNX open format, such as PyTorch b) Only TensorFlow c) Only Keras d) Only scikit-learn

a

38
New cards

Why is WebGPU important for in-browser transformer models?

a) It reduces file size b) It makes in-browser transformer models practical because it's the fastest backend c) It replaces JavaScript d) It eliminates the need for a model

b

39
New cards

What does async/await do?

a) Makes code run faster b) Blocks the browser c) Pauses an async function until a Promise resolves, keeping code readable d) Prevents errors

c

40
New cards

Why might the same model be fast on one laptop and slow on another?

a) Because the model file size differs b) Because the HTML differs c) Because the browser version differs d) Because the backend chosen depends on the available hardware (GPU vs CPU)

d

41
New cards

Every AI library call in this course returns a Promise.

True

42
New cards

On-device AI requires a constant internet connection to run inference.

False

43
New cards

Arrow functions are heavily used as callbacks in AI code.

True

44
New cards

Model outputs are almost always objects, which is why destructuring appears constantly.

True

45
New cards

The Fetch API is a newer alternative to the DOM.

False

46
New cards

WebGL is the newest backend and makes transformer models practical.

False

47
New cards

Cloud AI provides access to frontier models like Claude, Gemini, and GPT that are too large for a browser.

True

48
New cards

On-device AI is limited by the user's device to small-to-medium models only.

True

49
New cards

Inference and training are the same operation.

False

50
New cards

Transformers.js is maintained by Google.

False