chtp5_05-TIF-Beta - 5.1Introduction 5.2ProgramModulesinC...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
5.1  Introduction 5.2  Program Modules in C  5.1 All of the following are true of functions except: (a) they define specific tasks that can be used at many points in a program (b) a function call must specify the name and arguments of the function (c) the definition of a function is always visible to other functions (d) the implementation of a function is hidden from the caller ANS: (c) 5.2. Experience has shown that the best way to construct a program is from small pieces. This is called __________. a) bottom up b) the whole is greater than the sum of the parts c) divide and conquer d) recursion ANS: (c) 5.3. Which is not an ANSI standard library function a) printf b) main c) scanf d) pow ANS: (b) 5.4. Which one item is most different from the other three? a) worker function b) caller c) calling function d) boss function ANS: (a) 5.5. When a called function completes its task, it normally a) terminates program execution normally b) aborts program execution c) logs its results d) returns to the calling function ANS: (d)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5.6. Which statement is true? a) The boss function normally knows how the worker function performs its designated tas ks. b) A worker function may not call other worker functions. c) “Hiding” of implementation details makes it difficult to understand software. d) The boss function is normally unaware when a worker function calls a function. ANS: (d) 5.7. Functions are __________ by a function call. a) inveigled b) invoked c) internalized d) inverted ANS: (b) 5.3  Math Library Functions 5.8 All math library functions return the data type (a) long double (b) int (c) float (d) double ANS: (d) 5.9. All functions in the math library return the data type __________. a) float b) int c) long d) double ANS: (d) 5.10. What happens when you do not include math.h when using functions in the math library? a) compilation error b) execution error c) logic error d) strange results may occur ANS: (d) 5.11. If a = 7.0 , b = 7.0 and c = 6.0 , then what is printed by printf( “%.2f”, sqrt( a + b * c ) );
Background image of page 2
a) 49 b) 7.00 c) 7 d) 49.00 ANS: (b) 5.12. What is the value of fabs( -5.0 ) ? a) 5 b) 5.0 c) -5 d) –5.0 ANS: (b) 5.4  Functions 5.13 Which of the following is not included in <math.h> ? (a) pow (b) floor (c) ln (d) log10 ANS: (c) 5.14 A valid reason for building programs out of functions is (a) that the divide-and-conquer approach facilitates program construction (b) that pre-existing functions can be used to create new programs (c) the avoidance of code repetition within a program (d) all of the above ANS: (d) 5.15. Which is not a motivation for “functionalizing” a program? a) The divide-and-conquer approach makes program development more manageable. b) Software reusability—using existing building blocks to create new programs.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 14

chtp5_05-TIF-Beta - 5.1Introduction 5.2ProgramModulesinC...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online