If possible please suggest further improvement of the String class.Question 3:Given a link list, detect whether it's circular using only one loop.Tips: Below implementation is allowedfor( ... ){...}The following implementations is NOT allowed...for( ... )

题目

If possible please suggest further improvement of the String class.

Question 3:

Given a link list, detect whether it's circular using only one loop.

Tips: Below implementation is allowed

for( ... )

{

...

}

The following implementations is NOT allowed

...

for( ... )

{

...

for( ... ) {...}

}

...

or

...

for( p = list->head, q = list->head; p != NULL && q != NULL; p = p->next )

{

...

}

...

for( ... )

{

...

}


相似考题
参考答案和解析
正确答案:
 
更多“If possible please suggest further improvement of the String class.Question 3:Given a link list, detect whether it's circular using only one loop.Tips: Below implementation is allowedfor( ... ){...}The following implementations is NOT allowed...for( ... )”相关问题
  • 第1题:

    Simplify the following Boolean expression

    !((i ==12) || (j > 15))

    struct Node {

    int value;

    Node* next;

    };

    1.1 Get the value of the Nth node from last node in the linked list.

    PARAM HEAD: the first element in the linked list:

    PARAM n: the number of the node counted reversely

    RETURN: the value of the node, or -1 if not exists

    int GetValue(Node* HEAD, int n)

    {

    }

    1.2 Delete a node WITHOUT using the HEAD pointer.

    PARAM p: A pointer pointed to a node in the middle of the linked list.

    RETURN: void

    void Delete(Node* p)

    {

    }

    1.3 Insert a new node before p WITHOUT using the HEAD pointer

    PARAM p: A pointer pointed to a node in the middle of the linked list.

    PARAM value: new Node value

    RETURN: void

    void Insert(Node* p, int value)

    {

    }

    Question 2:

    Please write a String class with following features:


    正确答案:
     

  • 第2题:

    下列语句能给数组赋值,而不使用for循环的是

    A.myArray{[1]="One";[2]="Two";[3]="Three";}

    B.String s[5]=new String[] {"Zero","One","Two","Three","Four"};

    C.String s[]=new String[] {"Zero","One","Two","Three","Four"};

    D.String s[]=new String[]= {"Zero","One","Two","Three","Four"};


    正确答案:C
    解析:字符串数组赋初值的方法有两种,一种是如选项C一样初始化。另外一种是先为每个数组元素分配引用空间,再为每个数组元素分配空间并赋初值。例如还可做如下赋值:
      string s[]=new String[5];
      s[0]="Zero";
      s[1]="One";
      s[2]="Two";
      s[3]="Three";
      s[4]="Four";

  • 第3题:

    Which statement about using McAfee and Webroot together is true?() 

    • A、it is not recommended: the system will not detect more malware
    • B、it is notpossible : the WSA will accept only one anti-malware license
    • C、the system will stop all web-based threats
    • D、it is recommended: the system will detect more malware

    正确答案:D

  • 第4题:

    For the following statements, which one is perceived as a drawback of implementing Fibre ChannelAuthentication Protocol (FCAP)?()

    • A、It is restricted in size to only three segments
    • B、It requires the use of netBT as the network protocol
    • C、It requires the implementation of IKE
    • D、It relies on an underlying Public Key Infrastructure

    正确答案:D

  • 第5题:

    Which one of the following describes who will be able to see an existing doc that contains a readers field ?()

    • A、only those people listed in the access list
    • B、anyone listed as a reader or above in the acl
    • C、only those people list in the readers field
    • D、anyone list as a reader or above in the acl and who is also list in the readers field

    正确答案:D

  • 第6题:

    Please tell possible problems following the implementation of EDFA.


    正确答案:

    Optical surge: it tends to threaten the security of human being and optical modules; Non-linear effect: ultra-large power is opt to cause four wave mixing effect and reduce the signal to noise ratio. Bandwidth: the bandwidth of EDFA restricts bandwidth extension of DWDM system. Dispersion: EDFA only amplifies optical power but dispersion, hence failing to solve the dispersion problem.

  • 第7题:

    Which method implementations will write the given string to a file named "file", using UTF8 encoding?()   IMPLEMENTATION a:   public void write(String msg) throws IOException {   FileWriter fw = new FileWriter(new File("file"));   fw.write(msg);   fw.close();   }   IMPLEMENTATION b:   public void write(String msg) throws IOException {   OutputStreamWriter osw =  new OutputStreamWriter(new FileOutputStream("file"), "UTF8");  osw.write(msg);   osw.close();   }   IMPLEMENTATION c:   public void write(String msg) throws IOException {  FileWriter fw = new FileWriter(new File("file"));   fw.setEncoding("UTF8");   fw.write(msg);   fw.close();  }   IMPLEMENTATION d:   public void write(String msg) throws IOException {  FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8");   fw.write(msg);  fw.close();   }   IMPLEMENTATION e:   public void write(String msg) throws IOException {   OutputStreamWriter osw = new OutputStreamWriter(  new OutputStream(new File("file")), "UTF8"  );   osw.write(msg);   osw.close();   }  

    • A、Implementation a.
    • B、Implementation b.
    • C、Implementation c.
    • D、Implementation d.
    • E、Implementation e.

    正确答案:B

  • 第8题:

    Which of the following is an advantage of using virtualization to consolidate servers?()

    • A、Reduced power and space requirements
    • B、Saves money on software costs
    • C、Maintenance is easier because there is only one server
    • D、Fewer instances of the operating system to maintain

    正确答案:A

  • 第9题:

    单选题
    Which method implementations will write the given string to a file named "file", using UTF8 encoding?()   IMPLEMENTATION a:   public void write(String msg) throws IOException {   FileWriter fw = new FileWriter(new File("file"));   fw.write(msg);   fw.close();   }   IMPLEMENTATION b:   public void write(String msg) throws IOException {   OutputStreamWriter osw =  new OutputStreamWriter(new FileOutputStream("file"), "UTF8");  osw.write(msg);   osw.close();   }   IMPLEMENTATION c:   public void write(String msg) throws IOException {  FileWriter fw = new FileWriter(new File("file"));   fw.setEncoding("UTF8");   fw.write(msg);   fw.close();  }   IMPLEMENTATION d:   public void write(String msg) throws IOException {  FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8");   fw.write(msg);  fw.close();   }   IMPLEMENTATION e:   public void write(String msg) throws IOException {   OutputStreamWriter osw = new OutputStreamWriter(  new OutputStream(new File("file")), "UTF8"  );   osw.write(msg);   osw.close();   }
    A

    Implementation a.

    B

    Implementation b.

    C

    Implementation c.

    D

    Implementation d.

    E

    Implementation e.


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

  • 第10题:

    单选题
    The author of the passage would be most likely to agree with which of the following statements about the Milankovitch theory?
    A

    It is the only possible explanation for the ice ages.

    B

    It is too limited to provide a plausible explanation for the ice ages, despite recent research findings.

    C

    It cannot be tested and confirmed until further research on volcanic activity is done.

    D

    It is one plausible explanation, though not the only one, for the ice ages.

    E

    It is not a plausible explanation for the ice ages, although it has opened up promising possibilities for future research.


    正确答案: E
    解析:
    推断题。最后一段第一句指出:…it is important to note that other factors…could potentially have affected the climate,可知虽然作者认为Milankovitch理论为冰淇提供了一种解释,但是它并不是唯一的,故D项的叙述是正确的。

  • 第11题:

    单选题
    For the following statements, which one is perceived as a drawback of implementing Fibre ChannelAuthentication Protocol (FCAP)?()
    A

    It is restricted in size to only three segments

    B

    It requires the use of netBT as the network protocol

    C

    It requires the implementation of IKE

    D

    It relies on an underlying Public Key Infrastructure


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

  • 第12题:

    单选题
    Which statement about using McAfee and Webroot together is true?()
    A

    it is not recommended: the system will not detect more malware

    B

    it is notpossible : the WSA will accept only one anti-malware license

    C

    the system will stop all web-based threats

    D

    it is recommended: the system will detect more malware


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

  • 第13题:

    Please make the implementation as simple as possible. Only help functions and classes from

    standard C&C++ may be used to aid your implementation.


    正确答案:
     

  • 第14题:

    It is not possible to determine whether both continents are moving in opposite directions or whether one continent is stationary and the other is drifting away from it.


    正确答案:
    63. 【译文】无法断定两个大陆是在朝相反的方向运动,还是一个大陆停止不动而另一个从它身边漂移开去。
    【解析】此句翻译时注意 it是形式主语,  to 引导的不定式短语是真正主语,注意两个whether从句的选择关系,以及后一个从句中两个小句所描述的相对关系。determine后面跟的是whether... or whether...引导的选择关系的从句。注意后面whether从句中有两个分句,用 and连接,其中the other 指的是 the other continent。
    重点词:  determine确定,断定;continent 大陆;stationary 静止的,固定的

  • 第15题:

    Which of the following IOS commands can detect whether the SQL slammer virus propagates in yournetworks?()

    • A、access-list 100 permit any any udp eq 1434
    • B、access-list 100 permit any any udp eq 1434 log
    • C、access-list 110 permit any any udp eq 69
    • D、access-list 110 permit any any udp eq 69 log
    • E、None of above.

    正确答案:B

  • 第16题:

    You are using AutoQoS Enterprise and realize that the results are not what you expected. Whichof the following are possible reasons for AutoQoS not functioning correctly?(Choose all thatapply.)()

    • A、The interface you configured for AutoQoS is set to half-duplex
    • B、AutoQoS was configured on only one end of the link
    • C、The interface you configured for AutoQoS has no IP address
    • D、The interface’s bandwidth is not correctly configured
    • E、CEF is not enabled on the interface
    • F、You enabled AutoQoS on the interface but forgot to enable globally first

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

  • 第17题:

    Which two statements are true about the security-related tags in a valid Java EE deployment descriptor?()

    • A、Every  tag must have at least one  tag.
    • B、A  tag can have many  tags.
    • C、A given  tag can apply to only one  tag.
    • D、A given  tag can contain from zero to many  tags.
    • E、It is possible to construct a valid  tag such that,for a given resource,no user rolescan access that resource.

    正确答案:B,E

  • 第18题:

    For the following attempts, which one is to ensure that no one employee becomes a pervasive securitythreat, that data can be recovered from backups, and that information system changes do not compromisea system’s security?()

    • A、Strategic security planning
    • B、Disaster recovery
    • C、Implementation security
    • D、Operations security

    正确答案:D

  • 第19题:

    Which of the following fragments might cause errors?()    

    • A、 String s = "Gone with the wind";String t = " good ";String k = s + t;
    • B、 String s = "Gone with the wind";String t;t = s[3] + "one";
    • C、 String s = "Gone with the wind";String standard = s.toUpperCase();
    • D、 String s = "home directory";String t = s - "directory";

    正确答案:B,D

  • 第20题:

    单选题
    The TPC curve,one of the hydrostatic curves in a vessel’s plans,gives the number of tons().
    A

    necessary to change the angle of list 1°at a given draft

    B

    necessary to change trim 1 cm at a given draft

    C

    pressure per square cm on the vessel's hull at a given draft

    D

    necessary to further immerse the vessel 1 cm at a given draft


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

  • 第21题:

    多选题
    Which of the following fragments might cause errors?()
    A

    String s = Gone with the wind;String t =  good ;String k = s + t;

    B

    String s = Gone with the wind;String t;t = s[3] + one;

    C

    String s = Gone with the wind;String standard = s.toUpperCase();

    D

    String s = home directory;String t = s - directory;


    正确答案: A,B
    解析: A:String类型可以直接使用+进行连接运算。 
    B:String是一种Object,而不是简单的字符数组,不能使用下标运算符取其值的某个元素,错误。 
    C://toUpperCase()方法是String对象的一个方法,作用是将字符串的内容全部转换为大写并返回转换后的结果(String类型)。    
    D://String类型不能进行减(-)运算,错误。

  • 第22题:

    单选题
    Which of the following sets of consonants differs only in one distinctive feature? _____
    A

    [v][z][3][θ]

    B

    [t][z][ʃ][ð]

    C

    [s][v][ɜ][p]

    D

    [p][d][z][S]


    正确答案: A
    解析:
    A组辅音音标都为摩擦音。

  • 第23题:

    单选题
    Which of the following IOS commands can detect whether the SQL slammer virus propagates in yournetworks?()
    A

    access-list 100 permit any any udp eq 1434

    B

    access-list 100 permit any any udp eq 1434 log

    C

    access-list 110 permit any any udp eq 69

    D

    access-list 110 permit any any udp eq 69 log

    E

    None of above.


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