多选题Given the following class, which statements can be inserted at position 1 without causing the code to fail compilation?()   public class Q6db8 {   int a;   int b = 0;   static int c;   public void m() {   int d;   int e = 0;   // Position 1   }   }Aa++

题目
多选题
Given the following class, which statements can be inserted at position 1 without causing the code to fail compilation?()   public class Q6db8 {   int a;   int b = 0;   static int c;   public void m() {   int d;   int e = 0;   // Position 1   }   }
A

a++;

B

b++;

C

c++;

D

d++;

E

e++;


相似考题
更多“Given the following class, which statements can be inserted ”相关问题
  • 第1题:

    Given:Which code, inserted at line 15, allows the class Sprite to compile?()

    A.Foo { public int bar() { return 1; }

    B.new Foo { public int bar() { return 1; }

    C.new Foo() { public int bar() { return 1; }

    D.new class Foo { public int bar() { return 1; }


    参考答案:C

  • 第2题:

    Which two statements are true about the hashCode method?()

    • A、 The hashCode method for a given class can be used to test for object equality and object inequality for that class.
    • B、 The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.
    • C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.
    • D、 The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
    • E、 The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

    正确答案:C,E

  • 第3题:

    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }  

    • A、c = b;
    • B、c = this.a;
    • C、c = this.b;
    • D、c = Q4a39.this.a;
    • E、c = c;

    正确答案:A,D

  • 第4题:

    Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?()   class A {}   class B extends A {}   class C extends A {}   public class Q3ae4 {   public static void main(String args[]) {   A x = new A();   B y = new B();   C z = new C();   // insert statement here   }   } 

    • A、x = y;
    • B、z = x;
    • C、y = (B) x;
    • D、z = (C) y;
    • E、y = (A) y;

    正确答案:C

  • 第5题:

    Which the following two statements are true?()

    • A、 An inner class may be declared as static.
    • B、 An anonymous inner class can be declared as public.
    • C、 An anonymous inner class can be declared as private.
    • D、 An anonymous inner class can extend an abstract class.
    • E、 An anonymous inner class can be declared as protected.

    正确答案:A,D

  • 第6题:

    单选题
    Which of the following statements concerning energy is correct?()
    A

    Energy can be created or destroyed

    B

    Energy may not be transformed

    C

    The total quantity of energy in the universe is always the same

    D

    None of the above


    正确答案: D
    解析: 暂无解析

  • 第7题:

    单选题
    Several @functions can execute multiple statements. Which one of the following initializes a variable and can increment in during the operation?()
    A

     @do 

    B

     @for 

    C

     @while 

    D

     @dowhile 


    正确答案: A
    解析: 暂无解析

  • 第8题:

    多选题
    Given the following class, which statements can be inserted at position 1 without causing the code to fail compilation?()   public class Q6db8 {   int a;   int b = 0;   static int c;   public void m() {   int d;   int e = 0;   // Position 1   }   }
    A

    a++;

    B

    b++;

    C

    c++;

    D

    d++;

    E

    e++;


    正确答案: A,D
    解析: 暂无解析

  • 第9题:

    单选题
    Which statements, when inserted at the indicated position in the following code, will cause a runtime exception when attempting to run the program?()   class A {}   class B extends A {}   class C extends A {}   public class Q3ae4 {   public static void main(String args[]) {   A x = new A();   B y = new B();   C z = new C();   // insert statement here   }   }
    A

    x = y;

    B

    z = x;

    C

    y = (B) x;

    D

    z = (C) y;

    E

    y = (A) y;


    正确答案: C
    解析: 暂无解析

  • 第10题:

    多选题
    Which statements can be inserted at the indicated position in the following code to make the program write 1 on the standard output when run?()  public class Q4a39 {  int a = 1;   int b = 1;   int c = 1;   class Inner {   int a = 2;  int get() {   int c = 3;   // insert statement here  return c;   }   }  Q4a39() {   Inner i = new Inner();   System.out.println(i.get());  }   public static void main(String args[]) {   new Q4a39();   }   }
    A

    c = b;

    B

    c = this.a;

    C

    c = this.b;

    D

    c = Q4a39.this.a;

    E

    c = c;


    正确答案: A,D
    解析: 暂无解析

  • 第11题:

    单选题
    Given: Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
    A

    Point p = new Point();

    B

    Line.Point p = new Line.Point();

    C

    The Point class cannot be instatiated at line 15.

    D

    Line l = new Line() ; l.Point p = new l.Point();


    正确答案: D
    解析: 暂无解析

  • 第12题:

    单选题
    Which of the following statements is NOT true about mass communication?
    A

    It can reach no further than human voice.

    B

    It can reach a large audience.

    C

    It is rapid and efficient.

    D

    It can be trusted.


    正确答案: B
    解析:
    最后一段指出思想传播的速度、距离和受众都发生了变化,大约200年前,人们所说的话并不能比其声音传播的更远,而非指的是mass communication(大众传媒)。

  • 第13题:

    Given a subnet mask of 255.255.255.224, which of the following addresses can be assigned to network hosts?()

    A.15.234.118.63

    B.92.11.178.93

    C.134.178.18.56

    D.192.168.16.87

    E.201.45.116.159

    F.217.63.12.192


    参考答案:B, C, D

  • 第14题:

    Which two statements are true?()

    • A、 An inner class may be declared as static.
    • B、 An anonymous inner class can be declared as public.
    • C、 An anonymous inner class can be declared as private.
    • D、 An anonymous inner class can extend an abstract class.
    • E、 An anonymous inner class can be declared as protected.

    正确答案:A,D

  • 第15题:

    Several @functions can execute multiple statements. Which one of the following initializes a variable and can increment in during the operation?()

    • A、 @do 
    • B、 @for 
    • C、 @while 
    • D、 @dowhile 

    正确答案:B

  • 第16题:

    Which two statements about the best effort model for QoS are true?()

    • A、delay sensitive packets are given preferential treatment
    • B、the default policy identifies a delay sensitive class and default class
    • C、the default policy identifies a delay sensitive class, best effort class, and default class
    • D、the model is highly scalable
    • E、the model is still predominant on the internet F the model provides guaranteed service

    正确答案:D,E

  • 第17题:

    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() 

    • A、 The declaration on line 2 does not allocate memory space for the variable myVect.
    • B、 The declaration on line 2 allocates memory space for a reference to a Vector object.
    • C、 The statement on line 2 creates an object of class Vector.
    • D、 The statement on line 3 creates an object of class Vector.
    • E、 The statement on line 3 allocates memory space for an object of class Vector.

    正确答案:A,D,E

  • 第18题:

    多选题
    Given: Which two methods, inserted independently at line 17, correctly complete the Sales class?()
    A

    double getSalesAmount() { return 1230.45; }

    B

    public double getSalesAmount() { return 1230.45; }

    C

    private double getSalesAmount() { return 1230.45; }

    D

    protected double getSalesAmount() { return 1230.45; }


    正确答案: B,D
    解析: 暂无解析

  • 第19题:

    单选题
    Given: Which code, inserted at line 14, allows the Sprite class to compile?()
    A

    Direction d = NORTH;

    B

    Nav.Direction d = NORTH;

    C

    Direction d = Direction.NORTH;

    D

    Nav.Direction d = Nav.Direction.NORTH;


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    Which statements are true, given the code new FileOutputStream("data", true) for creating an object of class FileOutputStream?()
    A

    FileOutputStream has no constructors matching the given arguments.

    B

    An IOExeception will be thrown if a file named data already exists.

    C

    An IOExeception will be thrown if a file named data does not already exist.

    D

    If a file named data exists, its contents will be reset and overwritten.

    E

    If a file named data exists, output will be appended to its current contents.


    正确答案: D
    解析: 暂无解析

  • 第21题:

    多选题
    Which two statements are true?()
    A

    An inner class may be declared as static.

    B

    An anonymous inner class can be declared as public.

    C

    An anonymous inner class can be declared as private.

    D

    An anonymous inner class can extend an abstract class.

    E

    An anonymous inner class can be declared as protected.


    正确答案: D,B
    解析: 暂无解析

  • 第22题:

    多选题
    Which the following two statements are true?()
    A

    An inner class may be declared as static.

    B

    An anonymous inner class can be declared as public.

    C

    An anonymous inner class can be declared as private.

    D

    An anonymous inner class can extend an abstract class.

    E

    An anonymous inner class can be declared as protected.


    正确答案: E,A
    解析: 暂无解析

  • 第23题:

    多选题
    Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()
    A

    The declaration on line 2 does not allocate memory space for the variable myVect.

    B

    The declaration on line 2 allocates memory space for a reference to a Vector object.

    C

    The statement on line 2 creates an object of class Vector.

    D

    The statement on line 3 creates an object of class Vector.

    E

    The statement on line 3 allocates memory space for an object of class Vector.


    正确答案: B,C
    解析: SL-275中指出:要为一个新对象分配空间必须执行new Xxx()调用,new调用执行以下的操作: 
    1.为新对象分配空间并将其成员初始化为0或者null。 
    2.执行类体中的初始化。(例如在类中有一个成员声明int a=10;在第一步后a=0 ,执行到第二步后a=10)    
    3.执行构造函数。 
    4.变量被分配为一个到内存堆中的新对象的引用。

  • 第24题:

    多选题
    Which two statements are true about the hashCode method?()
    A

    The hashCode method for a given class can be used to test for object equality and object inequality for that class.

    B

    The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.

    C

    The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.

    D

    The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.

    E

    The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.


    正确答案: E,B
    解析: 暂无解析