InterviewStack.io LogoInterviewStack.io

Programming Fundamentals and Code Quality Questions

Encompasses core programming skills, data structures, basic algorithms, language fundamentals, and code quality practices. Expect proficiency with arrays, strings, lists, hash maps or dictionaries, sets, common collection operations, basic sorting and searching algorithms, and tradeoffs between data structures. Understand control flow, functions and modular design, classes and object oriented programming concepts including encapsulation, inheritance, and polymorphism, exception handling, file input and output, and common language idioms for mainstream interview languages such as Python, Java, and C plus plus. Emphasizes writing clean, readable, maintainable code: meaningful naming, modular functions, small interfaces, handling edge cases and errors, logging and documentation, simple testing and debugging strategies, and awareness of time and space complexity for common operations. Candidates should be able to implement correct solutions, follow language specific idioms where appropriate, and demonstrate attention to code quality and readability.

EasyTechnical
0 practiced
Summarize common sorting algorithms such as Timsort, quicksort, mergesort, and heapsort with their average and worst-case complexities, stability properties, and when you would prefer each when sorting dataset indices, timestamps, or small feature arrays in ML code.
MediumTechnical
0 practiced
Explain race conditions and deadlocks with concrete code examples using Java synchronized blocks. Describe strategies to avoid deadlocks such as consistent lock ordering, timeouts, deadlock detection, and alternatives like lock-free data structures.
HardTechnical
0 practiced
Implement a deterministic random sampler in Python that supports sharding across W workers and K samples per epoch per worker. Given a global seed and epoch number the sampler must produce disjoint deterministic subsets for each worker even when dataset size is not divisible by W. Explain your seeding and mapping approach.
MediumSystem Design
0 practiced
Design and implement a Python generator `data_loader(shards, batch_size, seed, shuffle=True)` that yields minibatches from multiple shard files on disk. Requirements: deterministic shuffling given seed across epochs, minimal memory footprint, support for variable-size shards, and reproducible behavior across process restarts. Provide concise sample code and explain choices.
HardTechnical
0 practiced
Review and refactor the following training snippet to eliminate global mutable state and make behavior deterministic and testable: `SEED = 42; def train(model, data): random.seed(SEED); model.to(global_device); for batch in data: out = model(batch); loss = compute_loss(out); loss.backward(); optimizer.step()` Describe your refactor and provide a pure functional-style interface for train.

Unlock Full Question Bank

Get access to hundreds of Programming Fundamentals and Code Quality interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.