Assignment31Word下载.docx
《Assignment31Word下载.docx》由会员分享,可在线阅读,更多相关《Assignment31Word下载.docx(12页珍藏版)》请在冰豆网上搜索。
5.IfXisinteger,whichofthefollowingistheterminationconditionforthefollowingloop?
5。
如果X是整数,下面哪个是终止条件下面的循环吗?
while(X<
5)do(...)
虽然(X<
5)做(。
。
)。
A.X<
5B.X>
4C.X<
4
a.X<
5b.X>
4c.X<
4
6IfXisinteger,whichofthefollowingistheterminationconditionforthefollowingloop?
6如果X是整数,下面哪个是终止条件下面的循环吗?
repeat(...)until(X<
5)
重复(。
直到(X<
5)
4C.X>
5
4c.X>
5
7.IfNisinteger,whichofthefollowingistheterminationconditioninthefollowingrecursiveprocedure?
7。
如果N是整数,下面哪个是终止条件在接下来的递归程序吗?
procedurexxx(N)
程序xxx(N)
if(N<
5)then(applytheprocedurexxxtothevalueN+1)
如果(N<
5)然后(应用程序xxx值N+1)
else(printthevalueofN)
其他(打印N值)
A.N<
5B.N>
4C.N<
a.N<
5b.N>
4c.N<
8Whichofthefollowingdoesnotprintthesamesequenceofnumbersastheothers?
8以下不打印相同的数字序列为其他人呢?
5A.XB.4X5C.X
54c.X5b.Xa.X
6)dowhile(X<
5)dorepeat(printthevalueofX;
6)在(X<
5)做重复(打印X的值;
(printthevalueofX;
X+1;
(XX+1)X
X+1)X+1,X(打印X的值;
(X
X+1)XprintthevalueofX)until(X>
6)
X+1)打印X的值),直到(XX>
6)
9.Whichofthefollowingisnotawayofrepresentingalgorithms?
9。
下列哪一项不是代表算法的方式吗?
A.StepwiserefinementB.PseudocodeC.FlowchartD.Programminglanguage
a.逐步求精b.c.流程图d.编程语言的伪代码
10.WhichalgorithmswouldfindthenameKellymorequicklyinthelist:
John,Kelly,Lewis,Maurice,Nathan,Oliver,Pat,Quincy,Roger,Stan,Tom?
10。
这算法会发现这个名字凯利在列表中更快:
约翰,凯莉,刘易斯,莫里斯,内森,奥利弗,帕特,昆西,罗杰,斯坦,汤姆?
A.sequentialsearchB.binarysearch
a.顺序搜索b.二进制搜索
Fill-in-the-blank/Short-answerQuestions
填空/简答题
1.Anorderedcollectionofunambiguous,executablestepsthatdefinesaterminatingprocessiscalledA,andtherepresentationofanalgorithmisB.TheactionofexecutingaprogramisC.
一个命令收集的明确的、可执行的步骤,定义了一个终止过程被称为,代表一个算法是B。
执行程序的作用是C。
2.Whatsequenceofvalueswillbeprintedwhenthefollowinginstructionsareexecuted?
什么值序列将打印当以下执行指令?
5;
X
5;
X
if(X<
7)then(printthevalue6;
如果(X<
7)然后(打印值6;
6)Y
6)Y
else(printthevalue4;
其他(打印值4;
4)Y
4)Y
if(Y<
5)then(printthevalue3)
如果(Y<
5)然后(打印值3)
else(printthevalue2)
其他(打印值2)
_______________________
改善
3.WhatsequenceofvalueswouldbeprintediftheprocedurexxxdescribedbelowwereexecutedwithN=9?
什么值序列将印刷如果程序xxx下面描述被N=9?
4)then(printthevalueofN;
4)然后(打印N值;
applytheprocedureyyytothevalue7)
应用程序yyy价值7)
else(applytheprocedureyyytothevalue2;
其他应用程序(yyy值2;
printthevalueofN)
打印N值)
procedureyyy(N)
程序yyy(N)
5)then(printthevalueofN;
5)然后(打印N值;
applytheprocedurezzztothevalue6)
应用程序打鼾声到值6)
else(applytheprocedurezzztothevalue5)
其他(应用程序打鼾声价值5)
procedurezzz(N)
程序打鼾声(N)
if(N=5)then(printthevalue7)
如果(N=5)然后(打印值7)
else(printthevalue8)
其他(打印值8)
________________________
________________________
4.WhenusingbinarysearchalgorithmtosearchfortheletterXwithinthelist:
R,S,T,U,V,W,Z.Howmanyentrieswillbecheckedbeforediscoveringthattheletterisnotinthelist?
____________
当使用二进制搜索算法搜索的字母X在列表:
R、S、T,U、V、W,z.有多少条目将被发现,这封信之前检查未在列表中呢?
_______
5.WhenusingsequentialsearchalgorithmtosearchfortheletterXwithinthelist:
当使用顺序搜索算法搜索的字母X在列表:
6.SupposethebinarysearchalgorithmwasbeingusedtosearchfortheentryTominthelist:
6。
假设二进制搜索算法被用于搜索条目汤姆在列表中:
Nathan,Oliver,Pat,Quincy,Rodger,Stan,Tom
内森,奥利弗,帕特,昆西,罗杰,斯坦,汤姆
A.Whatwouldbethefirstentryinthelisttobeconsidered?
_____________
a.这将成为第一个条目列表中被认为是吗?
_________________
B.Whatwouldbethesecondentryinthelisttobeconsidered?
b.什么是第二个条目列表中被认为是吗?
7.Atmost,howmanyentriesinalistof5000nameswillbeinterrogatedwhenusingthesequentialsearchalgorithm?
___________
最多,有多少条目列表的5000个名字将审讯当使用顺序搜索算法?
___________
8.WhichofthesequentialorbinarysearchalgorithmswouldfindthenameRogerinthefollowinglistmorequickly?
8。
哪个顺序或二进制搜索算法会发现这个名字罗杰在下面的列表更快吗?
John,Kelly,Lewis,Maurice,Nathan,Oliver,Pat,Quincy,Roger,Stan,Tom
约翰·
凯利,刘易斯,莫里斯,内森,奥利弗,帕特,昆西,罗杰,斯坦,汤姆
_______________
售予
ANSWER:
Binary
答:
二进制
9.WhatsequenceofnumberswouldbeprintedifthefollowingprocedurewereexecutedwithN=0?
什么数字序列将印刷如果下列程序被N=0?
while(N<
4)do
虽然(N<
4)做的
(printthevalueofN;
(打印N值;
N+2;
N
N+2;
N
printthevalueofN
打印N值
)
)
__________________
_____________
10.WhatsequenceofnumberswouldbeprintedifthefollowingprocedurewereexecutedwithN=0?
printthevalueofN;
打印N值;
5)then(applytheprocedurexxxtothevalueN+2);
5)然后(应用程序xxx值N+2);
11.WhatsequenceofnumberswouldbeprintediftheprocedurexxxwereexecutedwithN=2?
11。
什么数字序列将印刷如果程序xxx被N=2?
procedurexxx(N)procedureyyy(N)
程序xxx(N)程序yyy(N)
printthevalueofN;
3)applytheprocedurexxxtothevalue5;
3)应用程序xxx价值5;
then(applyprocedureyyyprintthevalueofN
然后(应用程序yyy打印N值
tothevalue4);
价值4);
_____________________
_____________________
12.Fillintheblankintheprocedurebelowsothattheprocedureprintstheintegersfrom0uptotheintegervalueitwasgivenforN.Thatis,iftheprocedureisexecutedwithN=3,itshouldprint0,1,2,3.
12。
填写空白在程序下面,以便程序打印整数从0到整数值是给出N.也就是说,如果执行的程序与N=3,它应该打印0、1、2、3。
if(_________)then(applytheprocedurexxxtothevalueN-1);
如果(__)然后(应用程序xxx值N-1);
Chapter6.ProgrammingLanguages
第六章。
编程语言
1.Mostmachinelanguagesarebasedonthe.
大多数机器语言是基于。
A.ImperativeparadigmB.Declarativeparadigm
a.命令式范式b.声明范例
C.FunctionalparadigmD.Object-orientedparadigm
c.功能范式d.面向对象的范例
2.WhichofthefollowingdoesnotrequireaBooleanstructure?
下列哪个不需要一个布尔结构?
A.If-then-elsestatementB.Whileloopstatement
a.是以if-then-else语句b.While循环语句
C.AssignmentstatementD.Forloopstatement
c.赋值语句d.For循环语句
3.Whichofthefollowingisnotacontrolstatement?
下列哪一项不是控制语句?
4.Whichofthefollowingisnotastepintheprocessoftranslatingaprogram?
下列哪一项不是步骤在翻译过程中一个程序吗?
A.ExecutingtheprogramB.Parsingtheprogram
a.执行程序b.解析程序
C.LexicalanalysisD.Codegeneration
c.词法分析d.代码生成
5.Whichofthefollowingisnotassociatedwithobject-orientedprogramming?
下列哪个不是面向对象编程相关?
A.InheritanceB.ResolutionC.EncapsulationD.Polymorphism
abc继承决议封装d多态性
6.Positionswithinarraysareidentifiedbymeansofnumberscalled.
数组内的位置确定通过数字称。
A.IndicesB.ParametersC.InstancevariablesD.Constants
a.指数b.参数c.实例变量d.常量
7.Whichofthefollowingisignoredbyacompiler?
以下是一个编译器忽略了吗?
A.ControlstatementsB.Declarationsofconstants
a.控制语句b.声明的常量
C.ProcedureheadersD.Commentstatements
c程序头d.注释语句
8.Whichofthefollowingisnotawayofreferringtoavalueinaprogram?
下列哪一项不是方法能够引用一个值在一个程序吗?
A.VariableB.LiteralC.ConstantD.Type
abc.常数d变量文字类型
9.Whichofthefollowingisthescopeofavariable?
以下是一个变量的范围?
A.Thenumberofcharactersinthevariable’sname
a中的字符数变量的名字
B.Theportionoftheprograminwhichthevariablecanbeaccessed
b.的部分计划,这些变量可以被访问
C.Thetypeassociatedwiththevariable
c类型相关的变量
D.Thestructureassociatedwiththevariable
d.的结构相关的变量
10.Whichofthefollowingisameansofnullifyingconflictsamongdatatypes?
以下是一个消除的方法之间的冲突的数据类型?
A.InheritanceB.ParsingC.CoercionD.Codeoptimization
abc继承解析胁迫d.代码优化
11.Whichofthefollowingisnotconstructedbyatypicalcompiler?
下列哪个不是通过一个典型的编译器构造吗?
A.SourcecodeB.SymboltableC.ParsetreeD.Objectprogram
abc源代码符号表解析树d.目标程序
12.Whichofthefollowingisameansofdefiningsimilarbutdifferentclassesinanobject-orientedprogram?
以下是一个意味着定义相似但不同的类在一个面向对象的程序?
1.Indicatehoweachofthefollowingtypesofprogramminglanguagesisclassifiedintermsofgeneration(firstgeneration,secondgenera