77范文网 - 专业文章范例文档资料分享平台

达内java2015.11第一次月考(附答案).doc(4)

来源:网络收集 时间:2020-04-21 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

1

o

B.

2

o

C.

3

o

D.

4

正确答案:A

? 33.

(单选)下面的代码用于对数组arr实现冒泡排序: for (int i = 0; i < arr.length - 1; i++) { boolean isSwap = false; 空白处 if (!isSwap) break; } 下列选项中,空白处可以填入的代码是:()。

o

A.

for (int j = arr.length - 1; j > i; j--) { if (arr[j] < arr[j - 1]) { int temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; isSwap = true; } }

o

B.

for (int j = arr.length - 1; j > 0; j--) { if (arr[j] < arr[j - 1]) { int temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; isSwap = true; } }

o

C.

for (int j = i + 1; j< arr.length; j++) { if (arr[j] < arr[j - 1]) { int temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; isSwap = true; } }

o

D.

for (int j = i; j< arr.length; j++) { if (arr[j] < arr[j - 1]) { int temp = arr[j]; arr[j] = arr[j - 1]; arr[j - 1] = temp; isSwap = true; } }

正确答案:C

? 34.

(单选)请看下列代码: class Payload { private int weight; public Payload(int wt) { weight = wt; } public Payload() {} public void setWeight(int w) { weight = w; } public String toString() { return Integer.toString(weight); } } public class TestPayload { static void changePayload(Payload p) { <插入代码> } public static void main(String[] args) { Payload p = new Payload(); p.setWeight(1024); changePayload(p); System.out.println(\假设运行后输出“The value of p is 420”,那么<插入代码>处应填入代码是:

o

A.

p.setWeight(420);

o

B.

Payload.setWeight(420);

o

C.

p = new Payload(420);

o

D.

p = new Payload(); p.setWeight(420);

正确答案:D

? 35.

(单选)下列代码运行的结果是()。 public class Base { public static final String FOO = \public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO);

System.out.print(s.FOO); System.out.print(((Base) s).FOO); } } class Sub extends Base { public static final String FOO = \

o

A.

foofoofoofoofoo

o

B.

foobarfoobarbar

o C.

foobarfoofoofoo

o

D.

foobarfoobarfoo

正确答案:C

? 36.

(多选)请看下列代码: public abstract class Shape { int x; int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } 下列选项中能正确使用Shape类的是:

o

A.

public class Circle implements Shape { private int radius; }

o

B.

public abstract class Circle extends Shape { private int radius; }

o

C.

public class Circle extends Shape { private int radius; public void draw(); }

o

D.

public class Circle extends Shape { private int radius; public void draw() {/* code here */} }

正确答案:BCD

? 37.

(多选)在Java语言中,下列说法正确的是()。

o

A.

一个接口可以继承多个接口

o

B.

一个类可以继承多个类

o

C.

一个类可以实现多个接口

o

D.

一个类可以有多个子类

正确答案:ACD

? 38.

(多选)请看下列代码: package com.tarena; public class Geodetics { public static final double DIAMETER = 12756.32; } 访问静态常量DIAMETER的方式正确的是:

o

A.

import com.tarena.Geodetics; public class TerraCarta { public double halfway(){ return Geodetics.DIAMETER/2.0; } }

o

B.

import com.tarena.Geodetics; public class TerraCarta { public double halfway(){ return DIAMETER/2.0; } }

o

C.

import com.tarena; public class TerraCarta { public double halfway(){ return Geodetics.DIAMETER/2.0; } }

o

D.

import com.tarena.*; public class TerraCarta { public double halfway(){ return Geodetics.DIAMETER/2.0; } }

正确答案:AD

? 39.

(多选)请看下列代码 public class Foo { public void method(String str,int age){} } 和Foo类中method方法重载的方法是:

o

A.

public int method(String str,int age){}

o

B.

public void method(String s,int year){}

o

C.

public void method(int year,String s){}

o

D.

public int method(int year,String s){}

正确答案:ACD

? 40.

(多选)在<插入代码>处,填入下列代码编译正确的是: public void foo(int[] x) { <插入代码> }

o

A.

foreach(int z : x) System.out.println(z);

o

B.

for(int z : x) System.out.println(z);

o

C.

while( x.hasNext()) System.out.println( x.next());

o

D.

for( int i=0; i< x.length; i++ ) System.out.println(x[i]);

正确答案:BD

? 41.

(多选)查看如下代码: class A { protected int method (int a, int b) { return 0; } } 下列选项中,可以在 A 的子类中使用的是()。

o

A.

public int method (int a, int b) { return 0; }

o

B.

private int method(int a, int b) { return 0; }

o

C.

private int method(int a, long b) { return 0; }

o

D.

public short method(int a, int b) { return 0; }

正确答案:AC

? 42.

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库达内java2015.11第一次月考(附答案).doc(4)在线全文阅读。

达内java2015.11第一次月考(附答案).doc(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/1002377.html(转载请注明文章来源)
上一篇:CVI8.5介绍
下一篇:力学计算专题
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: