Exam-style question
Try this first
What is the main purpose of a function in programming?.
- A.To perform a task without returning a value
- B.To perform a task and return a value
- C.To store data temporarily
- D.To define a variable
Answer and explanation
Concise answer
To perform a task and return a value
Why this is correct
Functions are designed to execute a specific task and provide a result back to the caller.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
