Back - Solutions Index | Previous - Exercise 1 - Sets | Next - Exercise 3 - Sequences


Solutions to Exercise 2 - Functions

 

Question 1

dom quals = {Maths,English,Physics,Jewllry}

ran quals = {A,B,C,D}

quals == {(Maths,B),(English,A),(Physics,C),(Jewellry,D)}

quals : EXAMS GRADES

science_quals : EXAMS GRADES
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
science_quals = {(Maths,B),(Physics,C)}

quals Å {(Maths,C),(CompSc,A),(ProdMan,B)}
= {(Maths,C),(English,A),(Physics,C),(Jewellry,D),(CompSc,A),(ProdMan,B)}

comp_res = {CompSc} quals

non_math = {Maths} quals

C_grade_or_better = quals © {A,B,C}

non_uni = {Maths,CompSc,ProdMan} quals

 

Question 2

Given basic sets MATRICNOS, PERFDATA, PROCNAMES as representing the sets of all possible matriculation numbers, student performance data and process names respectively, then there are partial functions thus:

studentfile : MATRICNOS PERFDATA

processtable : PROCNAMES

 

Question 3

NoQueues ó 25

$ queue : AvailableQueues QueueStates(queue,active)

$ queue : AvailableQueues QueueStates(queue,active) Ù WaitStatus(queue,waiting)

Ø $ queue : AvailableQueues QueueStates(queue,active) Ù WaitStatus(queue,waiting) Ù QueueStatus(queue,ready)

 

Question 4

If all the programs resident in memory are suspended, then all the processors are idle.