中石油华东《面向对象程序设计(Java)》17年秋学期在线作业(三)
1.下列叙述中,正确的是()。A.声明变量时必须指定一个类型中石油答案
B.Java认为变量number与Number相同
C.Java中唯一的注释方式是"//"
D.源文件中public类可以有0或多个
正确答案:A满分:5分
2.
publicclassTest2006{
publicstaticvoidmain(Stringargs[]){System.out.println(~(0xa5)&amp0xaa)}
}
其运行结果是()。
A.0xa5
B.10
C.0x50
D.0xaa
正确答案:B满分:5分
3.结构化程序设计的一种基本方法是()。
A.筛选法
B.递归法
C.归纳法
D.逐步求精法
正确答案:D满分:5分
4.&nbsp
设有下面两个类的定义:
&nbsp&nbsp&nbsp&nbsp
class
&nbsp
Person{
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
class
&nbsp
Student
&nbsp
extends
&nbsp
Person{
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
long
&nbsp&nbsp&nbsp
id
&nbsp&nbsp&nbsp&nbsp
//
身份证号
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
int
&nbsp
score
&nbsp
//
入学总分
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
String
&nbsp
name
&nbsp&nbsp
//
姓名
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
int
&nbsp
getScore(){
&nbsp&nbsp&nbsp&nbsp&nbsp
}
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
return
&nbsp
score
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
}
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
}
问:类
Person
和类
Student
的关系是(
&nbsp&nbsp&nbsp&nbsp&nbsp
)。
A.包含关系
B.继承关系
C.关联关系
D.无关系,上述类定义有语法错误
正确答案:B满分:5分
更多学习资料请登录www.openhelp100.com
页:
[1]