College of Computing and Information Technology
CS 143– Problem Solving with C++
Dr. Hoda Hassan
Problem Set 6: Putting it all together (60 marks)
Handed out: Thursday 2nd of May
Due: Check the due date indicated for each problem
Introduction:
This problem set tries to incorporate all concepts and ideas that you have studied in this course since we have covered about 95% of the curriculum. So now is a good time to put it all together. Have fun with this problem set. Take it as a challenge rather than as an assignment, and when you code, “Always code as if the “guy” who ends up [correcting] your code will be a violent psychopath who knows where you live.”, with all due respect to your TAs ☺. (Adapted from the quote by Martin Codling)
Submission Guidelines
• All assignments are to be submitted electronically before due date
• For programming questions, submit only the .cpp file
• Programs with syntax errors receive zero
• 20% of the total grade is deducted for each day after due date with a maximum of 5 days delay.
• Collaboration is NOT allowed.
Part A (34 marks) Due Wednesday 8th of May 11:30 pm
Trace the following code showing the changes in the value of each variable as the instructions are executed and the output displayed on the screen. Use '-' to show the width of the output field. (To get full grade you have to show all tracing steps)
1. Arrays (10 marks) int j; int one[5]; int two[10]; for (j = 0; j < 5; j++) one[j] = 5*j + 3;