Chapter03-SampleQu879estions

Chapter03-SampleQu879estions - Sample Multiple Choice...

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

View Full Document Right Arrow Icon
BCEE 231 Chapter 3 - Sample questions 1 Sample Multiple Choice Questions – Chapter 3 In Part 1: Consider carefully each question, and select the best answer In Part 2: Write the answer number and its reason or justification. Part 1. Note: Line numbers are added for reference only The situation In relation to the situation at left 1. User-defined functions ONE of the following statements is FALSE. Which one? a) Any function other than main() must be invoked by name for it to be executed. b) As user-defined functions are optional, a program need not have any function. c) Function name must be followed by parentheses which enclose optional function arguments. d) Function arguments must match the type of parameters declared inside the function definition. e) Execution of ‘return’ inside the function body will transfer control back to the calling expression. ____________ f) None of the above 2. Consider the following program: 1. main() 2. { 3. A = HYPOT(3, 4); 4. print(A); 5. } 6. HYPOT( float a, float b) 7. { 8. float L; 9. L = sqrt (a*a+b*b); 10. return L; 11. } When the program executes, ONE of the following statements in relation to the results or program is FALSE. Which one? a) At line 4, ‘A’ is 5. b) At line 8, ‘a’ is 3 and ‘b’ is 4. c) At line 8, ‘L’ is 0 or possibly undefined d) At line 10, ‘L’ is 5 e) At line 4, ‘a’ is 3 and ‘b’ is 4 ____________ f) None of the above 3. Consider the following program: When the program executes, ONE of the
Background image of page 1

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

View Full DocumentRight Arrow Icon
BCEE 231 Chapter 3 - Sample questions 2 1. main () { 2. float a = 1; 3. b = 2; 4. f(a); 5. print (^, a, b, c); 6. } 7. f( float a) 8. { float c; 9. a = 100; b = 200; 10. print (^, a, b, c = a+b); 11. } following statements in relation to the results or program is FALSE. Which one? a) At line 2, ‘a’ is declared to be local in main() b) At line 4, ‘a’ is 1 and ‘b’ is 2 c) At line 5, ‘a’ is 1 and ‘b’ is 2 d) At line 10, ‘c’ is 300 e) At line 5, ‘c’ is undefined ____________ f) None of the above
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/21/2010 for the course ENGR 235 taught by Professor Yy during the Spring '10 term at Concordia Canada.

Page1 / 6

Chapter03-SampleQu879estions - Sample Multiple Choice...

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

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