What does the JavaScript expression 5 === "5" evaluate to?
03 Types and Data Representation Online Quiz Questions
Use this free practice quiz with 20 questions to review 03 Types and Data Representation, test your knowledge, and prepare for your next test or exam.
What string does JavaScript return for typeof null?
- A
"object"
- B
"null"
- C
"undefined"
- D
"value"
A program needs to store tags while automatically eliminating duplicate tag values. Which JavaScript representation is the best fit?
- A
An array
- B
An object
- C
A set
- D
A string
Which expression correctly tests whether names was created as an array using the Array constructor or its prototype chain?
- A
names instanceof Array - B
names is Array - C
Array.typeof(names) - D
names.constructorCheck(Array)
In JavaScript, calling toUpperCase() on a string changes the original string in place.
- A
True
- B
False
In JavaScript, ordinary floating-point numbers represent every decimal calculation exactly, so 0.1 + 0.2 always produces exactly 0.3.
- A
True
- B
False
What numeric index accesses the first character of the JavaScript string "Hello"?
What special JavaScript numeric value is produced by Number("not a number")?
To convert the decimal text "3.14" to a floating-point number using the conversion function shown in the material, call ("3.14").
A named property in a JavaScript object can be accessed with or .
Select all statements that correctly describe JavaScript value assignment and object copying.
- A
After
let a = 10; let b = a;, assigningb = 20leavesaequal to 10. - B
After
const first = { score: 10 }; const second = first;, changingsecond.scorealso changes the value seen throughfirst. - C
A shallow copy of an object does not recursively copy nested objects or arrays.
- D
Assigning one object variable to another always creates an independent copy of every nested property.
Select all statements that correctly describe JSON serialization and parsing across a program boundary.
- A
JSON.stringify()converts an in-memory object or array into JSON text. - B
JSON.parse()converts JSON text back into a JavaScript value. - C
Data parsed from an external source should be validated before the program relies on its shape.
- D
JSON.parse()automatically guarantees that every property has the type the application expects.
A form supplies quantity = "10" and price = "5" as strings. Explain how you would safely prepare these values for numeric addition in JavaScript, including how you would handle invalid input and why adding the original strings is unsafe.
Which JavaScript data representation is most appropriate for storing the steps of a recipe in their required order?
- A
Set
- B
Array
- C
Map
- D
Object
A form field supplies the string value "5". What does 5 === "5" evaluate to, and why?
- A
true, because both display as 5
- B
true, because JavaScript converts the string automatically
- C
false, because strict equality does not convert the string
- D
false, because numbers cannot be compared with strings
A function must accept either an array or an ordinary object. Which check correctly identifies whether the received value is an array?
- A
typeof value === "array" - B
value instanceof String - C
value === null - D
Array.isArray(value)
True or false: After let word = "cat"; word.toUpperCase();, the value of word is "CAT".
- A
True
- B
False
What JavaScript operator would you use to check whether an object belongs to a constructor's prototype chain, such as whether names is an instance of Array?
A program needs to associate each user object with that user's latest score, using the user object itself as a key. Which JavaScript representation best fits this requirement?
- A
Array, because it always provides the fastest key lookup
- B
Set, because it stores one value for each key
- C
Map, because it stores key-value associations and supports many key types
- D
String, because text is the most flexible representation
A program has a numeric user ID stored in userId and must explicitly convert it to a string before passing it to a text-processing function. Which JavaScript conversion function should it use?
Related study packs and tools
- Quiz
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
- Study guide
03 — Programming Fundamentals: Python Essentials
A progressive guide to Python programming fundamentals, connecting values, expressions, control flow, functions, input, output, and an integrated grade calculator.
- Flashcards
03 — Python Programming Fundamentals
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
- Quiz
3 Conditional Control Flow
A medium-difficulty quiz on Python conditional control flow, including branching, comparison and logical operators, truthiness, short-circuit evaluation, nesting, and common syntax mistakes.
- Study guide
3 CPU Architecture
Learn how registers, the ALU, datapath connections, and control logic work together to fetch and execute CPU instructions.
- Study guide
05 — Data Structures: Concepts, Operations, and Trade-Offs
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
- Quiz
06 — Algorithms and Correctness
A medium-difficulty assessment of algorithm specifications, searching, sorting, iteration, recursion, invariants, termination, and correctness proofs. Questions progress from direct application to integrated reasoning.
- Quiz
6 Interfaces and Abstractions
A medium-difficulty quiz on interfaces, abstractions, abstract classes, polymorphism, dependency direction, dependency injection, and contract design. The quiz includes 12 required candidates and 2 additional alternate candidates.
- Study guide
07 — Efficiency and Computational Complexity
A progressive guide to measuring algorithmic time and memory requirements, interpreting asymptotic bounds, analyzing common code patterns, and balancing performance trade-offs.
- Study guide
07 Trees and Binary Search Trees
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
- Flashcards
08 — Discrete Mathematics for Computer Science
A focused review of propositional logic, quantifiers, sets, relations, functions, and foundational proof methods in discrete mathematics for computer science.
- Study guide
10 — Data, Systems, and Applications
A progression through how data is organized, searched, exposed through software interfaces, and managed through abstraction layers in modern computer systems.