第五章单元测试
  1. 看下面一段语句块,执行结果是:

    ……

    int res=0;

    for(int i=1; i<=100; i++){

      if(i%2==0)

          continue;

      res+=i;

    }

    System.out.println(res);

    ……




  2. A:1 B:5050 C:2550 D:2500

    答案:2500

  3. 以下Java的条件、循环结构的写法,有输出效果、且没有错误的有哪些?


  4. A:……     if(true){     System.out.println("hello");  }    …… B:……  if(true)    System.out.println("hello");   …… C:……    if(true);  {    System.out.println("hello");    }    …… D:……    while(1){    System.out.println("hello");  }    ……
  5. Java语言中,使用大括号包裹一块语句块,像for、if等循环、条件结构,都必须使用大括号包裹语句块。


  6. A:错 B:对
  7. continue用来退出循环。


  8. A:错 B:对
  9. 以下关于程序调试的说法错误的是


  10. A:throw可以抛出错误 B:assert断言功能常用于单元测试 C:exception类需要自定义 D:try...catch...可以捕获错误

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(3) dxwkbang
返回
顶部