All fields

“Debugging & Profiling” in Information Technology

58 questions across 3 technologies.

Information Technology

58 questions in 3 technologies

#QuestionTechnologyTopicLevel
1How do you use print statements effectively for debugging, including showing variable names alongside values? Python › Debugging & ProfilingPythonDebugging & ProfilingBeginner
2How do assert statements work for debugging, and why should they NOT be relied upon for production input validation? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
3How do you use Python's built-in 'warnings' module to surface deprecated or risky code paths during debugging? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
4How do you use pdb's post-mortem debugging mode to inspect a program's state exactly at the point where an unhandled exception occurred? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
5How do you use the timeit module to accurately measure a small code snippet's execution time? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
6How do you use cProfile to identify which functions are consuming the most time in a larger program? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
7How would you use the 'faulthandler' module to diagnose a program that crashes with a segmentation fault, typically from a C extension? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
8How would you use line_profiler (a third-party tool) to get LINE-BY-LINE timing information within a specific function, more granular than cProfile's function-level data? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
9How would you use py-spy (a sampling profiler) to profile a running Python process in PRODUCTION without restarting it or adding any code changes? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
10How do you use the built-in pdb debugger to pause execution at a specific line? Python › Debugging & ProfilingPythonDebugging & ProfilingBeginner
11How do you use the traceback module to capture and format a full exception traceback as a string, useful for logging? Python › Debugging & ProfilingPythonDebugging & ProfilingIntermediate
12How do you use memory_profiler (or tracemalloc from the standard library) to identify a memory leak's source in a Python application? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
13How would you use the 'logging' module's exception logging (logger.exception()) INSIDE an except block to automatically capture the full traceback? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
14How would you profile memory allocations specifically (not just CPU time) to find which objects are consuming the most memory in a running process? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
15How do you use conditional breakpoints in pdb to pause execution only when a specific condition is met, avoiding manually stepping through many unrelated iterations? Python › Debugging & ProfilingPythonDebugging & ProfilingAdvanced
16How does __repr__ help with debugging when printing a list of custom objects? Python › Magic Methods & Operator OverloadingPythonMagic Methods & Operator OverloadingBeginner
17How would you generate and interpret a CPU profile for a Node.js application using the built-in --prof flag? Node.js › Performance Optimization & ProfilingNode.jsPerformance Optimization & ProfilingIntermediate
18How would you use the 'clinic.js' toolset (clinic doctor, clinic flame) to diagnose a Node.js performance problem? Node.js › Debugging & DiagnosticsNode.jsDebugging & DiagnosticsAdvanced
19Why is a bare 'except:' clause (catching everything with no type specified) generally discouraged? Python › Exception HandlingPythonException HandlingBeginner
20Why should you use the logging module instead of print() for diagnostic output? Python › LoggingPythonLoggingBeginner
21What are Python's five standard logging severity levels, from lowest to highest? Python › LoggingPythonLoggingBeginner
22How do you format log output to include the timestamp, logger name, level, and message? Python › LoggingPythonLoggingBeginner
23What is the difference between __str__ and __repr__? Python › Magic Methods & Operator OverloadingPythonMagic Methods & Operator OverloadingBeginner
24What does it mean that Python has 'automatic' memory management, and what's the trade-off compared to manual memory management in languages like C? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionBeginner
25What is a race condition, and how does it differ from a deadlock? Python › Concurrency (asyncio/threading/multiprocessing)PythonConcurrency (asyncio/threading/multiprocessing)Intermediate
26What is the difference between 'raise' and 'raise ... from ...' for exception chaining? Python › Exception HandlingPythonException HandlingIntermediate
27How do you access details about the exception currently being handled, like its type, value, and traceback, using sys.exc_info()? Python › Exception HandlingPythonException HandlingIntermediate
28How does the 'else' clause on a try statement work, and what's its purpose compared to just putting that code at the end of 'try'? Python › Exception HandlingPythonException HandlingIntermediate
29What is the relationship between Logger, Handler, Formatter, and Filter in the logging module? Python › LoggingPythonLoggingIntermediate
30What's the danger of using %-style, f-string, or .format() interpolation directly in a log call's message argument versus lazy % substitution? Python › LoggingPythonLoggingIntermediate
31How does Python's generational garbage collector work, and why generations? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
32What is the sys.getsizeof() function, and what are its limitations for measuring memory usage? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
33How does the gc module let you inspect and debug memory leaks caused by uncollectable objects? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
34How do mutable default arguments create a subtle memory and correctness pitfall related to object lifetime? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
35How does the tracemalloc module help track where memory is being allocated in a running program? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionIntermediate
36How do you troubleshoot a CORS error reported in browser developer tools, and what does the error message typically indicate? .NET › CORS & Cross-Origin Resource Sharing.NETCORS & Cross-Origin Resource SharingIntermediate
37What is the purpose of setting explicit CPU and memory resource requests and limits for a Node.js container in Kubernetes? Node.js › Docker & DeploymentNode.jsDocker & DeploymentIntermediate
38How would you measure how 'busy' the event loop is in a running Node.js process using a simple technique? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOIntermediate
39What is an APM (Application Performance Monitoring) tool, and what capabilities does it typically add beyond basic logging? Node.js › Logging & MonitoringNode.jsLogging & MonitoringIntermediate
40How would you profile whether a generator expression is actually providing a measurable memory or performance benefit over a list comprehension in a specific use case? Python › Comprehensions & GeneratorsPythonComprehensions & GeneratorsAdvanced
41How would you choose between a list, a set, a dict, and a specialized structure like heapq for efficiently finding the K smallest/largest elements in a large dataset? Python › Data Types & StructuresPythonData Types & StructuresAdvanced
42How do you implement a descriptor-based ORM-style field that lazily loads related data only when actually accessed? Python › Descriptors & PropertiesPythonDescriptors & PropertiesAdvanced
43How does exception performance (raising/catching) compare to normal control flow, and why does Python's EAFP style still encourage using exceptions for routine control flow, unlike some other languages? Python › Exception HandlingPythonException HandlingAdvanced
44How do you correctly handle character encoding when reading text files that might not be UTF-8, and what error occurs if you guess wrong? Python › File I/O & Context ManagersPythonFile I/O & Context ManagersAdvanced
45Why is using a mutable default argument (like an empty list) a classic Python bug, and how do you avoid it? Python › Functions & ScopePythonFunctions & ScopeAdvanced
46How do you clear or inspect the cache of an lru_cache-decorated function? Python › functools & Functional Programming ToolsPythonfunctools & Functional Programming ToolsAdvanced
47How does itertools.groupby depend on input order, and what's a common mistake when using it? Python › Iterators & the Iterator ProtocolPythonIterators & the Iterator ProtocolAdvanced
48How does logger.exception() differ from logger.error(), and when should you use it? Python › LoggingPythonLoggingAdvanced
49How would you write a custom logging.Filter to redact sensitive data like passwords from log messages? Python › LoggingPythonLoggingAdvanced
50How does object interning (like small integer caching and string interning) affect memory and identity comparisons? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionAdvanced
51What is memory fragmentation in the context of Python's object allocator, and how does pymalloc address it for small objects? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionAdvanced
52How do circular references between objects with __del__ methods behave differently in Python 3.4+ compared to earlier versions? Python › Memory Management & Garbage CollectionPythonMemory Management & Garbage CollectionAdvanced
53How does Python locate modules during import, and what is sys.path's role? Python › Modules & PackagingPythonModules & PackagingAdvanced
54Why does Python sometimes raise 'TypeError: Cannot create a consistent method resolution order'? Python › Multiple Inheritance & MROPythonMultiple Inheritance & MROAdvanced
55How do you use the --inspect flag and Chrome DevTools to profile a running Node.js application in production? Node.js › Advanced Node.jsNode.jsAdvanced Node.jsAdvanced
56What does the node:perf_hooks module provide, and how would you use it to measure precise execution time of a code block? Node.js › Core Node.js ModulesNode.jsCore Node.js ModulesAdvanced
57What is 'event loop lag' (or 'event loop delay'), and how would you monitor it in a production Node.js application? Node.js › Event Loop & Non-blocking IONode.jsEvent Loop & Non-blocking IOAdvanced
58How would you implement conditional middleware in Express that only applies to certain requests based on a runtime condition? Node.js › Express & MiddlewareNode.jsExpress & MiddlewareAdvanced