NEED A PERFECT PAPER? PLACE YOUR FIRST ORDER AND SAVE 15% USING COUPON:

SOLVED

Section 16.2 Fundamentals of Characters and Strings 16.2 Q1: Consider the examples below: a string. ‘a string’. “a string”. “1234”. integer. Which could be the value of a Java variable of type String? A and B. B and E. B and C. C and D. 16.2 Q2: An anonymous String: has no value. is a string literal. can be changed. none of the above. Section 16.3 Class String None Section 16.3.1 String Constructors 16.3.1 Q1: A String constructor cannot be passed variables of type: char arrays. int arrays. byte arrays. Strings. 16.3.1 Q2: String objects are immutable. This means they: Must be initialized. Cannot be deleted. Cannot be changed. None of the above Section 16.3.2 String Methods length, charAt and getChars 16.3.2 Q1: The length of a string can be determined by: The String method length(). The String instance variable length. The String method strlen(). All of the above. 16.3.2 Q2: How many String objects are instantiated by the following code segment (not including the literals)? String s1, output; s1 = “hello”; output = “\nThe string reversed is: “; for ( int i = s1.length() – 1; i >= 0; i– ) Â Â output += s1.charAt( i ) + ” ” ; 1. 4. 5. 7. Section 16.3.3 Comparing Strings 16.3.3 Q1: The statement s1.equalsIgnoreCase( s4 ) is equivalent to which of the following? a. s1.regionMatches( true, 0, s4, 0, s4.length() ); b. s1.regionMatches( 0, s4, 0, s4.length() ); c. s1.regionMatches( 0, s4, 0, s4.length ); d. s1.regionMatches( true, s4, 0, s4.length ); 16.3.3 Q2: The statement s1.startsWith( “art” ) has the same result as which of the following? a. s1.regionMatches( 0, “art”, 0, 3 ); b. s2 = s1.getChars( 0, 3 ); s2.equals( “art” ); c. s1.regionMatches( true, 0, “art”, 0, 3 ); d. All of the above Section 16.3.4 Locating Characters and Substrings in Strings 16.3.4 Q1: For String c = “hello world”; The Java statements int i = c.indexOf( ‘o’ ); int j = c.lastIndexOf( ‘l’ ); will result in: i = 4 and j = 8. i = 5 and j = 8. i = 4 and j = 9. i = 5 and j = 9. 16.3.4 Q2:Â For String c = “Hello. She sells sea shells”; The Java statements int i = c.indexOf( “ll” ); int j = c.lastIndexOf( “ll” ); will result in: i = 2 and j = 24. i = 3 and j = 24. i = 2 and j = 25. i = 3 and j = 23.

Solution:

15% off for this assignment.

Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!

Why US?

100% Confidentiality

Information about customers is confidential and never disclosed to third parties.

Timely Delivery

No missed deadlines – 97% of assignments are completed in time.

Original Writing

We complete all papers from scratch. You can get a plagiarism report.

Money Back

If you are convinced that our writer has not followed your requirements, feel free to ask for a refund.