CPSC1002016W2:PracticeMidterm
DataRepresentation
Convertthebinarynumber011111111111111tohexadecimalanddecimal
Hexadecimal:3FFF
Decimal:16383
Convertthehexadecimalnumber0x12CD3tobinary.
00010010110011010011
Convertthehexadecimalnumber0x45todecimal.
69
Convertthedecimalnumber1034tobinary.
010000001010
Convertdecimalnumber132tohexadecimal.
0x84
DNAhasfournucleotides(A,C,T,andG)(i.e.,abase-4system).Codonsare“words”
ofthreenucleotidesthatcodeforaminoacids.ForexampleAAAcodesforanamino
acidcalledlysine.Whatisthemaximumnumberofaminoacidsthatcouldbe
representedifweusefournucleotidesandeachcodoncanonlybemadeupofthree
nucleotides?
64aminoacids(43=64)
Therearejust20aminoacids.Inabase-4system(i.e.,asystemwhereeach“digit”
canbeA,C,T,orG),whatisthesmallestnumberofdigitsthatIneedperposition,in
ordertobeabletorepresentall20aminoacidsusingthree-nucleotidecodons?
3digits(43=64)
Page 1 of 8
CPSC1002016W2:PracticeMidterm
Whatisrasterization?
Rasterizationiswhenwetakesomethingthatisinvectorformandconvertitto
pixelssothatwecansaveitinbitmapform.
Henry'sfriendhasgivenhimthedimensions(thenumberofrowsandcolumns)of
animage,andthenumberofbytesusedtorepresenteachpixel.HowcanHenryuse
thatinformationtocalculatetheapproximatesizeofthefile?
Note:Thiscalculationwouldnotgetyoutheexactfilesizesincefilesalsoinclude
metadata(dataaboutthefile(e.g.,headerinformationinabitmapimagefile).
#pixelswidthx#pixelsheightx#bytesusedtorepresentapixel=filesize
Howdoestheblurfilterwork?
Eachpixelvalueisreplacedwiththeaverageofthepixelandthepixelssurrounding
it.
Page 2 of 8
CPSC1002016W2:PracticeMidterm
Apriori
Showallthestepstofindingthefrequentitemsetswith>50%support.
Transaction
Items
T1
Coffee,Tea,Juice,Water
T2
Tea,Juice,
T3
Coffee,Juice
Frequentitemsetofsize1
Numberoftimeseachitemappears:
• Coffee:2
• Tea:2
• Water:1
• Juice:3
Eliminateitemsetswithlessthan50%supportwhichleaves:
• Coffee
• Tea
• Juice
Frequentitemsetofsize2
Numberoftimeseachitemappears:
• {Tea,Juice}:2
• {Coffee,Tea}:1
• {Coffee,Juice}:2
Eliminateitemsetswithlessthan50%supportwhichleaves:
• {Tea,Juice}
• {Coffee,Juice}
Frequentitemsetofsize3
Numberoftimeseachitemappears:
• {Coffee,Tea,Juice}:1
Eliminateitemsetswithlessthan50%supportwhichleaves:
• Nothing
Frequentitemsetswith>50%support
• Coffee
• Tea
• Juice
• {Tea,Juice}
• {Coffee,Juice}
Page 3 of 8
CPSC1002016W2:PracticeMidterm
Explainhowtheitemsetswith≥50%supportwouldchangeifweaddedT4:
Lemonadeintheoriginaltable.
Noeffectaslemonadewouldhavebeeneliminatedwithinthefirstround.
DecisionTrees
Basedonthefollowingdiagram,determinehowmanyofthefollowingthereare:
•
•
•
•
•
Nodes:11
Edges:10
Leaves:7
Depth:2
Parent:4
Page 4 of 8
CPSC1002016W2:PracticeMidterm
YouareprocrastinatingfromstudyingforyourCPSC100midtermandyouare
tryingtodecidewhetheryoushouldstudy,soyoumakeadecisiontreetohelpyou
determineifyoushouldstudyforeachofthefivechaptersofthetextbook.
DidI
Howwelldo Howlongwill Whatimpactwill
How
ShouldI
readthe Iunderstand ittakemeto thechapterhave
difficult study?
chapter?
thetext?
review?
ontheexam?
arethe
questions?
Yes
Confident
Long
Significant
Hard
No
No
Fairlywell
Short
Trivial
Medium
Yes
Yes
Confused
Long
Significant
Medium
No
Yes
Confused
Medium
Significant
Hard
No
No
Confident
Medium
Trivial
Easy
Yes
Foreachattribute(i.e.,ReadChapterorNot,UndersandingofText,...,Question
Difficulty),whatistheoverallentropyifwesplitonthatattribute?
ReadChapter Understanding
Chapter
Question
ReviewTime
orNot
ofText
Impact
Difficulty
0
2
2
0
2
Drawthetree(s)thatsplitonattributeswiththegreatestreductioninoverall
entropy.
Page 5 of 8
CPSC1002016W2:PracticeMidterm
Clustering
Giventhefollowing9items,howwouldyougrouptheseitems(whatmeasureof
qualitywouldyouuse)?Howmanydatapointsandwhatarethedatadimensions
basedonwhathowyouclusteredtheseitems?
Possibleanswers:
• Groupbyfoodanddrinksvs.UBCmaterial(9datapoints,3clusters)
• Groupbycolours(pictureswithsomered,ifnotredgroupwithblack(9data
points,2clusters)
• Groupbyitemswhichareroundorcontainscirclesvs.nocircles(9data
points,2clusters)
Whatarethebenefitsofclusteringandhowdoesithelpindatamining?
Possibleanswers:
• Exploredataforanyhiddenpatternsorcorrelationswhichcanguidein
decisionmaking(e.g.,Netflix,cancertumours)
• Organizedata,usefulclassificationortargetedmessages(e.g.,onlineads,
species,typesofenergyconsumers,shopping)
• Reducedatacomplexity(e.g.,heatmaps,usefewpointsinaclusterto
representthewholecluster,filtersforcategoriesandfolders)
Page 6 of 8
CPSC1002016W2:PracticeMidterm
BelowisagraphwithdatapointsA,B,C,andDandtwocentroids(blueandredX’s).
Whatwillhappeninthefollowing2steps(clusterassignmentandmovecentroid)in
thek-meansclusteringalgorithm,giventhefollowingtable?
Datapoint DistancetoRedCentroid(4,4) DistancetoBlueCentroid(-4,3)
A(-1,1)
5.8
3.6
B(2,2)
2.8
6.1
C(1,-1)
5.8
6.4
D(1,-3)
7.6
7.8
1. Clusterassignment:Whichclusterswillthesedatapointsbeassignedto?
Assigneachpointtotheclosestcentroidandputitintheclusterofthat
centroid
TheblueclusterwillhavepointA.
TheredclusterwillhavepointsB,C,andD.
Page 7 of 8
CPSC1002016W2:PracticeMidterm
2. Movecentroid:Giventhefollowingdata,whatcoordinateswilltheredand
bluecentroidmoveto?Statewhichofthefollowingcalculationsshouldbe
performed(averageormedianandforwhichpoints.Also,statewhichofthe
followingwilldeterminewheretheredcentroid,andbluecentroidwillmove
to.
Calculation
NewCentroid
1)AverageofpointsA&D
(0,-1)
x-coord=(-1+1)/2=0
y-coord=(1+-3)/2=-1
2)MedianofpointsA&D
(0,-1)
X-coord=-1,1,evennumbersotaketheaverage
(-1+1)/2=0
y-coord=-3,1.(-3+1)/2=-1
3)AverageofpointsB&C&D (1.3,-0.7)
x-coord=(2+2+1)/3=1.3
y-coord=(2+-1+-3)/3=-0.67
4)MedianofpointsB&C&D (1,-1)
x-coord=1,1,2medianis1
y-coord=-3,-1,2,medianis-1
5)AverageofpointsB&C
(1.5,0.5)
x-coord=(2+1)/2=1.5
y-coord=(2+-1)/2=0.5
6)MedianofpointsB&C
(1.5,0.5)
X-coord=1,2evennumbersotaketheaverage
(1+2)/2=1.5
y-coord=-1,2.(-1+2)/2=0.5
7)AverageofpointA
(-1,1)
8)MedianofpointA
(-1,1)
Thetwocalculationsusedshouldbenumbers_____________and_______________.
Redcentroidwillmoveto_____________.
Bluecentroidwillmoveto_____________.
Thetwocalculationsusedshouldbenumbers_____3)________and_______7)_______.
Redcentroidwillmoveto_______3)______.
Bluecentroidwillmoveto_______7)______.
Page 8 of 8
© Copyright 2026 Paperzz