单选题Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()  public class Q76a9 {   static String f() {   String

题目
单选题
Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()  public class Q76a9 {   static String f() {   String a = "hello";   String b = "bye"; // (0)   String c = b + "!"; // (1)   String d = b;  b = a; // (2)   d = a; // (3)   return c; // (4)  }   public static void main(String args[]) {   String msg = f();   System.out.println(msg); // (5)   }   }
A

The line marked (1).

B

The line marked (2).

C

The line marked (3).

D

The line marked (4).

E

The line marked (5).


相似考题
参考答案和解析
正确答案: D
解析: 暂无解析
更多“Which is the earliest line in the following code after which”相关问题
  • 第1题:

    Given:Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

    A.Point p = Line.getPoint();

    B.Line.Point p = Line.getPoint();

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

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


    参考答案:D

  • 第2题:

    According to the passage,which of the following was the earliest kind of exchange of wealth

    A.Bartered foods
    B.Fiat money
    C.Coin currency
    D.Intangible forms

    答案:A
    解析:

  • 第3题:

    helga is working with a multi-value field that has numeric values in a list. she would like to apply a formula to each item in the list, return the list which one of the following @fuctions can she use to accomplish this with one line of code?()

    • A、@transform  
    • B、@Listprocess  
    • C、@processlist 
    • D、@listevaluate

    正确答案:A

  • 第4题:

    Which of the following is a secure method of remote access via command line?()

    • A、RCP
    • B、Telnet
    • C、RSH
    • D、SSH

    正确答案:D

  • 第5题:

    Which of the following can be used to insert a new line below the current line inside a vi session?()

    • A、o
    • B、a
    • C、p
    • D、A

    正确答案:A

  • 第6题:

    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

  • 第7题:

    You create a Web page named TestPage.aspx and a user control named TestUserControl.ascx. TestPage.aspx uses TestUserControl.ascx as shown in the following line of code. On TestUserControl.ascx, you need to add a read-only member named CityName to return the value "New York". You also must add code to TestPage.aspx to read this value. Which two actions should you perform?()

    • A、Add the following line of code to the TestUserControl.ascx.cs code-behind file. public string CityName { get { return "New York"; } } 
    • B、Add the following line of code to the TestUserControl.ascx.cs code-behind file. protected readonly string CityName = "New York"; 
    • C、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.CityName; } 
    • D、Add the following code segment to the TestPage.aspx.cs code-behind file. protected void Page_Load(object sender, EventArgs e) { string s = testControl.Attributes["CityName"]; } 

    正确答案:A,C

  • 第8题:

    You are developing a Windows Communication Foundation (WCF) service to replace an existing ASMX Web service.The WCF service contains the following code segment. (Line numbers are included for reference only.) 01 [ServiceContract( )] 02 03 public interface IEmployeeService 04 { 05 [OperationContract( )] 06 EmployeeInfo GetEmployeeInfo(int employeeID); 07 08 } 09 10 public class EmployeeService : IEmployeeService 11 { 12 13 public EmployeeInfo GetEmployeeInfo(int employeeID) 14 { 15 ... 16 } 17 } 18 19 20 public class EmployeeInfo 21 { 22 ... 23 public int EmployeeID { get; set; } 24 public string FirstName { get; set; } 25 public string LastName { get; set; } 26 27 }The existing Web service returns the EmployeelD as an attribute of the Employeelnfo element in the response XML.You need to ensure that applications can consume the service without code changes in the client. What should you do?()

    • A、Insert the following code at line 02. [DataContractFormat()] Insert the following code at line 22. [DataMember()]
    • B、Insert the following code at line 02. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAtttibute()]
    • C、Insert the following code at line 09. [XmlSerializerFormat()] Insert the following code at line 22. [XmlAttribute()]
    • D、Insert the following code at line 19. [DataContractFormat()] Insert the following code at line 22. [DataMember()]

    正确答案:B

  • 第9题:

    多选题
    31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()
    A

    The instance gets garbage collected.

    B

    The code on line 33 throws an exception.

    C

    The code on line 35 throws an exception.

    D

    The code on line 31 throws an exception.

    E

    The code on line 33 executes successfully.


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

  • 第10题:

    单选题
    Given: Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()
    A

    Line 16

    B

    Line 17

    C

    Line 18

    D

    Line 19


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

  • 第11题:

    多选题
    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.变量被分配为一个到内存堆中的新对象的引用。

  • 第12题:

    单选题
    Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()
    A

     Line 5 will not compile, because void methods cannot be overridden.

    B

     Line 12 will not compile, because there is no version of test() that rakes a charargument.

    C

     The code will compile but will throw an exception at line 12.

    D

     The code will compile and produce the following output: I am an int.

    E

     The code will compile and produce the following output: I am a String.


    正确答案: A
    解析: 在第12行,16位长的char型变量ch在编译时会自动转化为一个32位长的int型,并在运行时传给void test(int i)方法。

  • 第13题:

    Which of the following can be used to insert a new line below the current line inside a vi session?()

    A. o

    B. a

    C. p

    D. A


    参考答案:A

  • 第14题:

    11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 13.for(inti=0;i<10;i++){ 14.intvalue=i*((int)Math.random()); 15.IntegerintObj=newInteger(value); 16.numbers.add(intObj); 17.} 18.System.out.println(numbers); 19.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()

    • A、Line16
    • B、Line17
    • C、Line18
    • D、Line19
    • E、The object is NOT a candidate for garbage collection.

    正确答案:D

  • 第15题:

    31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()

    • A、 The instance gets garbage collected.
    • B、 The code on line 33 throws an exception.
    • C、 The code on line 35 throws an exception.
    • D、 The code on line 31 throws an exception.
    • E、 The code on line 33 executes successfully.

    正确答案:B,C,E

  • 第16题:

    After plugging in and installing drivers for a wireless bar code reader, which of the following is the LAST step needed to configure the device?()

    • A、Install an inventory tracking application.
    • B、Scan the bar code on the reader’s cradle.
    • C、Enable the device in Device Manager.
    • D、Remove any temporary device drivers.

    正确答案:B

  • 第17题:

    Given the following code:     1) public void modify() {     2) int i, j, k;     3) i = 100;     4) while ( i > 0 ) {     5) j = i * 2;  6) System.out.println (" The value of j is " + j );     7) k = k + 1;     8) i--;     9) }  10) }  Which line might cause an error during compilation?()   

    • A、 line 4
    • B、 line 6
    • C、 line 7
    • D、 line 8

    正确答案:C

  • 第18题:

    Which is the earliest line in the following code after which the object created on the line marked (0) will be a candidate for being garbage collected, assuming no compiler optimizations are done? ()  public class Q76a9 {   static String f() {   String a = "hello";   String b = "bye"; // (0)   String c = b + "!"; // (1)   String d = b;  b = a; // (2)   d = a; // (3)   return c; // (4)  }   public static void main(String args[]) {   String msg = f();   System.out.println(msg); // (5)   }   }  

    • A、The line marked (1).
    • B、The line marked (2).
    • C、The line marked (3).
    • D、The line marked (4).
    • E、The line marked (5).

    正确答案:C

  • 第19题:

    You are working with a Windows Communication Foundation (WCF) client application that has a generated proxy named SampleServiceProxy.When the client application is executing, in line 04 of the following code, the channel faults (Line numbers are included for reference only.) 01 SampleServiceProxy proxy = new SampleServiceProxy( ); 02 try 03 { 04 proxy.ProcessInvoice(invoice); 05 } 06 catch 07 { 08 if(proxy.State == CommunicationState.Faulted) 09 { 10 ... 11 } 12 } 13 proxy.UpdateCustomer(customer);You need to return proxy to a state in which it can successfully execute the call in line 13.Which code segment should you use at line 10?()

    • A、proxy.Close();
    • B、proxy = new SampleServiceProxy();
    • C、proxy.Abort();
    • D、proxy.Open();

    正确答案:B

  • 第20题:

    多选题
    Click the Exhibit button.   Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()
    A

    The application will crash.

    B

    The code on line 29 will be executed.

    C

    The code on line 5 of class A will execute.

    D

    The exception will be propagated back to line 27.

    E

    The code on line 5 of class B will execute.


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

  • 第21题:

    单选题
    Which of the following can be used to insert a new line below the current line inside a vi session?()
    A

    o

    B

    a

    C

    p

    D

    A


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

  • 第22题:

    多选题
    You develop a Windows Communication Foundation (WCF) service that employees use to access bonus information.You define the following service contract. (Line numbers are included for reference only.) 01 [ServiceContract(SessionMode = SessionMode.Required)] 02 public interface IFinancialService 03 { 04 [OperationContract] 05 string Login(int employeeID, string passwordHash); 06 07 [OperationContract] 08 double GetBonus(int month); 09 10 [OperationContract(IsTerminating = true)] 11 void Logout( ); 12 } Client application can invoke methods without logging in. You need to ensure that the client applications invoke Login before invoking any other method. You also need to ensure that client applications cannot consume the service after invoking Logout. Which two action should you perform? ()(Each correct answer presents part of the solution. Choose two.)。
    A

    Replace line 04 with the following code. [OperationContract(IsInitiating = false)]

    B

    Replace line 04 with the following code. [OperationContract(IsInitiating = true, IsTerminating = true)]

    C

    Replace line 07 with the following code. [OperationContract(IsInitiating = false)]

    D

    Replace line 10 with the following code. [OperationContract(IsInitiating = false, IsTerminating = true)]


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

  • 第23题:

    单选题
    Which of the following command line utilities allows a technician to create a new directory?()
    A

    RD

    B

    CD

    C

    DIR

    D

    MD


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