final_S11_V3

final_S11_V3 - University of Waterloo Final Examination...

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

View Full Document Right Arrow Icon
Term: Spring Year: 2011 Student Name: ______________________________________________________________________ UW Student ID Number: ______________________________________________________________ I understand that the contents of this exam paper are to remain confidential until Friday July 5, 2011. Failure to do so constitutes an academic offence under UW Policy 71. Signature: __________________________________________________________________________ Course Abbreviation and Number GEN E 121 (ME C++/RobotC) Course Title Digital Computation Section(s) 001 Instructor Ryan Norris Date of Exam Saturday, August 6, 2010 Time Period Start time: 12:30pm End time: 3:00pm Duration of Exam 2.5 hours Allowed Materials: Writing instruments ONE (8.5x11) formula sheet written on BOTH sides Disallowed Materials No electronic devices of ANY kind. No hats or containers such as purses, pencil cases, packsacks Notes: Questions are to be answered using C++ except where indicated as RobotC using You can assume for any programs that any necessary libraries (eg. #include <iostream> ) have been included. All questions will be marked for credit. If you need to make any assumptions to formulate your solution, state your assumptions clearly. Question Maximum Mark Mark 1. 12 2. 10 3. 10 4. 18 5. 25 6. 25 Total 100 University of Waterloo Final Examination
Background image of page 1

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

View Full DocumentRight Arrow Icon
Spring 2011 GenE 121 (C++/RobotC) Midterm Page 2 of 12 1. Short Answer [12 Marks Total] a. [3 Marks] Complete the statements below i. double a[2][2] declares an array of size ___________________. ii. 101010 in binary is ________ in base 10. iii. time1[2] measures elapsed time in _____________________. b. [5 Marks] What is output by the following code? int main() { int black[5][5] = {{1,6,4,8,9}, {8,0,7,3,4}, {5,2,1,3,8}, {2,7,1,0,4}, {8,3,9,6,1}}; for(int i=0; i<5; i++) cout << black[i][i] << endl; return 0; } c. [4 Marks] What is output by the following code? int mixer(int & a, int & b, int c) { c *= a; b = a--; return c; } int main() { int a = 9, b = -5, c = 2; cout << mixer(b,c,b) << endl << a << endl << b << endl << c << endl; return 0; }
Background image of page 2
Spring 2011 GenE 121 (C++/RobotC) Midterm Page 3 of 12 2. Functions [10 Marks Total] a. [5 Marks] Write a function that receives the base length of an equilateral triangle and returns the perimeter and area. b. [5 Marks] Write a function that receives a 4 digit, integer ID number and prints the last two digits as the first two and the first two digits as the last two. For example 2983 would be 8329 and 3401 would be printed 0134.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Spring 2011 GenE 121 (C++/RobotC) Midterm Page 4 of 12 3. RobotC Program Analysis
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2012 for the course GENE 121 taught by Professor Smucker during the Winter '11 term at Waterloo.

Page1 / 12

final_S11_V3 - University of Waterloo Final Examination...

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

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