There are inbuilt functions for creating arrays filled with a single number.
You need a 3x4 matrix filled with zeros for a linear algebra homework problem. How would you create it, and what would the dtype be if you don't specify one?
A teammate wrote np.zeros([2, 3]) and got a warning. What's the issue and how do you fix it?
You're initializing weights for a tiny neural network layer (5 inputs, 3 outputs). Show me the one-liner to create a zero matrix of the right shape.
You're debugging a memory spike in a data pipeline. The line np.zeros((10000, 10000)) runs fine locally but OOMs in production. What's likely happening and how would you fix it?
When would you choose np.zeros_like(existing_array) over np.zeros(existing_array.shape)? Walk me through a real case where the difference mattered.
You're building a preprocessing step that needs a float32 zero buffer matching an input image's shape. The input might be (H, W) or (H, W, 3). Write the initialization that handles both without branching.
Your team maintains a computer vision library. You need a consistent pattern for initializing output arrays across 50+ functions — some need zeros, some ones, some uninitialized. How would you design this API to prevent bugs and allow future optimization?
A hot path in your inference engine calls np.zeros((batch_size, 512, 512), dtype=np.float16) millions of times. Profiling shows allocation overhead. What strategies would you evaluate to reduce this, and what tradeoffs does each introduce?
You're integrating a C++ library that expects row-major buffers. A junior dev used np.zeros((h, w), order='F') and caused silent corruption. How would you catch this class of bug at the API boundary?
Your org is migrating from a legacy custom tensor library to NumPy/PyTorch. The old library had lazy initialization (alloc on first write). Some teams depend on this for sparse workflows. How do you evaluate whether to replicate this behavior, polyfill it, or refactor the dependent code?
You're setting coding standards for array initialization across a 200-person ML platform team. The current codebase has inconsistent dtype defaults, mixed order parameters, and no linting. Propose a governance approach that balances consistency with team autonomy and doesn't block releases.
A critical production model shows non-deterministic outputs traced to uninitialized memory in a custom CUDA op that wraps np.empty. The fix requires changing initialization semantics across the stack. How do you roll this out safely with zero downtime and rollback capability?