问题 单项选择题

下面程序段的输出结果是( )。 public class Test {public static void main ( String[] args) { int result=0; for ( int i=1;i<=5;i++) {if ( i%2==0 ) continue;result + =i; }System. out. println ("result is " + result );} }

A.result is 7

B.result is 8

C.result is 9

D.result is 10

答案

参考答案:C

解析: continue语句跳过循环体中下面尚未执行的语句,回到循环体的开始继续下轮循环。所以题目中程序实现的是求1到5的所有奇数的和,即1+3+5=9,所以选C。

判断题
单项选择题

In the United States, the first day nursery was opened in 1854. Nurseries were established in various areas during the (91) half of the 19th century; most of (92) were charitable. Both in Europe and in the U. S. , the day-nursery movement received great (93) during the First World War, when (94) of manpower caused the industrial employment of unprecedented numbers of women. In some European countries nurseries were established (95) in munitions (军火)plants, under direct government sponsorship. (96) the number of nurseries in the U.S. also rose (97) , this rise was accomplished without government aid of any kind. During the years following the First World War, (98) , Federal, State, and local governments gradually began to exercise a measure of control (99) the day nurseries by (100) them and by inspecting and regulating the conditions within the nurseries.
The (101) of the Second World War was quickly followed by an increase in the number of day nurseries in almost all countries, as women were (102) called upon to replace men in the factories. On this (103) the U. S. government immediately came to the support of the nursery schools, (104) $6,000,000 in July, 1942, for a nursery school program for the children of working mothers. Many States and local communities (105) this Federal aid. By the end of the war, in August, 1945, more than 100,000 children were being cared (106) in day-care centers receiving Federal (107) Soon afterward, the Federal government (108) cut down its expenditures for this purpose and later (109) them, causing a sharp drop in the number of nursery schools in operation. However, the expectation that most employed mothers would leave their (110) at the end of the war was only partly fulfilled.

A.again

B.thus

C.repeatedly

D.yet