Which of the following is true in any C program?a)must contain at lea...
Any C program contains at least one function. If a program contains only one function, it must be main(). If a C program contains more than one function, then one (and only one) of these functions must be main(), because program execution always begins with main().
Which of the following is true in any C program?a)must contain at lea...
In any C program, it is true that it must contain at least one function. Let's break down the options and explain why option A is the correct answer.
a) Must contain at least one function:
- In C programming, a function is a block of code that performs a specific task. It is a fundamental building block of any program.
- Without functions, a C program cannot perform any meaningful operations or tasks. Functions are essential for code organization, reusability, and modularity.
- Therefore, every C program must contain at least one function to accomplish something useful.
b) Need not contain any function:
- This statement is incorrect because, as mentioned above, functions are necessary in C programming.
- Without functions, a C program would be incomplete and non-functional.
c) Needs input data:
- While most programs require input data to perform operations, it is not a mandatory requirement for every C program.
- There can be C programs that do not rely on user input or external data sources. For example, a program that performs a series of predefined calculations or generates random numbers does not necessarily need input data.
d) Both (a) and (b):
- This option is incorrect because option (b) is incorrect. As discussed earlier, a C program must contain at least one function.
In conclusion, the correct answer is option 'A' - a C program must contain at least one function. Functions are essential for the functionality and structure of a C program.