

第1页 / 共8页

第2页 / 共8页

第3页 / 共8页
试读已结束,还剩5页,您可下载完整版后进行离线阅读
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
浙江大学2021-2022学年夏学期《程序设计基础》课程期末考试试卷课程号:211Z0050,开课学院:计算机学院考试试卷:√A卷、B卷(请在选定项上打√)考试形式:√闭、开卷(请在选定项上打√),允许带/入场考试日期:2022年06月29日,考试时间:120分钟诚信考试,沉着应考,杜绝违纪,考生姓名:学号:所属院系:(注意:答题内容必须写在答题卷上,写在本试题卷上无效)Section 1:single Choice(2 marks for each item,total 20 marks)1.Suppose that a stack is stored in an array VINJ.If the stack is empty,the initial toppointer(初始栈顶指针)isW.When push an element x into the stack,the correctoperation isA.top=top+1;V[top]=x;B.VItop]=x;top=top+1;C.top=top-1;V[top]=x;D.VItop]=x;top=top-1;2.Using a ring buffer to represent a queue(循环队列.The queue is stored in an arrayQ[MAXSIZE]with the head pointer front and the tail pointer rear,where front pointsto the first element and rear to the position next to the last element of the queue.Atthe beginning the queue is empty,front is-1 and rear is 0.When add a new elementx to the queue,the correct operation is_(Suppose that the queue is NOT full.)A.Q[front]x;front front-1;B.Q[front]x;front =(front-1)%MAXSIZE;C.Q[rear]x;rear=rear+1;D.Q[rear]x;rear=(rear +1)%MAXSIZE;3.Given a stack S and a queue Q both with the EMPTY initial status.Elements e1.e2、e3、e4、e5、e6 loop through(依次通过)the statck S.Once an element ispopped out of the stack,it is added to the queue Q immediately.If the 6 elementsleave the queue Q with the order of e.2、e4、e3、e6、e5、e1,the size of the stackS is AT LEAST(至少).A.2B.3C.4D.64.The statementbelow is WRONGA.The variable names in C must be lowercase(and constants uppercase.B.The C program runs by editing,compiling,linking,and executingC.The three basic structures of the C language are sequence,branch and loopD.The C programs must be made up of functions.5.The compilers()usually use the data structure to process the recursivefunction-calling(递归函数调用).A.queueB.arrayC.stackD.record1/8
暂无评论内容