多选题Which of the following statements about variables and their scopes are true? ()AInstance variables are member variables of a class.BInstance variables are declared with the static keyword.CLocal variables defined inside a method are created when the me

题目
多选题
Which of the following statements about variables and their scopes are true? ()
A

Instance variables are member variables of a class.

B

Instance variables are declared with the static keyword.

C

Local variables defined inside a method are created when the method is executed.

D

Local variables must be initialized before they are used.


相似考题
更多“多选题Which of the following statements about variables and their scopes are true? ()AInstance variables are member variables of a class.BInstance variables are declared with the static keyword.CLocal variables defined inside a method are created when the me”相关问题
  • 第1题:

    In C language,(70)variables have to be defined outside of any function, this(71)actual storage for it.

    A.internal

    B.export

    C.output

    D.external


    正确答案:D
    解析:译文:C语言中,外部变量必须在所有函数体之外定义,并为之分配实际内存空间。

  • 第2题:

    Which three statements are true?()

    • A、 The default constructor initializes method variables.
    • B、 The default constructor has the same access as its class.
    • C、 The default constructor invoked the no-arg constructor of the superclass.
    • D、 If a class lacks a no-arg constructor, the compiler always creates a default constructor. 
    • E、 The compiler creates a default constructor only when there are no other constructors for the class.

    正确答案:B,C,E

  • 第3题:

    Which two statements are true regarding the creation of a default constructor?() 

    • A、 The default constructor initializes method variables.
    • B、 The compiler always creates a default constructor for every class.
    • C、 The default constructor invokes the no-parameter constructor of the superclass.
    • D、 The default constructor initializes the instance variables declared in the class.
    • E、 When a class has only constructors with parameters, the compiler does not create a default constructor.

    正确答案:D,E

  • 第4题:

    Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();

    • A、One object is created
    • B、Two objects are created
    • C、Three objects are created
    • D、One reference variable is created
    • E、Two reference variables are created
    • F、Three reference variables are created.

    正确答案:B,F

  • 第5题:

    Which of the following statements about variables and scope are true?() 

    • A、 Local variables defined inside a method are destroyed when the method is exited.
    • B、 Local variables are also called automatic variables.
    • C、 Variables defined outside a method are created when the object is constructed.
    • D、 A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

    正确答案:A,B,C

  • 第6题:

    Which statement is true?()

    • A、 An anonymous inner class may be declared as final.
    • B、 An anonymous inner class can be declared as private.
    • C、 An anonymous inner class can implement multiple interfaces.
    • D、 An anonymous inner class can access final variables in any enclosing scope.
    • E、 Construction of an instance of a static inner class requires an instance of the enclosing outer class.

    正确答案:D

  • 第7题:

    Which of the following statements about variables and their scopes are true? ()   

    • A、 Instance variables are member variables of a class.
    • B、 Instance variables are declared with the static keyword.
    • C、 Local variables defined inside a method are created when the method is executed.
    • D、 Local variables must be initialized before they are used.

    正确答案:A,C,D

  • 第8题:

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

    The default constructor initializes method variables.

    B

    The default constructor has the same access as its class.

    C

    The default constructor invoked the no-arg constructor of the superclass.

    D

    If a class lacks a no-arg constructor, the compiler always creates a default constructor.

    E

    The compiler creates a default constructor only when there are no other constructors for the class.


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

  • 第9题:

    多选题
    Which two are true about has-a and is-a relationships?()
    A

    Inheritance represents an is-a relationship.

    B

    Inheritance represents a has-a relationship.

    C

    Interfaces must be used when creating a has-a relationship.

    D

    Instance variables can be used when creating a has-a relationship.


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

  • 第10题:

    多选题
    Given that Thing is a class, how many objects and reference variables are created by the following code?()   Thing item, stuff;   item = new Thing();   Thing entity = new Thing();
    A

    One object is created

    B

    Two objects are created

    C

    Three objects are created

    D

    One reference variable is created

    E

    Two reference variables are created

    F

    Three reference variables are created.


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

  • 第11题:

    多选题
    Which two statements are true regarding the creation of a default constructor?()
    A

    The default constructor initializes method variables.

    B

    The compiler always creates a default constructor for every class.

    C

    The default constructor invokes the no-parameter constructor of the superclass.

    D

    The default constructor initializes the instance variables declared in the class.

    E

    When a class has only constructors with parameters, the compiler does not create a default constructor.


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

  • 第12题:

    单选题
    Which of the following environment variables specifies a non-default location for the listener configuration file?()
    A

    LSN_ADMIN

    B

    TNS_ADMIN

    C

    ADMIN_TNS

    D

    TSN_ADMIN


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

  • 第13题:

    Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?()  

    • A、Member variables of the outer instance are always accessible to inner instances, regardless of their      accessibility modifiers.
    • B、Member variables of the outer instance can never be referred to using only the variable name within     the inner instance.
    • C、More than one inner instance can be associated with the same outer instance.
    • D、All variables from the outer instance that should be accessible in the inner instance must be declared     final.
    • E、A class that is declared final cannot have any inner classes.

    正确答案:A,C

  • 第14题:

    Which two statements are true regarding the creation of a default constructor?()   

    • A、 The default constructor initializes method variables.
    • B、 The default constructor invokes the no-parameter constructor of the superclass.
    • C、 The default constructor initializes the instance variables declared in the class.
    • D、 If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a default constructor.
    • E、 The compiler creates a default constructor only when there are no other constructors for the class.

    正确答案:C,E

  • 第15题:

    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  

    • A、The value of an int is undetermined.
    • B、The value of all numeric types is zero.
    • C、The compiler may issue an error if the variable is used before it is initialized.
    • D、The value of a String variable is "" (empty string).
    • E、The value of all object variables is null.

    正确答案:B,E

  • 第16题:

    状态变量 (state variables)


    正确答案: 指描述系统的变量集合。

  • 第17题:

    Which two are true about has-a and is-a relationships?()

    • A、 Inheritance represents an is-a relationship.
    • B、 Inheritance represents a has-a relationship.
    • C、 Interfaces must be used when creating a has-a relationship.
    • D、 Instance variables can be used when creating a has-a relationship.

    正确答案:A,D

  • 第18题:

    You execute the following commands to audit database activities: SQL > ALTER SYSTEM SET AUDIT_TRIAL=DB, EXTENDED SCOPE=SPFILE; SQL > AUDIT SELECT TABLE, INSERT TABLE, DELETE TABLE BY JOHN By SESSION WHENEVER SUCCESSFUL; Which statement is true about the audit record that generated when auditing after instance restarts?()

    • A、One audit record is created for every successful execution of a SELECT, INSERT OR DELETE command on a table, and contains the SQL text for the SQL Statements.
    • B、One audit record is created for every successful execution of a SELECT, INSERT OR DELETE command, and contains the execution plan for the SQL statements.
    • C、One audit record is created for the whole session if john successfully executes a SELECT, INSERT, or DELETE command, and contains the execution plan for the SQL statements.
    • D、One audit record is created for the whole session if JOHN successfully executes a select command, and contains the SQL text and bind variables used.
    • E、One audit record is created for the whole session if john successfully executes a SELECT, INSERT,or DELETE command on a table, and contains the execution plan, SQL text, and bind variables used.

    正确答案:A

  • 第19题:

    单选题
    Which statement is true?()
    A

     An anonymous inner class may be declared as final.

    B

     An anonymous inner class can be declared as private.

    C

     An anonymous inner class can implement multiple interfaces.

    D

     An anonymous inner class can access final variables in any enclosing scope.

    E

     Construction of an instance of a static inner class requires an instance of the enclosing outer class.


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

  • 第20题:

    多选题
    Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()
    A

    The value of an int is undetermined.

    B

    The value of all numeric types is zero.

    C

    The compiler may issue an error if the variable is used before it is initialized.

    D

    The value of a String variable is  (empty string).

    E

    The value of all object variables is null.


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

  • 第21题:

    多选题
    Which statements concerning the correlation between the inner and outer instances of non-static inner classes are true?()
    A

    Member variables of the outer instance are always accessible to inner instances, regardless of their      accessibility modifiers.

    B

    Member variables of the outer instance can never be referred to using only the variable name within     the inner instance.

    C

    More than one inner instance can be associated with the same outer instance.

    D

    All variables from the outer instance that should be accessible in the inner instance must be declared     final.

    E

    A class that is declared final cannot have any inner classes.


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

  • 第22题:

    多选题
    Which of the following statements about variables and their scopes are true? ()
    A

    Instance variables are member variables of a class.

    B

    Instance variables are declared with the static keyword.

    C

    Local variables defined inside a method are created when the method is executed.

    D

    Local variables must be initialized before they are used.


    正确答案: B,D
    解析: 类中有几种变量,分别是:局部变量(英文可以为:local/automatic/temporary/stack variable)是定义在方法里的变量;实例变量(英文为:instance variable)是在方法外而在类声明内定义的变量,有时也叫成员变量;类变量(英文为:class variable)是用关键字static声明的实例变量,他们的生存期分别是:局部变量在定义该变量的方法被调用时被创建,而在该方法退出后被撤销;实例变量在使用new Xxxx()创建该类的实例时被创建,而其生存期和该类的实例对象的生存期相同;类变量在该类被加载时被创建,不一定要用new Xxxx()创建,所有该类的实例对象共享该类变量,其生存期是类的生存期。任何变量在使用前都必须初始化,但是需要指出的是局部变量必须显式初始化,而实例变量不必,原始类型的实例变量在该类的构造方法被调用时为它分配的缺省的值,整型是0,布尔型是false,而浮点型是0.0f,引用类型(类类型)的实例变量的缺省值是null(没有进行实际的初始化,对它的使用将引起NullPointException),类变量的规则和实例变量一样,不同的是类变量的初始化是在类被加载时。

  • 第23题:

    多选题
    Which two statements are true regarding the creation of a default constructor?()
    A

    The default constructor initializes method variables.

    B

    The default constructor invokes the no-parameter constructor of the superclass.

    C

    The default constructor initializes the instance variables declared in the class.

    D

    If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a default constructor.

    E

    The compiler creates a default constructor only when there are no other constructors for the class.


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

  • 第24题:

    多选题
    Which of the following statements about variables and scope are true?()
    A

    Local variables defined inside a method are destroyed when the method is exited.

    B

    Local variables are also called automatic variables.

    C

    Variables defined outside a method are created when the object is constructed.

    D

    A method parameter variable continues to exist for as long as the object is needed in which the method is defined.


    正确答案: B,D
    解析: 本题是讨论变量的类型及作用域。