华师大数据结构期中考试试卷(含答案)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
华东师范大学期中试卷
2007—2008学年第二学期
课程名称:______数据结构_____
姓名:___________________ 学号:__________________
专业:___________________ 年级/班级:__________________
课程性质:专业必修
一、单项选择题(共18分,每题3分)
1. Stack has the property called last in and first out, then which of the following describes the property of Queue
a) Last in and first out
b) First in and last out
c) First in and first out
2. A list of items from which only the item most recently added can be removed is known as a ( )
a) stack
b) queue
c) circular linked list
d) list
3. If the following function is called with a value of 2 for n, what is
the resulting output
void Quiz( int n )
{
if (n > 0)
{
cout << 0;
Quiz(n - 1);
cout << 1;
Quiz(n - 1);
}
}
a) 00011011
b)
c)
d) 01100011
e) 001101
4. A heap is a list in which each entry contains a key, and, for all positions i in the list, the key at position i is at lease as large as the keys in positions 2i+2 and ( ), provided these positions exist in the list.
a) 2i
b) 2i-1
c) 2i-2
d) 2i+1
5. Given the recursive function
int Func( /* in */ int i,
/* in */ int j )
{
if (i < 11)
if (j < 11)
return i + j;
else
return j + Func(i, j - 2);
else
return i + Func(i - 1, j);
}
what is the value of the expression Func(12, 15)
a) 81
b) 62
c) 19
d) 72
e) none of the above
6. Shell sort finally perform an ordinary ( )
a) Heap sort
b) Insertion sort
c) Selection sort
d) Quick sort
二、填空题(共22分,每空2分)
1. If the following function is called with a value of 75 for n, the
resulting output is
_______【1】_________.
void Func( /* in */ int n )
{
if (n > 0)
{
Func(n / 8);
cout << n % 8;
}
}
2. Give the output of the following program. ________【2】__________. template
void print(List_entry &x){
cout< } void main( ){ List for(int i=0;i<5;i++)(i,i); cout<<"Your list have "<<()<<" elements:"< (0,i); (2,i); (i,i); (print); ( ); for(i=1;i<3;i++)(i, i); (print); } 3. Read the following program and fill the blank to complete the method. template struct Node { Post: The current Node pointer references the Node at position . */ { if (current_position <= position) for ( ; current_position != position; current_position++) 【3】 ; else for ( ; current_position != position; 【4】 ) current = current->back; } 4. Read the following program and fill the blank to complete the method.