65 questions for “Functions & Scope”

Found in 1 field. Select a question to see its full answer.

Information Technology

65 questions in 2 technologies

#QuestionTechnologyTopicLevel
1What is variable scope in PHP, and why can't a function normally access a variable defined outside of it? PHP › Functions & ScopePHPFunctions & ScopeBeginner
2How does recursion work in PHP functions, and what are the practical considerations, such as stack depth limits, when writing a recursive function? PHP › Functions & ScopePHPFunctions & ScopeAdvanced
3What does it mean that functions are 'first-class objects' in Python? Python › Functions & ScopePythonFunctions & ScopeBeginner
4What is Python's LEGB rule for variable scope resolution, and what does each letter stand for? Python › Functions & ScopePythonFunctions & ScopeIntermediate
5How does the 'nonlocal' keyword let a nested function modify a variable in its ENCLOSING (not global) scope? Python › Functions & ScopePythonFunctions & ScopeIntermediate
6What are default parameter values and variadic functions in PHP, and how do they add flexibility to how a function can be called? PHP › Functions & ScopePHPFunctions & ScopeIntermediate
7How does a closure capture variables from its enclosing scope, and what pitfall occurs when creating multiple closures inside a loop? Python › Functions & ScopePythonFunctions & ScopeAdvanced
8How do you define and call a basic function in PHP, and what are function parameters and return values? PHP › Functions & ScopePHPFunctions & ScopeBeginner
9What is the difference between positional arguments and keyword arguments when calling a function? Python › Functions & ScopePythonFunctions & ScopeBeginner
10How do default parameter values work, and when are they evaluated? Python › Functions & ScopePythonFunctions & ScopeBeginner