Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1. which statement(s) is(are) true about using functions in a C program

ID: 3582759 • Letter: Q

Question

Question 1. which statement(s) is(are) true about using functions in a C program?

(a) There is a small execution time overhead in storing program position data and jumping and returning from the function, but this should only be an issue for consideration in the most time critical systems

(b) A function is written once and compiled into one area of memory, irrespective of the number of times that it is called from the main program, so program memory is reduced.

(c) It is possible to ‘nest’ functions within functions, which can sometimes make software challenging to follow.

(d) A limitation of C functions is that only a single value can be returned from the function, and arrays of data cannot be passed to or from a function (only single value variables can be used).

(e) Functions allow clean and manageable code to be designed, allowing software to be well structured and readable at a number of levels of abstraction.

Question 2. which statement(s) is(are) false?

        (a) The pre-processor looks at a particular source file and implements any pre-processor directives and associated header files.

        (b) The extern storage class indicates that a variable or object has previously been defined in another .cpp or .h file, so it does not need redefining again.

        (c) The same header file might be called by a number of source files, but should only be compiled once.

        (d) The ifndef directive allows a variable to be defined and by analyzing whether the variable already exists or not, it can be ensured that the header data is only processed once during compilation.

        (e) Library files are drawn into the compilation process at the debugging stage.

Explanation / Answer

Question 1. which statement(s) is(are) true about using functions in a C program?
(a) There is a small execution time overhead in storing program position data and jumping
   and returning from the function, but this should only be an issue for consideration in the
   most time critical systems. True. When switching between functions, the data and addresses
   should be stored onto the stack, so that the values should be retrieved when moving back
   to the function. Therefore, it takes some time.
(b) A function is written once and compiled into one area of memory, irrespective of the
   number of times that it is called from the main program, so program memory is reduced. True.
(c) It is possible to ‘nest’ functions within functions, which can sometimes make software
   challenging to follow. True.
(d) A limitation of C functions is that only a single value can be returned from the
   function, and arrays of data cannot be passed to or from a function (only single value
   variables can be used). False. Ofcourse C functions can only return a single value. But
   arrays of data can be passed to a function as input.
(e) Functions allow clean and manageable code to be designed, allowing software to be well
   structured and readable at a number of levels of abstraction. True.
Therefore, the answer is: (a), (b), (c), and (e).  

Question 2. which statement(s) is(are) false?
(a) The pre-processor looks at a particular source file and implements any
   pre-processor directives and associated header files.   True.
(b) The extern storage class indicates that a variable or object has previously been
   defined in another .cpp or .h file, so it does not need redefining again. True.
   An extern variable will be declared in each and every program, but need not be
   defined in every program.
(c) The same header file might be called by a number of source files, but should
   only be compiled once. False. Every time a header is called in a source file,
   it will be pre-processed and included in the code of the file from which it has
   been called.
(d) The ifndef directive allows a variable to be defined and by analyzing whether
   the variable already exists or not, it can be ensured that the header data is
   only processed once during compilation. True. The ifndef is used to conditionally
   define a block.
(e) Library files are drawn into the compilation process at the debugging stage.
   False. Library files are included in the pre-processing stage itself, and not
   in the debugging stage.
Therefore, the answer is: (c), and (e).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote