DIT027-RegularExamWithAnswers.pdf

DIT027-RegularExamWithAnswers.pdf

ID:48014590

大小:97.03 KB

页数:11页

时间:2019-07-18

DIT027-RegularExamWithAnswers.pdf_第1页
DIT027-RegularExamWithAnswers.pdf_第2页
DIT027-RegularExamWithAnswers.pdf_第3页
DIT027-RegularExamWithAnswers.pdf_第4页
DIT027-RegularExamWithAnswers.pdf_第5页
资源描述:

《DIT027-RegularExamWithAnswers.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、EXAM–w.SolutionsDistributedFault-tolerantProgrammingDIT027(TIG027)Day:2/11-2011Time:8:30–12:30•Responsible:HansSvensson•Result:Nolaterthan18/11-2011•Aids:None•Grade:Thereare6assignments(with15+24+16+15+25+5=100points);atotalofatleast50pointsisapass(G)andatotalofatleast75pointsisapassw

2、.distinction(VG).Pleasereadthefollowingguidelinescarefully:•Pleasereadthroughallassignmentsbeforestartworkingontheanswers•AnswersshouldbegiveninEnglish•Begineachassignmentonanewsheet•WriteyouranonymousIDoneachsheet•Writeclearly;unreadable==wrong!•Fullmarksaregiventosolutionsthataresho

3、rt,elegant,andcorrect•Lessmarksaregiventounnecessarilycomplicatedorunstructuredsolutions•Don'tforgettowritecommentswithyourcode•YouareallowedtousestandardErlangfunctionsandlibraries,ifnothingisexplicitlymentionedintheproblemdescription•Theexactsyntaxisnotcrucial,youwillnotbepunishedfo

4、rmissingforexampleaparenthesisoracomma.GoodLuck!Problem1–Patternmatching(total15p)Inthisassignmentyouaregivenfivepatternmatchingexpressions.Ifmatchingsucceeds,whatarethevaluesoftheboundvariables?Ifmatchingdoesnotsucceed,explainwhy.(3p)QuestionA[H

5、T]=[1,2

6、3].Answer:H=1,T=[2

7、3](Note:[2,

8、3]/=[2

9、3])(3p)QuestionB[_

10、Sorted]=[a,4,1,0,2].Answer:Sorted=[4,1,0,2](Note:_isnotboundtoanything)(3p)QuestionC{{_,P},_}={{1,2},3}.Answer:P=2(Note:_matchesanything)(3p)QuestionD[A,B

11、B]=[1,2,3].Answer:DoesnotmatchsinceBcan'tbeboundtoboth2and3(3p)QuestionE{car,Brand,Year}={car,spijker,19

12、24}.Answer:Brand=spijker,Year=1924Problem2–Understandingsequentialcode(total24p)Inthisassignmentyouaregiventhecodeofthemoduleexam(listedbelow).Firstly,youhavetoexplaintheresultofevaluatingthefollowingexpressions:(3p)QuestionAexam:f1(1,[2,3,1,4]).Answer:[2,3,4](f1isactuallyadeleteAllfu

13、nction,thatgivenXandXswillremovealloccurrencesofXinXs).(3p)QuestionBexam:f1(1,[1,2,3,1,4]).Answer:[2,3,4](3p)QuestionCexam:f1(6,[1,aap,2,1]).Answer:[1,aap,2,1](3p)QuestionDexam:f2([p,p,q,p]).Answer:5(f2willstartfrom0,add1oneachpandmultiplyby2oneachq,thus(0+1+1)*2+1=5(3p)QuestionEexam:

14、f2([d

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。
相关文章
更多
相关标签