2009 - APSC 160: SAMPLE MIDTERM EXAMINATION Please note:...

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

View Full Document Right Arrow Icon
APSC 160: SAMPLE MIDTERM EXAMINATION Please note: This sample exam is based on the midterm exam given in 09W1. The time limit for this exam was 75 minutes but your exam may be longer (or possibly shorter). Exams in this course are closed book: no notes or textbooks. Calculators are not allowed. The order in which material was taught this term is different from last term. Last term, file input/output had not been covered by the midterm exam but you can expect this topic to appear on your exam. You should treat this exam as a sample only. Although it is representative of the kinds of questions that can be asked, you should not expect that your exam will have the same number of questions or ask questions on exactly the same topics. Solutions to this exam will be posted after the reading break. Don't even think about looking at them until you have tried to write this exam yourself under exam conditions. Only then can you know how much work you need to do to prepare yourself for the midterm. This exam will look deceptively easy if you allow yourself to refer to notes, the textbook or sample programs while you are writing it. Many people lost marks on this exam because they did not read the question carefully. Your goal is to write code that is correct and that follows all the guidelines presented throughout the course.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Section 1: Multiple Choice For each of the multiple choice questions below, circle the letter corresponding to the one right answer. [2] Q1A. Consider the following code segment: if( num1 < 2 || num2 > 7 ) printf( "A" ); if( num2 > 9 ) printf( "B" ); else printf( "C" ); What is printed on the screen when this code segment runs assuming that num1 and num2 are variables of type int and that num1 has the value 4 and num2 has the value 8? a) B b) C c) A d) AB e) AC [3] Q1B. Consider the following code segment: int count = 1; int sum = 0; while( count < 6 && sum < 7 ) { sum += count; count++; } printf( "sum = %d, count = %d\n", sum, count ); What is printed on the screen when this code segment runs?
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 03/18/2010 for the course APSC APSC 160 taught by Professor Jeremyhiliker during the Fall '08 term at The University of British Columbia.

Page1 / 10

2009 - APSC 160: SAMPLE MIDTERM EXAMINATION Please note:...

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