Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
Define a pure function in your own words.
Think about predictability and side effects.
Give one example of a pure function.
Consider a function like `int add(int a, int b) { return a + b; }`.
What defines a pure function?
Focus on consistency of output.
True or False: An impure function can change a global variable.
Think about the nature of impure functions.
Write a programming function that checks whether a number is even or odd and explain if it is a pure or impure function.
Consider how the function interacts with external variables.
Create a function that generates a random number. Determine if it's pure or impure, and explain your reasoning.
Reflect on the consistency of output regarding inputs.
6 more questions in this section. Enroll free to practise them all.
Enroll free