11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?() A、 assert value == null;B、 assert value !null, “va

题目

11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?() 

  • A、 assert value == null;
  • B、 assert value !null, “value is null”;
  • C、 if (value == null) { throw new AssertionException(”value is null”);
  • D、 if (value == null) { throw new IllegalArgumentException(”value is null”);

相似考题
更多“11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?() A、 assert value == null;B、 assert value !null, “val”相关问题
  • 第1题:

    Which 4 statements regarding MPLS Label Stack Encoding is true?()

    • A、A value of 4 represents the "Implicit NULL Label."
    • B、A value of 0 represents the "IPv4 Explicit NULL Label."
    • C、A value of 1 represents the "Router Alert Label". The use of this label is analogous to the use of the"Router Alert Option" in IP packets (for example, ping with record route option)
    • D、A value of 2 represents the "IPv6 Explicit NULL Label"
    • E、A value of 1 represents the "IPv1 Explicit NULL Label"
    • F、A value of 3 represents the "Implicit NULL Label"

    正确答案:B,C,D,F

  • 第2题:

    Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()

    • A、An IllegalStateException is thrown at runtime.
    • B、An InvalidSessionException is thrown at runtime.
    • C、The string "value=null" appears in the response stream.
    • D、The string "value=myAttributeValue" appears in the response stream.

    正确答案:A

  • 第3题:

    11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()  

    • A、 Line 13
    • B、 Line 14
    • C、 Line 18
    • D、 Line 20

    正确答案:D

  • 第4题:

    String foo = “blue”;  Boolean[]bar = new Boolean [1];  if (bar[0])  {  foo = “green”;  }   What is the result? () 

    • A、 Foo has the value of “”
    • B、 Foo has the value of null.
    • C、 Foo has the value of “blue”
    • D、 Foo has the value of “green”
    • E、 An exception is thrown.
    • F、 The code will not compile.

    正确答案:F

  • 第5题:

    Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()

    • A、assert value == null;
    • B、assert value != null, "value is null";
    • C、if (value == null) { throw new AssertionException("value is null"); }
    • D、if (value == null) { throw new IllegalArgumentException("value is null"); }

    正确答案:D

  • 第6题:

    You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()

    • A、Define the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.
    • B、Define the new column as NOT NULL with a default value of ’Undefined.’
    • C、Define the new column as NULL. Use application logic to enforce the data constraint.
    • D、Define the new column as NULL with a default value of ’Undefined.’

    正确答案:B

  • 第7题:

    多选题
    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
    解析: 暂无解析

  • 第8题:

    单选题
    String foo = “blue”;    Booleanbar = new Boolean [1];    if (bar[0]) {    foo = “green”;    }   What is the result?()
    A

     Foo has the value of “”

    B

     Foo has the value of null.

    C

     Foo has the value of “blue”

    D

     Foo has the value of “green”

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第9题:

    多选题
    You need to design the restrictions on the Bank.Customers table. Which three actions should you perform?()
    A

    Design a trigger that verifies that the first names and surnames are not empty strings.

    B

    Design a check constraint that verifies that the first names and surnames are not empty strings.

    C

    Design a check constraint that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.

    D

    Design a trigger that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.

    E

    Design a check constraint that ensures that the phone number cannot be changed from a valid format to a null value or to an invalid format.

    F

    Design a trigger that ensures that the phone number cannot be changed from a valid format to a null value.


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

  • 第10题:

    单选题
    11. public void someMethod(Object value) {  12. // check for null value ....  20. System.out.println(value.getClass());  21. }  What, inserted at line 12, is the appropriate way to handle a null value?()
    A

     assert value == null;

    B

     assert value !null, “value is null”;

    C

     if (value == null) { throw new AssertionException(”value is null”);

    D

     if (value == null) { throw new IllegalArgumentException(”value is null”);


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

  • 第11题:

    多选题
    Which 4 statements regarding MPLS Label Stack Encoding is true?()
    A

    A value of 4 represents the Implicit NULL Label.

    B

    A value of 0 represents the IPv4 Explicit NULL Label.

    C

    A value of 1 represents the Router Alert Label. The use of this label is analogous to the use of theRouter Alert Option in IP packets (for example, ping with record route option)

    D

    A value of 2 represents the IPv6 Explicit NULL Label

    E

    A value of 1 represents the IPv1 Explicit NULL Label

    F

    A value of 3 represents the Implicit NULL Label


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

  • 第12题:

    单选题
    11. public class Test {  12. public void foo() {  13. assert false;  14. assert false;  15. }  16. public void bar(){  17. while(true){  18. assert false;  19. }  20. assert false;  21. }  22. }  What causes compilation to fail?()
    A

     Line 13

    B

     Line 14

    C

     Line 18

    D

     Line 20


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

  • 第13题:

    1. public class SimpleCalc {  2. public int value;  3. public void calculate() { value += 7; }  4. } And:  1. public class MultiCalc extends SimpleCalc {  2. public void calculate() { value -= 3; }  3. public void calculate(int multiplier) {  4. calculate();  5. super.calculate();  6. value *=multiplier;  7. }  8. public static void main(String[] args) {  9. MultiCalc calculator = new MultiCalc();  10. calculator.calculate(2);  11. System.out.println(”Value is: “+ calculator.value);  12. }  13. }  What is the result?() 

    • A、 Value is: 8
    • B、 Compilation fails.
    • C、 Value is: 12
    • D、 Value is: -12
    • E、 The code runs with no output.
    • F、 An exception is thrown at runtime.

    正确答案:A

  • 第14题:

    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

  • 第15题:

    int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()

    • A、 Foo has the value of 0.
    • B、 Foo has the value of null.
    • C、 Foo has the value of true.
    • D、 Foo has the value of false.
    • E、 An exception is thrown.
    • F、 The code will not compile.

    正确答案:D

  • 第16题:

    10. public class Hello {  11. String title;  12. int value;  13. public Hello() {  14. title += “ World”;  15. }  16. public Hello(int value) {  17. this.value = value;  18. title = “Hello”;  19. Hello();  20. }  21. }  and:  30. Hello c = new Hello(5);  31. System.out.println(c.title);  What is the result?() 

    • A、 Hello
    • B、 Hello World
    • C、 Compilation fails.
    • D、 Hello World 5
    • E、 The code runs with no output.
    • F、 An exception is thrown at runtime.

    正确答案:C

  • 第17题:

    You need to design the restrictions on the Bank.Customers table. Which three actions should you perform?()

    • A、Design a trigger that verifies that the first names and surnames are not empty strings.
    • B、Design a check constraint that verifies that the first names and surnames are not empty strings.
    • C、Design a check constraint that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.
    • D、Design a trigger that uses a CLR user-defined function to verify that either the phone number is a null value or the format of the phone number is valid.
    • E、Design a check constraint that ensures that the phone number cannot be changed from a valid format to a null value or to an invalid format.
    • F、Design a trigger that ensures that the phone number cannot be changed from a valid format to a null value.

    正确答案:B,C,F

  • 第18题:

    单选题
    Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()
    A

    assert value == null;

    B

    assert value != null, value is null;

    C

    if (value == null) { throw new AssertionException(value is null); }

    D

    if (value == null) { throw new IllegalArgumentException(value is null); }


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

  • 第19题:

    单选题
    Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()
    A

    assert value == null;

    B

    assert value != null, value is null;

    C

    if (value == null) { throw new AssertionException(value is null); }

    D

    if (value == null) { throw new IllegalArgumentException(value is null); }


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

  • 第20题:

    单选题
    Given the definition of MyServlet: 11.public class MyServlet extends HttpServlet { 12.public void service(HttpServletRequest request, 13.HttpServletResponse response) 14.throws ServletException, IOException { 15.HttpSession session = request.getSession(); 16.session.setAttribute("myAttribute","myAttributeValue"); 17.session.invalidate(); 18.response.getWriter().println("value=" + 19.session.getAttribute("myAttribute")); 20.} 21.} What is the result when a request is sent to MyServlet?()
    A

    An IllegalStateException is thrown at runtime.

    B

    An InvalidSessionException is thrown at runtime.

    C

    The string value=null appears in the response stream.

    D

    The string value=myAttributeValue appears in the response stream.


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

  • 第21题:

    单选题
    You are modifying a table named Product in a SQL Server 2005 database. You want to add a new column named FriendlyName to the Product table. A friendly name for each product will be stored in this column. The table currently contains data. The sales department has not yet created a friendly name for each product. FriendlyName is a required value for each product. You want to add this new column by using the least amount of effort. What should you do?()
    A

    Define the new column as NULL.Update the FriendlyName column to the same value as the productName column. Alter the FriendlyName column to be NOT NULL.

    B

    Define the new column as NOT NULL with a default value of ’Undefined.’

    C

    Define the new column as NULL. Use application logic to enforce the data constraint.

    D

    Define the new column as NULL with a default value of ’Undefined.’


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

  • 第22题:

    单选题
    int index = 1;   boolean test = new Boolean;   boolean foo= test [index];  What is the result?()
    A

     Foo has the value of 0.

    B

     Foo has the value of null.

    C

     Foo has the value of true.

    D

     Foo has the value of false.

    E

     An exception is thrown.

    F

     The code will not compile.


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

  • 第23题:

    单选题
    What is the result?()
    A

     foo has the value””

    B

     foo has the value null.

    C

     An exception is thrown.

    D

     The code will not compile.


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