问题 完形填空
完形填空。
     Food is important.Everyone needs to   1   well if he or she wants to have a strong body. Our minds also need a kind
of food.   This kind of food is   2     .   We begin to get knowledge even when  we are young.   Small children are   3    in
everything around them. They learn 4   while they are watching and listening. When they are getting older they begin
to 5      story books, science books…,anything they like. When they find something new, they have to ask questions
and 6   to find out the answers. 
     What is the best 7    to get knowledge? If  we learn   8     ourselves, we will get the most knowledge. If we are   9  
getting answers from others and don't ask  why, we will never learn more and understand   10 .
( )1. A sleep          
( )2. A sport          
( )3. A interested    
( )4. A everybody      
( )5. A lend          
( )6. A try            
( )7. A place          
( )8. A on            
( )9. A seldom(几乎不)
( )10.A harder        
B read        
B exercise    
B interesting
B something  
B write      
B have        
B school      
B with        
B always      
B much        
C drink      
C knowledge  
C weak        
C nothing    
C learn      
C think      
C way        
C to          
C certainly  
C well        
D eat            
D meat            
D good            
D anything        
D read            
D wait            
D road            
D by              
D sometimes      
D better          
答案

1-5 DCADD     6-10 ACDBD

问答题

阅读下列说明和c代码,回答问题1至问题3,将解答写在对应栏内。

[说明]

某应用中需要对100000个整数元素进行排序,每个元素的取值在0~5之间。排序算法的基本思想是:对每一个元素x,确定小于等于x的元素个数(记为m),将x放在输出元素序列的第m个位置。对于元素值重复的情况,依次放入第m-1,m-2,…个位置。例如,如果元素值小于等于4的元素个数有10个,其中元素值等于4的元素个数有3个,则4应该在输出元素序列的第10个位置、第9个位置和第8个位置上。算法的具体步骤如下。

步骤1:统计每个元素值的个数。

步骤2:统计小于等于每个元素值的个数。

步骤3:将输入元素序列中的每个元素放入有序的输出元素序列。

[C代码]

下面是该排序算法的c语言实现。

(1)常量和变量说明

R:常量,定义元素取值范围中的取值个数,如上述应用中R值应取6;

i:循环变量;

n:待排序元素个数;

a:输入数组,长度为n;

b:输出数组,长度为n;

c:辅助数组,长度为R,其中每个元素表示小于等于下标所对应的元素值的个数。

(2)函数sort

1 void sort(int n,int a[],int b[])

2 int c[R],i;

3 for(i=0;i< (1) ;i++)

4 c[i]=0;

5

6 for(i=0;i<n;i++)

7 c[a[i]]= (2)

8

9 for(i=1;i<R;i++)

10 c[i]= (3)

11

12 for(i=0;i<n;i++)

13 b[c[a[i]]-1]= (4)

14 c[a[i]]=c[a[i]]-1;

15

16

根据以上C代码,分析该排序算法是否稳定。若稳定,请简要说明(不超过100字); 若不稳定,请修改其中代码使其稳定(给出要修改的行号和修改后的代码)。

单项选择题 A1/A2型题