问题 单项选择题

下列程序运行后的输出结果是( )。
public class Sun

public static void main(String args[])

int i,j,s;
s=0;
for(i=1;i<=3;i++)
for(j=0;j<=i-1;j++)
s=s+1;
System.out.println(s);

A.6

B.5

C.4

D.3

答案

参考答案:A

解析: 本题考查对for循环语句理解。第1重for循环共有3次,第2重for循环共有2次,所以总共执行6次循环,每次循环s的值加1,因此s=6。故本题答案是A。

完形填空
完形填空。
      John left the United States in 1969 to work in Africa. Africa was hot. When John  1  to the United
States in 1979, he said to himself, " It's much  2   here than it was before I left. I'm going to  3  an electric
heater (电热器). Besides, everything is much more  4 ."
      John went to a store the next day to buy an electric heater. The salesman  5   him three or four  6  
kinds and then said, " And this is our best electric heater. It  7  a lot, but it  8  half of your electricity (电),
and electricity is very expensive now, isn't it?"
     "Yes, it's very expensive," John answered, " and it's becoming  9  every year." He looked at the
electric heater carefully, thought for a few seconds and then said, "Well, I'll take  10  of these, then I'll
save all of my electricity."
( )1. A. wrote  
( )2. A. hotter  
( )3. A. buy    
( )4. A. modern  
( )5. A. borrowed
( )6. A. old    
( )7. A. has    
( )8. A. saves  
( )9. A. better  
( )10. A. one    
B. pointed
B. colder  
B. see    
B. simple  
B. lent    
B. bad    
B. gets    
B. needs  
B. worse  
B. two    
C. listened
C. better  
C. make    
C. expensive
C. sold    
C. same    
C. costs    
C. becomes  
C. hotter  
C. four    
D. returned  
D. noisier    
D. sell      
D. beautiful  
D. showed    
D. different  
D. brings    
D. produces  
D. cheaper    
D. three                                 
单项选择题