Multiple Choice
Which of the following creates the string of the numbers from 1 to 1000 most efficiently?
A) String s;
For (int i = 1;i <= 1000;i++)
S += i;
B) StringBuilder sb = new StringBuilder(10) ;
For (int i = 1;i <= 1000;i++)
Sb) append(i) ;
String s = new String(sb) ;
C) StringBuilder sb = new StringBuilder(3000) ;
For (int i = 1;i <= 1000;i++)
Sb) append(i) ;
String s = new String(sb) ;
D) All are equivalently efficient.
Correct Answer:

Verified
Correct Answer:
Verified
Q1: Given the following declaration: <br>StringBuilder buf =
Q3: To find the character at a certain
Q4: Which of the following statements is true?<br>A)
Q5: The length of a string can be
Q5: Which of the following are static Character
Q6: Consider the examples below: <br>A. a string.<br>B.
Q10: Consider the statement below:<br>StringBuilder sb1 = new
Q12: Which class is not a type-wrapper class?<br>A)
Q15: Consider the Java segment: <br>String line1 =
Q17: StringBuilder objects can be used in place