Midterm 3 - The University of British Columbia APSC 160:...

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

View Full Document Right Arrow Icon
The University of British Columbia APSC 160: Introduction to Computation in Engineering Design Midterm Examination, February 27, 2006. Examiner: E.M. Knorr Time: 75 minutes Total marks: 60 Last Name First Name: Student ID # (PRINT) Signature Lab Section: The examination has 9 pages, and that includes this cover sheet. Check that you have a complete paper. Fill in your name, ID, signature, and lab section above. To save time, you don’t have to write your name on each page since the pages have serial numbers on them. This is a closed book examination. No books, help sheets, calculators, cell phones, or other materials may be used. Work quickly and do the easy questions first . Part marks will be awarded for most questions. The marks for each question are given in braces. Use this to manage your time. Please write down any reasonable assumptions that you are making, if you believe that a question is ambiguous . To minimize disruptions during the exam, please avoid asking the invigilators for hints or for more information. Please ask only if you truly believe that a question is in error. Marks Page Max. Achieved 2 10 3 7 4 7 5 8 6-8 20 9 8 Total 60
Background image of page 1

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

View Full DocumentRight Arrow Icon
Page 2 {10 marks} Multiple choice questions. Circle the best answer for each question. 1. The decimal number 56 is converted to which of the following numbers in binary? a) 101110 b) 111000 c) 110100 d) 110110 e) none of the above 2. How many times is the following loop executed? for (k=2; k >= -10; k--) { /* statements */ } a) 0 b) 2 c) 12 d) 13 e) an infinite number of times (because it’s an infinite loop) 3. Which of the following “if” statements has its boolean expression evaluate to true only if the mass of an object is between 4.0 and 16.0 grams, inclusive? ( mass is a double-precision variable) a) if (4.0 <= mass 16.0 <= mass) b) if (mass >= 4.0 || mass <= 16.0) c) if ( (mass == 4.0 || mass > 4.0) (mass == 16.0 || mass > 16.0) ) d) if (4.0 <= mass <= 16.0) e) none of the above 4. Which of the following is not an advantage of using user-defined functions to construct a small software application? Choose the best answer. a) the program is usually shorter b) the program is usually more readable c) the program usually executes faster d) the program is usually easier to test e) the program is usually easier to debug 5. What is the purpose of the break statement? a) it lets the CPU take a break, by pausing until the user presses any key to continue b) it causes the program to end immediately c) it exits from the current loop and executes the next statement after the loop d) it returns from the function that the user is currently in e) all of the above are true, depending on where the break statement is located
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 02/03/2010 for the course APSC APSC 160 taught by Professor Jeremyhiliker during the Fall '08 term at The University of British Columbia.

Page1 / 9

Midterm 3 - The University of British Columbia APSC 160:...

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