2----key1_07w[1]

2----key1_07w[1] - Exam 1, 1/29/07 PIC 10A, Winter 2007 KEY...

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

View Full Document Right Arrow Icon
Exam 1, 1/29/07 PIC 10A, Winter 2007 KEY Check your TA’s name: _____ Chris _____ Jukka _____ Stephen _____ Joseph _____ Kree _____ Kwai Tsz (Alvin) You have 50 minutes to complete this exam. You are not allowed to use any books, notes, calculators, or electronic devices. Write your answers carefully. Incomplete, unintelligible, or illegible answers will receive little or no credit. When you are asked to write a program, it is not necessary to comment your code but you are expected to indent appropriately to make your code easier to follow. There are a total of 100 points on this exam. PAGE SCORE POSSIBLE 1 18 2 20 3 12 4 25 5 25 TOTAL 100
Background image of page 1

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

View Full DocumentRight Arrow Icon
1.) [6 points] Correct the compile errors in each code segment below. a.) if x = 1 cout << x; if ( x == 1) b.) int a = 5; int double = 2*a; int triple = 3*a; cout << "Doubling 5 gives " << double << " and tripling gives " << triple; Can't use double as variable name. Change it to my_double. c.) int j = 1; while ( j <= 100) cout << j << "\n"; j++; Add braces { } around while loop. 2.) [12 points] For each problem below, write a single cout statement
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.

Page1 / 8

2----key1_07w[1] - Exam 1, 1/29/07 PIC 10A, Winter 2007 KEY...

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