Python Software Developer Interview Questions

355 python software developer interview questions shared by candidates

Design a data structure that supports the following operations in O(1) time: get(index: int) -> int: Retrieve the value at the specified index. set(index: int, value: int): Update the value at the specified index. set_all(value: int): Set all elements in the data structure to the specified value. Requirements: The data structure should be initialized with a fixed size, and all elements should initially be set to 0. If set_all is called, subsequent get operations should return the globally set value unless the specific index has been updated after the set_all operation. d = DataStructure(1000) print(d.get(950)) # Output: 0 d.set(930, 5) print(d.get(930)) # Output: 5 d.set_all(8) print(d.get(950)) # Output: 8 print(d.get(930)) # Output: 8 d.set(910, 7) print(d.get(910)) # Output: 7 print(d.get(10)) # Output: 8
avatar

Python Software Engineer

Interviewed at Varonis Systems

4
May 13, 2025

Design a data structure that supports the following operations in O(1) time: get(index: int) -> int: Retrieve the value at the specified index. set(index: int, value: int): Update the value at the specified index. set_all(value: int): Set all elements in the data structure to the specified value. Requirements: The data structure should be initialized with a fixed size, and all elements should initially be set to 0. If set_all is called, subsequent get operations should return the globally set value unless the specific index has been updated after the set_all operation. d = DataStructure(1000) print(d.get(950)) # Output: 0 d.set(930, 5) print(d.get(930)) # Output: 5 d.set_all(8) print(d.get(950)) # Output: 8 print(d.get(930)) # Output: 8 d.set(910, 7) print(d.get(910)) # Output: 7 print(d.get(10)) # Output: 8

Viewing 1 - 10 interview questions

Glassdoor has 355 interview questions and reports from Python software developer interviews. Prepare for your interview. Get hired. Love your job.