Programming Concepts

Check your understanding - Functions

A function is a named collection of lines of code that can be 'called' (reused) whenever needed in a program. Which of the following statements is FALSE?

TRUE. If functions are named to make it clear what they do, then it is easier to get an overview of what the program is doing.
TRUE. If the same actions are repeated many times in a program, then you should create a function to carry out those actions and use the function when needed. If there is an error in the actions, you only need to correct it once - in the function.
TRUE. In most programming languages you can create libraries of functions which you can reuse in other programs.
TRUE in principle as there is extra overhead involved by the computer making use of the function. In practice some programming languages can optimise function use so that this effect is negligible. Even if function use did result in marginally slower programs, the benefits outweigh this.
FALSE. Functions make your code more compact (and easier to read).
← Previous 1 2 3 4 5 6 7 8 9 10 11 12 Next →