InterviewStack.io LogoInterviewStack.io

Basic Data Structures (Objects, Maps, Sets) Questions

Understand how objects work in JavaScript including prototypal inheritance and property descriptors. Know when to use Maps vs Objects and Sets vs Arrays. Understand the performance characteristics of different data structures. Be comfortable with nested data structures and how to manipulate them efficiently.

HardTechnical
0 practiced
Modifying Object.prototype or other global prototypes can introduce security and correctness issues. Explain prototype pollution attacks and why modifying prototypes is dangerous in a multi-tenant ML inference service. Provide safe alternatives (Object.create(null), defensive copying, deep validation), and code patterns to safely merge untrusted input into internal objects.
MediumTechnical
0 practiced
Explain how JavaScript determines equality for objects (reference equality) and the implications for using objects in Set/Map. Describe approaches to implement content-based equality or hashing for complex feature objects (e.g., canonical serialization + hash, structural hashing) and discuss collision handling strategies and performance trade-offs.
HardTechnical
0 practiced
Implement serialize(obj) and deserialize(str) in JavaScript that preserve Map and Set types within nested structures. Your serializer should convert Maps and Sets into JSON in a way that can be reversed by deserialize into original types. Do not handle functions; throw on circular references. Provide example round-trip behavior for nested containers.
EasyTechnical
0 practiced
Property descriptors allow fine-grained control over object properties in JavaScript. As an ML engineer, how would you use property descriptors to create read-only feature metadata fields in a feature config object? Explain configurable/enumerable/writable/get/set and provide a short code sample showing how to make a 'featureName' property read-only while keeping other properties writable.
MediumTechnical
0 practiced
Using modern JavaScript (ES6+), demonstrate destructuring to extract the first three features from a potentially nested batch payload. Provide a code snippet that safely extracts f1, f2, f3 defaulting to 0 if missing and works when features are in an array at data.features or at data.payload.features. Show examples for both paths.

Unlock Full Question Bank

Get access to hundreds of Basic Data Structures (Objects, Maps, Sets) interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.