CS计算机代考程序代写 Java algorithm assembly Note:

Note:
THE UNIVERSITY OF AUCKLAND
Your Teleform sheet is stapled at the end of this question/answer book. Remove the Teleform sheet from the question/answer book.
The version code for this question/answer book is 00003881. You MUST carefully check that this version code corresponds to the one on the Teleform. If the version codes do not match, please inform the exam supervisor IMMEDIATELY.
Enter your name and student ID on the Teleform sheet. You must also enter your name and student ID on this question/answer book in the space provided below.
Enter your answers on the Teleform. Answers entered in the question/answer book will not be marked. At the end of the exam, submit the Teleform only. You MUST retain this question/answer book until the marking is complete and you have received the mark or grade for this assessment.
Each of the 45 questions is expected to have exactly 1 (one) correct answer. If you believe that a question has either NO or MULTIPLE correct answers, select the ONE you believe is most likely to be the intended answer.
All questions carry equal marks. You must answer 40 out of the 45 questions correctly in order to obtain full marks in this exam. Any excess marks may be used to offset marks lost in the mid-semester test. This exam counts for 50% of your final grade.
Name: ……………………………….. ID: ………………………………..
COMPSCI 110
SUMMER SCHOOL 2020 Campus: City
COMPUTER SCIENCE
Introduction to Computer Systems (Time Allowed: TWO hours)
Page 1 of 22

COMPSCI 110
1. Whichofthefollowingstrings,whencompressedwiththeRLEalgorithmdiscussedinclass,willresultinacompressionratio of 1.5 or more?
X. fffFFFaabb Y. Roland
Z. oooohhhh
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
2. WhichofthefollowingadditionsareCORRECT?Notethesubscriptsdenotethebases(8=octal,16=hexadecimal).
X. 25528 + 3668 = 31408 Y. C4316 + D116 = D1416 Z. 42528 + 3658 = 46408
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
3. WhichofthefollowingsubtractionsareCORRECT?Notethesubscriptsdenotethebases(8=octal,16=hexadecimal).
X. 24038 – 558 = 23268 Y. 26438 – 3208 = 23218 Z. EBB16 – 2116 = E9A16
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 2 of 22

4. Whichofthefollowinganswerscorrectlygivethe8-bittwo’scomplementofthespecifieddecimalnumber?
X. 99is​01100011​ Y. -83is11010011 Z. -126is10000001
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
5. Whichofthefollowingarecorrectrepresentationsofthespecifieddecimalvaluesinthe16-bitfloatingpointformatpresented in lectures and the textbook? Note that the floating point representation has been expressed in hexadecimal.
X. -207.5(decimal)isE7C8(hexadecimal). Y. 1024(decimal)is400B(hexadecimal).
Z. -55.375(decimal)isEEC6(hexadecimal).
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 3 of 22
COMPSCI 110

COMPSCI 110
6. GiventhatthehexadecimalvalueoftheASCIIcodefor”A”is41,theASCIIcodefor”a”is61andtheASCIIcodefor”1″(one) is 31, which of the following statements are TRUE? All numbers are in hexadecimal.
X. TheASCIIcodefor”L”is52.
Y. TheASCIIcodefor”m”is6D.
Z. ThedifferencebetweentheASCIIencodingforalllowercaselettersandtheiruppercaseequivalentsisdecimal20.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
7. Considerthetruthtablebelow:
Which of the following boolean expressions match the output column in the truth table above?
X. (NOTAANDBANDC)OR(AANDNOTBANDNOTC)
Y. (NOTAANDNOTBANDNOTC)OR(AANDBANDNOTC)
Z. (NOTAANDNOTBANDNOTC)ORNOT(NOTAORNOTBORC)
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 4 of 22

8. ConsidertheHuffmantreebelow:
COMPSCI 110
Which of the following statments about this Huffman tree are TRUE?
X. TheHuffmancodefor’h’is0101. Y. TheHuffmancodefor’a’is100. Z. TheHuffmancodefor’u’is00111.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
9. WhichofthefollowingstatementsareTRUE?
X. Theinstructionregisterholdstheencodingofthenextinstruction.
Y. Thetextbookarchitectureusesbyteaddressing.
Z. Theprogramcounterregisterholdstheaddressofthenextinstruction.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 5 of 22

10. Hereisaprogramusingthepseudocodepresentedinlectures:
COMPSCI 110
Using this program, which of the following give the correct output with the given input?
X. Input: 4, Output: 5 Y. Input: 6, Output: 21 Z. Input: 1, Output: 0
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 6 of 22

COMPSCI 110
11. Hereisanassemblylanguageprogramusingthetextbooklanguage(theappendixcontainsthetextbookinstructionset):
.BEGIN
IN X L: LOAD X
COMPARE Z JUMPEQ E LOAD W
ADD Y
STORE W INCREMENT Y DECREMENT X JUMP L
E: OUT W HALT
W: .DATA 0
X: .DATA 0
Y: .DATA 1
Z: .DATA 0
.END
Using this program which of the following give the correct output with the given input?
X. Input: 5, Output: 15 Y. Input: 2, Output: 2 Z. Input: 4, Output: 4
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 7 of 22

COMPSCI 110
12. Hereisanassemblylanguageprogramusingthetextbooklanguage.Thecommentsattherightendofeachlinearefor numbering the lines. The program starts at address zero. The appendix contains the textbook instruction set.
.BEGIN
IN X L: LOAD X
ADD X
STORE X LOAD Z COMPARE Y JUMPEQ E DECREMENT Z JUMP L
E: OUT X HALT
X: .DATA 0
Y: .DATA 0
Z: .DATA 3
.END
— line 1 — line 2 — line 3 — line 4 — line 5 — line 6 — line 7 — line 8 — line 9 — line 10 — line 11 — line 12 — line 13 — line 14 — line 15 — line 16
Using this program, which of the following have the correct machine code and data (both in hexadecimal) for the specified line?
X. Line3-000D Y. Line7-700E Z. Line4-300D
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 8 of 22

13. ConsiderthefollowingCorJavasourcecode:
while (j != k) { j = (k0+k1) / f3;}
If analysed with the lexicographical analyser from the lectures, how many tokens and token classes do we find here?
A. 19tokensand12tokenclasses B. 18tokensand11tokenclasses C. 19tokensand11tokenclasses
D. 18tokensand9tokenclasses E. 18tokensand10tokenclasses
14. WhichofthefollowingBNFspecificationsarerecursive?
X. ::=|.
Y. ::=... Z. ::=+|
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
15. ConsiderthefollowingBNFgrammar:
::= 1|2|3|4|5|6|7|8|9
::= 0|
::= +|
Which of the following patterns does this grammar match?
X. 33 Y. 91 Z. +40
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 9 of 22
COMPSCI 110

16. Considertheparsingtreebelow:
COMPSCI 110
Which of the following BNF grammar definitions could have been involved in the production of this tree?
X. ::= Y. ::=x|y|z Z. ::===|<|>
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
17. Whichofthefollowingstatementsaretrueaboutsemanticanalysisduringcompilation?
X. Ifasemanticrecordrelatestoanexpressionitstoresatemporarynamefortheexpression. Y. Asyntacticallycorrectstatementisnotexaminedduringthesemanticanalysisphase.
Z. Anewsemanticrecordmustbecreatedforeachnon-terminalsymbolintheparsetree.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
18. AssumethatinamultiprocessOS,eachprocessspendsabout50%ofit’stimewaitingforI/Ooperationstobecompleted. Which of the following statements are true?
X. AmultiprocessOSdoesnotimprovesprocessorutilizationsinceitinvolvestoomuchcontextswitching. Y. Ifthereare2processesloadedintomemory,theprocessorutilizationwillbe75%.
Z. Ifthereare3processesloadedintomemory,theprocessorutilizationwillbemorethan80%.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 10 of 22

19. AfileonaLinuxmachinehaspermissionsrw-r–r–.Thisfileis:
X. executablebyitsowner.
Y. notreadablebymembersofitsgroup. Z. notwritablebyitsowner.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
20. AfileonaLinuxmachineshouldhavepermissionsrw-r—–.Whichcommanddoyouusetosetthesepermissions?
A. chown 640 B. chperm 644
C. chmod644 D. chmod640 E. chmod666
21. WhichofthefollowingstatementsaboutfilepermissionsinUnixarecorrect?
X. Ifadirectoryhasreadpermissionsset,allfilesinthedirectorymusthavethesamereadpermissions. Y. Changingfileownershiprequiresrootprivilegesinallcases.
Z. Adirectorywithexecutepermissionsfor”others”allowsanyonewithanaccounttocdintoit.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 11 of 22
COMPSCI 110

22. Whichofthefollowingsituationsaredeadlockedormightcreateone?
X. Asystemhassixunitsofaresource,with6processescompetingforthem.Eachprocessneedstwounits.
Y. ProcessBiswaitingfordatafromprocessC.ProcessCiswaitingforAtofinishwritingtofileXthatAhaslocked.
Process A is waiting for Process B to release a lock on file Y.
Z. Thereare3processeseachrequiring3unitsofaresourceR.Thesystemhas5unitsofR.
A. XandYonly
B. XandZonly
C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
23. Whichofthefollowingfeaturesareessentialinamulti-useroperatingsystem?
X. Agraphicaluserinterface Y. File encryption on disk
Z. Twofactorauthentication
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
24. Whichofthefollowingstatementsaretrueaboutmalware?
X. Themostcommonmechanismforspreadingavirusisthroughemailattachments.
Y. Installingregularupdatestoanoperatingsystemisnotgoodsinceitlowerstheprocessorefficiency. Z. ATrojanhorsecanhideakeystrokeloggerthatcapturesuser’spasswords.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
25. ConsideraciphertextQZIY.IfyouknowthatthiswasencryptedwithaCaesarcipherfromplaintextIRAQ,whichofthe following could be the key? You may assume that the cipher’s alphabet consists of the 26 letters of the English alphabet only.
A. 21 B. 8 C. 16
D. 20 E. 12
Page 12 of 22
COMPSCI 110

COMPSCI 110
26. ConsidertheplaintextPUMPKIN.IfencryptedwithaCaesarcipherwithkey10,whichofthefollowingistheciphertext? You may assume that the cipher’s alphabet consists of the 26 letters of the English alphabet only.
A. ZEWZUHM B. ZEWZIGL
C. ZEWZUSN D. ZEWMHFK E. ZEWZUSX
27. DecrypttheciphertextWSNXSQRD:
A. LIFETIME B. ACCURACY
C. COMMERCE D. MIDNIGHT E. ACCEPTED
28. ConsidertheplaintextCFGovertheshortenedalphabetA=0,B=1,C=2,D=3,E=4,F=5,G=6,H=7.Whatistheciphertextif we encrypted the plaintext with the following block cipher key:
Note:Giventhesizeofthealphabet,youwillneedtousemod 8.
A. EAA B. EFC C. GAC D. AGE
E. DAG
Page 13 of 22

29. WhichofthefollowingareTRUEwithrespecttoRSA?
X. Thepublickeyisusedtoencryptmessagesintendedforpartiesotherthantheowner. Y. Thesecondpartofthepublickeycanbecomputedoncethefirstpartisknown.
Z. Theprivatekeyisusedtoencryptmessagesintendedfortheowneronly.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
30. WhichofthefollowingareTRUE?
X. A1500byteframeona100MbpsEthernettakesthesametimetotravelfromoneendofanEthernetsegmenttothe other as on Gigabit Ethernet.
Y. EthernetswitchesincreaseavailablenetworkbandwidthinaLAN.
Z. GigabitEthernetisidealforinternationalnetworkslinkingcountriesacrossoceanssincefiberiscostly.
A. Xonly
B. Yonly
C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
31. WhichofthefollowingareTRUE?
X. Internetconnectionsviageostationarysatellitesufferfromhighlatency.
Y. Geostationarysatellitegroundstationsneedlargerantennasthanmediumearthorbitsatellitegroundstations. Z. Ageostationarysatellitecanprovideservicetothesamegroundstationaroundtheclock.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 14 of 22
COMPSCI 110

COMPSCI 110
32. WhichofthefollowingareTRUEintermsofthemaximumachievablebitratebetweentwohostsconnectedbythis technology?
X. GigabitEthernethasahigherbitratethanFibre.
Y. VDSLhasahigherbitratethan100MbpsEthernet.
Z. ADSLhasahigherbitratethanFibreforsmalldistances.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
33. WhichofthefollowingstatementsareTRUEwithrespecttopacketsizeonanetworksharedwithotherhosts?
X. Makingpacketsizesmallermaymeanhavingtosendmoreheaderbytesforthesameamountofpayloaddata. Y. Thelargerwemakeourpacketsize,thelongerotherhostsmayhavetowaituntiltheycantransmit.
Z. Largerpacketsizesincreasethebitrateonthenetwork.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
34. WithreferencetotheOSIlayermodel,the
A. sessionlayerinteractswiththenetworklayeraboveandthephysicallayerbelow.
B. sessionlayerinteractswiththepresentationlayeraboveandthetransportlayerbelow.
C. sessionlayerinteractswiththephysicallayeraboveandtheapplicationlayerbelow. D. sessionlayerinteractswiththephysicallayeraboveandthenetworklayerbelow.
E. sessionlayerinteractswiththetransportlayeraboveandthenetworklayerbelow.
Page 15 of 22

COMPSCI 110
35. WhichofthefollowingareTRUEwithrespecttoaTCP-baseddatacommunicationbetweentwoIPhostsontheInternet?
X. RoutersalongthewayusetheTCPdestinationportnumberstodeterminethecorrectoutgoinginterface. Y. TheEthernetheadersofpacketspassingthroughaswitchremainunchanged.
Z. Thetransportlayerforwardspacketsfromoneroutertothenext.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
36. WhichofthefollowingarevalidsetsofinstructionsforaTuringmachine?
X. (1,0,0,2,L),(1,1,0,4,L),(2,0,1,3,L),(3,0,0,1,L),(3,1,0,1,L)
Y. (1,b,0,2,R),(1,1,0,3,R),(2,b,1,1,R),(3,0,0,1,R),(3,0,0,1,L)
Z. (1,0,0,1,L),(1,b,0,2,L),(1,b,0,1,L),(2,0,1,1,R),(2,1,0,1,R),(2,b,0,1,L)
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
37. Considerthefollowingsetsofinstructions,someofwhichmaynotbevalid.WhichofthesetsarevalidandpreventaTuring machine from halting irrespective of the input to the machine on the tape? You may assume that the machine is in state 1 at the start of execution.
X. (1,0,1,2,R),(1,1,0,2,R),(1,b,1,1,L),(2,0,1,3,R),(2,b,1,1,R),(3,0,1,2,L),(3,1,b,3,R),(3,b,1,2,L) Y. (1,0,0,2,L),(1,1,0,2,L),(1,b,b,2,R),(2,0,1,2,L),(2,1,1,1,R),(2,b,0,2,R)
Z. (1,0,1,2,L),(1,1,0,2,R),(1,b,0,1,L),(2,0,1,1,R),(2,1,1,2,R),(3,0,1,2,R),(3,1,b,3,L),(3,b,1,2,R)
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 16 of 22

38. ConsiderthefollowinginstructionsetforaTuringmachine:
(1,0,0,2,R) (1,1,0,4,R) (2,0,0,4,R) (2,1,0,3,R) (3,0,0,5,R) (3,1,0,1,R) (4,0,1,2,R) (4,1,1,4,R) (5,0,1,2,R) (5,1,0,5,R)
If the Turing machine is run on the tape 101010…, starting in state 1 on the first symbol on left of the tape, which state does it end up in after executing 6 instructions?
A. State1 B. State5 C. State4 D. State2 E. State3
39. ConsiderthefollowinginstructionsetforaTuringmachine:
(1,0,1,2,R) (1,1,0,4,R) (2,0,1,5,R) (2,1,1,3,R) (3,0,0,5,R) (3,1,0,1,R) (4,0,1,2,R) (4,1,1,4,R) (5,0,1,2,R) (5,1,1,4,R)
If the Turing machine is run on the tape 010111…, starting in state 1 on the first symbol on the left of the tape, what is written on the tape after 6 instructions have been executed?
A. …100111… B. …110011… C. …110111… D. …111111… E. …010111…
Page 17 of 22
COMPSCI 110

40. WhichofthefollowingstatementsonTuringmachinesareTRUE?
X. ThereisexactlyoneTuringmachineforeverycomputableproblem.
Y. ATuringmachinethatdoesnothaltisnotaTuringmachine.
Z. Turingmachinescanbeusedtoshowthatthehaltingproblemisunsolvable.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
41. Whichofthefollowingarereasoningtasks?
X. Understandingthespokenword. Y. Rankingproductsbasedonsales. Z. Managingapayroll.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
42. WhichofthefollowingstatementsaboutbackpropagationinneuralnetworksisTRUE?
X. Ifanoutputneuronfirederroneously,itsnegative(inhibitory)weightsareincreased.
Y. Inbackpropagation,theweightsfromeachneuronlayeraremovedtothepreviouslayer. Z. Ifanoutputneuronfailedtofire,itsfiringthresholdisdecreased.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
Page 18 of 22
COMPSCI 110

43. WhichofthefollowingstatementsonrobotsareTRUE?
X. Everyrobotmusthaveacompleteknowledgerepresentationaboutitsenvironment. Y. Robotscanonlybeusedfortaskswheretheycannotpossiblymakeamistake.
Z. Allrobotsusesensorstodetectwhatisaroundthem.
A. Xonly B. Yonly C. Zonly
D. NoneofX,Y,andZ
E. All,ortwoofX,Y,andZ
44. Considerthefollowingneuralnetworks.Whichnetworksoutput1? X.
COMPSCI 110
0 3 N1 1 N3 10111
11N20N4
00201
Y.
Z.
A. XandYonly
B. XandZonly
C. YandZonly
2
0
4
0
3
0
N5 1
N5 2
N5 2
OUTPUT
OUTPUT
OUTPUT
1 3 N1 3 N3 1 -1 1 1 1
01N2-1N4 0 -2 2 -2 2
1 1 N1 1 N3 00111
11N20N4
1 -2 2 0 1
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 19 of 22

45. WhichofthefollowingsentencescouldbeusedasaWinogradschema?
X. SusanknowsallaboutAnn’spersonalproblemsbecausesheisnosy.
Y. IftheconartisthadsucceededinfoolingSam,hewouldhavegottenalotofmoney. Z. Thedogchasedthecatwhentheownerwasaway.
A. XandYonly B. XandZonly C. YandZonly
D. AllofX,Y,andZ
E. None,oronlyoneofX,Y,andZ
Page 20 of 22
COMPSCI 110

Appendix
COMPSCI 110
Page 21 of 22

COMPSCI 110
PoweredbyDividni.
Page 22 of 22