midf2011_Soln - University of Waterloo Midterm Examination...

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

View Full Document Right Arrow Icon
Term: Fall Year: 2011 Student Name: ______________________________________________________________________ UW Student ID Number: ______________________________________________________________ Signature: __________________________________________________________________________ Course Abbreviation and Number GEN E 121 (MTE C++/RobotC) Course Title Digital Computation Section(s) 001 Instructor C. Hulls Date of Exam Tuesday, October 18, 2011 Time Period Start time: 1:00pm End time: 3:00pm Duration of Exam 2 hours Allowed Materials: Writing instruments ONE (8.5x11) formula sheet written on ONE side only 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. If you need extra space to answer a question, use the back of the previous page. Question Maximum Mark Mark 1. 17 2. 8 3. 12 4. 12 5. 7 6. 12 7. 17 Total 85 1 Mark Bonus: Reference Sheet handed in Yes / No University of Waterloo Midterm 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
GenE 121 (C++/RobotC) Midterm Page 2 of 9 1. Short Answer [17 Marks Total] a. [3 Marks] For each constant below, state its type 1.0 float, double 'X' char -418 int True bool "X0" string 2.8e-10 float, double b. [4 Marks] Write the value of the following expressions. i. 7 + 4.5 * 2 / 3 - 80 / 10 % 10 = 2 ii. log10(1094/100) = 1 iii. -7 < -3.5 < 0.5 = 0 iv. atan2(1,1) * 180/M_PI = 45 c. [4 Marks] i. Describe what happens when the following program is run. task main() { while (nNxtButtonPressed == -1); nxtDisplayString(0, "Hello"); while (nNxtButtonPressed == -1); nxtDisplayString(2, "Goodbye"); wait1Msec(2000); } When the user presses any button, the robot will display Hello on line 0 of the display and immediately after, display Goodbye on line 2 of the display. The code will wait for 2 seconds before ending the program and clearing the display. ii.
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 04/01/2012 for the course GENE 121 taught by Professor Smucker during the Winter '11 term at Waterloo.

Page1 / 9

midf2011_Soln - University of Waterloo Midterm Examination...

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