Inf1 OP : Sample Solutions for Lab Exercises
Sample Solutions

The following are sample solutions for all of the lab exercises.


You will find it much more useful to check these sample solutions after you have created your own working solution. Looking at the answers before figuring it out for yourself will greatly decrease your opportunity to learn.

Lab Question Description Sample solution files
Week 1 Q1 Hello World
Q2 Personal Greeting
Q3 Adder
Q4 Multiplier
Week 2 Q1 Integer Distance
Q2 Largest Double
Q3 Evaluating Boolean Values
Q4 Face-Printing
Q5 Quadratic Equations
Q6 Polar Coordinates
Q7 Safer Fixed Divider
Q8 Safer Quadratic Solver
Q9 Squares Loop
Q10 Lopsided Number Triangle
Q11 Gambler's Ruin
Q12 Quadratic Solver With Imaginary Parts
Week 3 Q1 Floating point division
Q2 While loop example - arithmetic series
Q3 ArrayRotate
Q4 Mean and Variance
Q5 Median Temperature
Q6 Mode
Q7 Sieve of Eratosthenes
Week 4 Q1 Array Front
Q2 Date Fashion
Q3 No Triples
Q4 Has 271
Q5 IsTriangular
Q6 NMax
Q7 CoordinateConverter
Q8 ArrayOps
Q9 Factorial Recursion
Week 5 Q1 N-by-N Matrix
Q2 Nesting Nightmare
Q3 Path Names
Q4 Voronoi Diagram
Q5 One Time Pad
Week 6 Q1 Daleks
Q2 Arrays and Reference Types
Q3 Make your Own CreditCard
Q4 DNA Strand
Q5 Vector3D
Q6 Image Editor
Week 7 Q1 Daleks Again
Q2 Arrays and Reference Types music/
Q3 Reading in files
Q4 Interval
Q5 Shapes
Q6 Text Analysis
Q7 Noughts-And-Crosses
Week 8 Q1 Video Store
Q2 Binary Wffs and Inheritance
Q3 Propositional Logic logic/