All fields

“Closures” in Information Technology

25 questions across 4 technologies.

Information Technology

25 questions in 4 technologies

#QuestionTechnologyTopicLevel
1What are arrow functions introduced in PHP 7.4, and how do they simplify writing short closures compared to traditional anonymous functions? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsIntermediate
2How can closures be used to implement simple dependency injection or callback based customization within a class? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsIntermediate
3How do closures unintentionally keep large objects alive longer than expected? JavaScript › Memory Management & Garbage CollectionJavaScriptMemory Management & Garbage CollectionIntermediate
4How does variable capture (closures) work in a C# lambda expression, and what pitfall occurs when capturing a loop variable? C# › Delegates, Events & LambdasC#Delegates, Events & LambdasIntermediate
5How do you implement a debounce function using closures, and how is it a functional programming technique? JavaScript › Functional ProgrammingJavaScriptFunctional ProgrammingAdvanced
6How does a closure capture variables from its enclosing scope, and what pitfall occurs when creating multiple closures inside a loop? Python › Functions & ScopePythonFunctions & ScopeAdvanced
7What is an anonymous function in PHP, and how does it differ from a regular named function? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsBeginner
8What is the use keyword in a PHP closure, and why is it needed to access outside variables from within an anonymous function? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsBeginner
9How does passing a variable by reference into a closure's use clause differ from the default pass by value behavior? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsIntermediate
10How does binding a closure to a specific object or class using bindTo or Closure::bind allow it to access private properties and methods it otherwise could not? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsAdvanced
11How do first class callable syntax and higher order functions in modern PHP support building flexible, composable, functional style code? PHP › Closures & Anonymous FunctionsPHPClosures & Anonymous FunctionsAdvanced
12What is the Module pattern and what problem does it solve? JavaScript › Design Patterns in JavaScriptJavaScriptDesign Patterns in JavaScriptBeginner
13What is a higher-order function? JavaScript › Functional ProgrammingJavaScriptFunctional ProgrammingBeginner
14What is the functools module used for in Python? Python › functools & Functional Programming ToolsPythonfunctools & Functional Programming ToolsBeginner
15How do you use functools.partial to fix keyword arguments for logging or callback functions? Python › functools & Functional Programming ToolsPythonfunctools & Functional Programming ToolsBeginner
16What is ReactPHP and how does its event loop enable non blocking, asynchronous behavior in standard PHP? PHP › Asynchronous PHP (ReactPHP & Swoole)PHPAsynchronous PHP (ReactPHP & Swoole)Beginner
17How do you define and call a basic function in PHP, and what are function parameters and return values? PHP › Functions & ScopePHPFunctions & ScopeBeginner
18What is variable scope in PHP, and why can't a function normally access a variable defined outside of it? PHP › Functions & ScopePHPFunctions & ScopeBeginner
19Why are ES Module imports 'hoisted' and evaluated before the rest of the module's code runs? JavaScript › ES ModulesJavaScriptES ModulesIntermediate
20What is currying and what problem does it solve? JavaScript › Functional ProgrammingJavaScriptFunctional ProgrammingIntermediate
21How does yield pause and resume execution, and what does it return to the caller? JavaScript › Iterators & GeneratorsJavaScriptIterators & GeneratorsIntermediate
22How do array_map, array_filter, and array_reduce help you transform and process array data without writing manual loops? PHP › Arrays in PHPPHPArrays in PHPIntermediate
23How can a generator receive values sent into it during iteration using the send method, enabling two way communication with the calling code? PHP › Generators & IteratorsPHPGenerators & IteratorsIntermediate
24What does the __invoke magic method do, and how does it let you use an object instance directly as if it were a function? PHP › Magic MethodsPHPMagic MethodsIntermediate
25What does 'live binding' mean for ES Module exports, and how does it differ from CommonJS? JavaScript › ES ModulesJavaScriptES ModulesAdvanced