Functions and parameters flashcards
Learn about functions and parameters in programming with these flashcards and quizzes.
Quiz(15 preguntas)
1. What is the purpose of a function?
Términos en este set(21)
What is a function?
A block of code that performs a specific task.
Define parameters.
Variables used to pass information into functions.
Difference between arguments and parameters?
Parameters are placeholders; arguments are actual values passed.
True or false: Functions can return values.
True, because functions can send back results to the caller.
What is a return statement?
Used to end a function and send a value back to its caller.
Fill in the blank: A function must be ______ before it can be called.
defined
What are local variables?
Variables defined within a function, inaccessible outside of it.
True or false: Functions can modify global variables.
True, if declared global inside the function.
What is a function signature?
The combination of a function's name and its parameters.
Define a void function.
A function that does not return a value.
Question: Can a function call itself?
Yes, this is known as recursion.
Difference between built-in and user-defined functions?
Built-in functions are provided by the programming language; user-defined are created by developers.
Give an example of a function call.
myFunction(arg1, arg2);
True or false: Functions can take multiple parameters.
True, functions can accept as many parameters as needed.
What is scope in programming?
The context in which variables can be accessed.
What does it mean to 'call' a function?
To execute the code contained within the function.
Fill in the blank: A function can be called ______ times.
multiple
What do you use to define a function in Python?
The 'def' keyword.
What is an anonymous function?
A function that is defined without a name, often used for short tasks.
How to pass default parameters?
By assigning a default value in the function definition.
True or false: Parameters can have different types.
True, parameters can be of various data types.
Preguntas en este set(15)
1. What is the purpose of a function?
2. Which of the following is NOT a type of function?
3. What keyword is used to define a function in JavaScript?
4. What does a return statement do?
5. What is the scope of a local variable?
6. Which of the following describes recursion?
7. What will happen if a function has no return statement?
8. What are default parameters?
9. What is a common use of lambda functions?
10. Which statement about parameters is correct?
11. What happens if you try to use a local variable outside its function?
12. How can you modify a global variable inside a function?
13. What is an argument in the context of functions?
14. Which of the following is a benefit of using functions?
15. What will happen if you skip giving an argument for a parameter with no default value?
Sets relacionados
Abitur Rekursion
Abitur: Abitur Klassen und Objekte
Wiederholung: Abitur Sortierverfahren
Was ist ein Algorithmus Schritt für Schritt
if und Schleifen Notizen
Test: Binärzahlen
Wiederholung: Funktionen
Schleife Alltag Beispiel Begriffe
Crea tu propio set de estudio
Sube un PDF, pega tus notas o describe un tema – la IA genera tarjetas, quizzes y más en segundos.

