网络程序设计java 第一次课堂检测

InetAddress类的作用

(1.0分)
A、
实现主机名与IP地址的关联

B、
•实现目标主机的连通性探测

我的答案:A
2
isReachable使用ICMP协议

(1.0分)
A、
正确

B、
错误

我的答案:A
3
以下哪个InetAddress的getByName方法使用是正确的

(1.0分)
A、
InetAddress inet = new InetAddress.getByName(“www.xupt.edu.cn”);

B、
InetAddress inet = InetAddress.getByName(“www.xupt.edu.cn”);

我的答案:A
4
使用getByName实例化对象时,如果使用的IP地址不符合规则,例如(“322.24.12.700”),则会抛出什么异常

(1.0分)
A、
UnknowHostException

B、
IllegalArgumentException

我的答案:A
5
使用InetAddress.getAddress()获得对象IP地址为"222.24.12.128",如

byte[] bytes =
addr.getAddress();//获取字节数组形式的

那么通过语句的结果为

for(byte b: bytes)System.out.print(b+".");

(1.0分)
A、
222.24.12.128.

B、
-34.24.12.-128.

我的答案:B
6
Java通过以下( )调用外部ping命令

(1.0分)
A、
Runtime.getEnvironment().exec(“ping -c 1 222.24.101.1”)

B、
Runtime.getRuntime().exec(“ping -c 1 222.24.101.1”)

我的答案:B
7
在JAVA语言中( )是给按钮组件增加一个按键监听 该按键是否被按下事件

(1.0分)
A、
button.addActionListener(new ActionListener());

B、
button.addClickListener(new ActionListener());

我的答案:A
8
( )是申明Vector对象内元素为String类型的语句

(1.0分)
A、
Vector rs = new Vector();

B、
Vector String rs = new Vector(10);

我的答案:B
9
在Java中使用implement Runnable接口的类实例化对象后,以下哪项是错误的

class WorkLine implement Runnable{}

(1.0分)
A、
WorkLine wl = new WorkLine();

wl.start();

B、
WorkLine wl = new WorkLine();

Thread t = new Thread(wl);

t.start();

我的答案:A
二、多选题 (题数:1,共 1.0 分)
1
在JAVA的网络编程中,需要引入以下哪个类库

(1.0分)
A、
java.io.*

B、
java.util.*

C、
java.net.*

我的答案:B

猜你喜欢

转载自blog.csdn.net/ferrysoul/article/details/106088410
今日推荐