Computing and Information Technology

Programming with JavaScript and TypeScript Practice Exam, Flashcards & Questions

Master foundational to advanced Programming with JavaScript and TypeScript with 452 verified curriculum items, worked engineering solutions, and spaced-repetition cards.

332 Total Questions 120 MCQs 114 Calculations 98 Flashcards
Free Interactive Preview

Programming with JavaScript and TypeScript Sample Exam Questions & Rationale

Preview official questions below. The complete pool of 332 items is available in the offline app.

Question 1 of 4 Async and await

What does an `async` function in JavaScript always return, even if the return statement yields a primitive value like a number or boolean?

A A Thunk callback function
B A Promise fulfilled with that value
C The primitive value synchronously
D A generator object wrapped in an iterator
Accepted Answer: Option B (A Promise fulfilled with that value)

Rationale: An `async` function always wraps its return value in a Promise: returning `5` returns `Promise.resolve(5)`.

Question 2 of 4 Callbacks

In asynchronous JavaScript programming, what primary convention is standard for handling errors in Node.js callback functions?

A Error-first callbacks where the error object is passed as the first argument: `(err, data) => ...`
B Global event emitter callbacks where errors are routed to `process.catch`
C Status-code callbacks where an HTTP integer status code is passed as the last argument
D Dual-callback pattern requiring two separate callback functions for success and failure
Accepted Answer: Option A (Error-first callbacks where the error object is passed as the first argument: `(err, data) => ...`)

Rationale: Node.js standard convention requires errors to be passed as the first parameter (or null if successful): `callback(err, result)`.

Question 3 of 4 Concurrency patterns

Which `Promise` combinator method returns a single Promise that fulfills only when all input promises fulfill, but rejects immediately upon the first rejection?

A Promise.all()
B Promise.allSettled()
C Promise.race()
D Promise.any()
Accepted Answer: Option A (Promise.all())

Rationale: `Promise.all()` exhibits 'fail-fast' behavior: if any promise rejects, the entire returned promise immediately rejects with that rejection reason.

Question 4 of 4 Error handling in async code

What happens in modern Node.js and browser runtimes if a Promise is rejected and no `.catch()` handler or `try...catch` block handles the rejection?

A The Promise retries execution up to three times before failing silently
B An `unhandledrejection` event is dispatched and Node.js terminates the process with a non-zero exit code
C The runtime converts the rejected Promise into a resolved Promise containing null
D The error is silently swallowed and logged as an informational warning without interrupting execution
Accepted Answer: Option B (An `unhandledrejection` event is dispatched and Node.js terminates the process with a non-zero exit code)

Rationale: Modern Node.js triggers an `unhandledrejection` event and crashes with exit code 1 to prevent silent state corruption from uncaught async errors.

Active Recall Spaced Repetition Cards (Preview)

Card 1 • Async and await
The async function is suspended, and the continuation is scheduled as a {{c1::microtask}} once the awaited promise settles.
The `await` keyword pauses the surrounding async function, yielding control back to the event loop; code after `await` resumes in a microtask job.
Card 2 • Callbacks
The nesting of deeply intertwined asynchronous callbacks leading to unmaintainable code is commonly termed {{c1::callback hell}} or the.
Promises and `async/await` syntax were introduced to flatten callback pyramids into sequential, readable asynchronous chains.

Programming with JavaScript and TypeScript Curriculum Modules & Topics Covered

Modules
Asynchronous JavaScriptReact and Frontend FrameworksJavaScript BasicsTypeScriptBrowser and Runtime
Core Exam Topics
  • Promises
  • Event loop
  • Error handling in async code
  • State and hooks
  • Variables (let const var)
  • Data types and coercion
  • Operators and equality
  • Control flow
  • Functions and arrow functions
  • Arrays and objects
Learning Objectives
  • Develop core conceptual recall and analytical problem-solving in Asynchronous JavaScript.
  • Develop core conceptual recall and analytical problem-solving in React and Frontend Frameworks.
  • Develop core conceptual recall and analytical problem-solving in JavaScript Basics.
  • Develop core conceptual recall and analytical problem-solving in TypeScript.
  • Develop core conceptual recall and analytical problem-solving in Browser and Runtime.

Free Downloadable Programming with JavaScript and TypeScript Study Packs (.ZIP / .TSV)

Full Spreadsheet Data (TSV)
TSV • 332 items
Complete Course Pack
ZIP • 332 items
Elements (Complete)
ZIP • 332 items
Elements (Mastery)
ZIP • 332 items
Elements (Standard)
ZIP • 332 items
Active Recall Flashcards
ZIP • 332 items
Formula Codex
ZIP • 332 items
Problem Solving (Mastery)
ZIP • 332 items
Artificial Intelligence (1,579) Artificial Intelligence and Machine Learning (507) Cloud Computing and DevOps (144) Compiler Design & Formal Languages (1,579) Computational Contact Mechanics: Penalty Function Method, Lagrange Multipliers & Mortar Contact Formulations (128) Computer Engineering & Algorithms (1,365)
Full Question Pool: 332 Verified Items

Unlock All 332 Programming with JavaScript and TypeScript Practice Questions

Study the full question pool with 13 active recall battle modes, FSRS v5 spaced repetition, and 1-click printable PDF mock exams with full answer keys on Android and Windows PC.

Get on Google Play (Android) Get on Microsoft Store (Windows PC)