Exam 7: Characters, Strings, and the Stringbuilder

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

String oneStr = "Welcome Jim" String twoStr = "Welcome Joe" Given the lines of code above, which of the following regionMatches() expressions will result in a value of true?

(Multiple Choice)
4.8/5
(64)

Explain what is needed to declare a String variable and provide an example.

(Essay)
4.9/5
(70)

Besides Double and Integer, other wrapper classes such as Float and Long also provide ____ methods that convert Strings to the wrapper types.

(Multiple Choice)
4.9/5
(68)

Describe how a reference is used in Java.

(Essay)
4.9/5
(70)

Match each term with the correct statement below. -Change the length of a string in a StringBuilder object

(Multiple Choice)
4.8/5
(60)

yourCounty = "perry"; yourCounty.equals("Perry"); yourCounty.equalsIgnoreCase("Perry"); Using the above statements, what value will be returned by the equals() method? What will be the value of the equalsIgnoreCase() method? Explain how the equalsIgnoreCase() method can be useful when users type responses to prompts in programs.

(Essay)
4.9/5
(81)

Match each term with the correct statement below. -Add characters at a specific location within a StringBuilder object

(Multiple Choice)
5.0/5
(82)

Match each term with the correct statement below. -A named object of the String class

(Multiple Choice)
4.9/5
(74)

Any string value that is input into a program can be used in arithmetic operations.

(True/False)
4.8/5
(93)

Match each term with the correct statement below. -Determines whether a specific character occurs within a String

(Multiple Choice)
4.9/5
(81)

How can you use String methods to change the case of a string? Provide an example.

(Essay)
4.7/5
(76)

Methods that return information about an object are called accessor methods.

(True/False)
4.9/5
(85)

The ____________________ method and the startsWith() method each take a String argument and return true or false if a String object does or does not end or start with the specified argument, respectively.

(Short Answer)
4.9/5
(91)

String firstCompare = "Oak Maple Pine" String secondCompare = "spruce maple elm" firstCompare.regionMatches(false, 4, secondCompare, 7, 5) Using the above code, what will be the Boolean value after execution of the regionMatches statement? Explain how the Strings are compared using the regionMatches() method.

(Essay)
4.8/5
(72)

The terms "literal string" and "string literal" are entirely different in Java programming.

(True/False)
4.8/5
(82)

What is the purpose of the replace() method? Provide an example.

(Essay)
4.8/5
(68)

import javax.swing.JOptionPane; public class Practice { public static void main(String[] args) { String fullName; char firstLetter; ____ ____ } } Accepting a String from a user is common practice. Using the above code, write the statements to accept a String response from a user. Prompt the user with "Enter your name". Then use the charAt() method to extract the first character of the String.

(Short Answer)
4.7/5
(66)

Match each term with the correct statement below. -A memory block

(Multiple Choice)
4.8/5
(66)

The creators of Java chose ____ characters as the "extra" length for a StringBuilder object.

(Multiple Choice)
4.9/5
(79)

When using the prewritten equals() method, a true or false comparison between two Strings is returned, but you do not know how the code looks behind the scenes.

(True/False)
4.9/5
(77)
Showing 21 - 40 of 73
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)