极客营9营考试题目.docVIP

  • 22
  • 0
  • 约5.8千字
  • 约 16页
  • 2022-08-30 发布于江苏
  • 举报
极客营9营考试题目 极客营九营第三周考试(100分) 单选题(15题,每题2分,共30分): 1.?在Java中,( ??)类可用于创建链表数据结构的对象 A:LinkedList B:ArrayList C:Collection D:HashMap 2.Java中,以下(? )接口以键_值对的方式存储对象 A:java.util.Collection B:java.util.Map C:java.util.List D:java.util.Set 3.?Java中的集合类包括ArrayList、LinkedList、HashMap等类,下列关于集合类描述错误的是(?)。 A:ArrayList和LinkedList均实现了List接 若要在child类中对addvalue方法进行重写,下面对于child类中的addvalue方法头的描述哪个是正确的: A:int addvalue(int I,int j) B:void addvalue() C:void addvalue(double i) D:int addvalue(int a) 7.在使用super 和this关键字时,以下描述正确的是( ) A:在子类构造方法中使用super()显示调用父类的构造方法,super()必须写在子类构造方法的第一行,否则编译不通过 B:super()和this()不一定要放在构造方法内第一行 C:this()和super()可以同时出现在一个构造函数中 D:this()和super()可以在static环境中使用,包括static方法和static语句块 8.?以下关于final关键字说法错误的是(?) A:final是java中的修饰符,可以修饰类、接口、抽象类、方法和属性 B:final修饰的类肯定不能被继承 C:final修饰的方法不能被重写 D:final修饰的变量不允许被再次赋值 9.以下代码运行输出是( ) public class Person{ private String name=”Person”; int age=0; } public class Child extends Person{ public String grade; public static void main(String[] args){ Person p = new Child(); System.out.println(p.name); } } A:输出:Person B:没有输出 C:编译出错 D:运行出错 10.下以下程序的运行结果是( ) class Person{ public Person(){ System.out.println(“this is a Person”); } } public class Teacher extends Person{ private String name=”tom”; public Teacher(){ System.out.println(“this is a teacher”); super(); } public static void main(String[] args){ Teacher teacher = new Teacher(); System.out.println(this.name); } } A:this is a Person this is a teacher tom? B:this is a teacher this is a Person tom? C:运行出错 D:编译有两处错误 11.?下面关于变量及其范围的陈述哪些是错的。 ( ) A:对象变量是类的成员变量。 B:对象变量用关键字static声明。 C:在方法中定义的局部变量在该方法被执行时创建 D:局部变量在使用前必须被初始化。 12.?以下哪个表达式是不合法的(???) A:String x=”Hello”; int y=9; x+=y; B:String x=”Hello”; int y=9; if(x==y) { } C:String x=”Hello”; int y=9; x=x+y; D:String x=null; boolean y=(x!=null)(x.length()0) 13.下列代码中,将引起一个编译错误的行是?(?? ?? )。 1)public?class?Test{?? 2)?int?m,n;?? 3)?public?Test()?{}?? 4)?public?Test(int?a)?{m=a;}?? 5)?public?static?void?main(String?args[]){?? 6)?Test?t1,t2;?? 7)?in

文档评论(0)

1亿VIP精品文档

相关文档