chapter14_6e

chapter14_6e

ID:37708763

大小:58.50 KB

页数:11页

时间:2019-05-29

chapter14_6e_第1页
chapter14_6e_第2页
chapter14_6e_第3页
chapter14_6e_第4页
chapter14_6e_第5页
chapter14_6e_第6页
chapter14_6e_第7页
chapter14_6e_第8页
chapter14_6e_第9页
chapter14_6e_第10页
资源描述:

《chapter14_6e》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、TestBankforProblemSolvingwithC++:TheObjectofProgramming,6/eChapter14RecursionTRUE/FALSE1.Therecanbemorethanonestoppingcaseinarecursivefunction.ANSWER:TRUE2.Youmayhaveatmost1recursivecallinarecursivefunction.ANSWER:FALSE3.Recursivefunctionsmustreturnavalue.ANSWER:FALSE4.Theoperating

2、systemusesastacktocontrolrecursion.ANSWER:TRUE5.Aclassmemberfunctionmayberecursive.ANSWER:TRUE6.RecursivefunctionsmayreturnanytypeofvalueANSWER:TRUE7.Notallrecursivedefinitionsmaybewritteniteratively.ANSWER:FALSE8.Recursivefunctionsalwaysexecutefasterthananiterativefunction.ANSWER:

3、FALSE9.Onlyfunctionsthatdonotreturnavaluemayberecursive.ANSWER:FALSE10.Everyrecursivedefinitionmayberewritteniteratively.ANSWER:TRUEShortAnswer1.Arecursivefunctionisafunctionthat______________.ANSWER:callsitself2.Astackexhibitswhatbehavior?ANSWER:LastIn–FirstOut3.Inarecursivefuncti

4、on,thestatement(s)thatinvokethefunctionagainarecalledthe______________.ANSWER:recursivecalls4.Iftherecursivefunctioncalldoesnotleadtowardsastoppingcase,youhave______________.ANSWER:infiniterecursionorastackoverflow5.Howdoyouensurethatyourfunctiondoesnothaveinfiniterecursion?ANSWER:

5、Allrecursivecallsmustleadtoastoppingcase.6.Whatistheoutputofthefollowingcodefragment?intf1(intbase,intlimit){if(base>limit)return-1;elseif(base==limit)return1;elsereturnbase*f1(base+2,limit);}TestBankforProblemSolvingwithC++:TheObjectofProgramming,6/eChapter14Recursionintmain(){cou

6、t<

7、

8、y<0)returnx-y;elsereturnf1(x-1,y)+f1(x,y-1);}intmain(){cout<

9、power,atwhatvalueofexpdoyoustop?Thefunctionwillcontinuallymultiplythebasetimesthevaluereturnedbythepowerfunctionwiththebaseargumentonesmaller.ANSWER:exp=13.Inarecursivepowerfunctionthatcalculatessomebasetotheexppower,whatistherecursivecall?ANSWER:returnbase*power(base,exp-1);4.Fore

10、veryrecursivesolution,ther

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

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

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