Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS122 – Quiz 1 Winter, 2013 Quiz Hints. Quiz 1 Hints Question 1 – Understanding procs  First, we did not fully explain the structure of the Maple proc,

Similar presentations


Presentation on theme: "CS122 – Quiz 1 Winter, 2013 Quiz Hints. Quiz 1 Hints Question 1 – Understanding procs  First, we did not fully explain the structure of the Maple proc,"— Presentation transcript:

1 CS122 – Quiz 1 Winter, 2013 Quiz Hints

2 Quiz 1 Hints Question 1 – Understanding procs  First, we did not fully explain the structure of the Maple proc, but rather supplied the proc within the work sheets in the unzipped folder in Lab 1.  Some key features of the proc include: Header – 1st statement  procname := proc(list of input parameters) Solve12 := proc(a,b,c,d) local – list of variables used in proc, but not passed in as an input parameter  local answer, part1, part2; To execute a proc (open a code edit region and then copy proc from quiz, adding the proc call after the end proc: statement) :  procname(parameter list) Solve12(10000, 8000, 7000, 9000);

3 Quiz 1 Hints Question 2 – while loop with steps  The easiest way to solve this problem is to copy the code into a code edit region, execute the proc and then count the number of *'s produced. Question 3 – drive in a square (using nested “while” loops)  Review the Lab 1 Tutorial # 4, which creates a square using nested “while” loops and then fill in the blanks.

4 Quiz 1 Hints Questions 4 and 5 – Using the Car Simulator – 1st, some general comments pertaining to both questions It is important to remember from lab 1 that both the.mw work sheets and the 2 Car Simulator library files must reside in the same folder. That is why we unzipped the file on the course web site and created the folder that contained all necessary files In Maple, we always opened our work sheets for all problems from that folder

5 Quiz 1 Hints Questions 4 and 5 – Using the Car Simulator – 2nd, the 11 step process described in questions 4 and 5 results in your new file (for the question 4 or 5 solution) residing in the folder along with the 2 library files. – It is critical that you understand and can replicate this process because 2 of the 4 questions on the C portion of your proficiency exam will come from this type of example from either quiz 1 or 2. – Please visit the CLC (room 147 UC) with any questions regarding this procedure

6 Quiz 1 Hints Questions 4 and 5 – other tips and hints – For either question, it is possible that the car is NOT originally facing the proper direction. If this is the case, you must start your solution with an appropriate turn Perhaps turn(Pi); → a 180 degree turn – Note that each question contains 2 sets of code for creating the grid. Each will set up a grid with different spacing between barriers, turns and targets, so you cannot count and code the number of blocks to move for a specific layout. “While” loops are necessary to determine when you are at the target, gap, etc. If both sets of code work, your solution has been correctly coded.

7 Quiz 1 Hints Questions 4 and 5 – other tips and hints – Finally, the easiest way to copy and paste the properly formatted proc code into the quiz solution box is to highlight and copy the blue code under the code edit region (in the execution trace) that is produced when the proc is executed. This will ensure that the appropriate syntax is captured. – The solutions themselves consist merely of the correct ordering of moves, turns and isTouching functions.


Download ppt "CS122 – Quiz 1 Winter, 2013 Quiz Hints. Quiz 1 Hints Question 1 – Understanding procs  First, we did not fully explain the structure of the Maple proc,"

Similar presentations


Ads by Google