Quizzma Latest Questions

Why do we write functions

Why do we write functions?
I. Make our code easier to understand by giving a readable name to a group of instructions
II. Avoid writing repeated code
III. Make our code reusable

II and III
I only
I and II
I, II, and III




Leave an answer

Leave an answer

1 Answer

  1. The correct answer is: I, II, and III.

    Explanation: We write functions for several reasons:

    I. Functions provide a readable name to a group of instructions, which helps in understanding the code better.

    II. They help avoid writing repeated code, as the same function can be called multiple times without rewriting the code.

    III. Functions enhance code reusability, allowing developers to use the same logic in different parts of a program or across different projects.

    All of these points make functions an essential part of programming.

Related Questions