Quiz

The following questions will test your knowledge of the care and feeding of a string.

Questions

1:

My friend concatenates. Should I report him to the authorities?

  1. No. It's only illegal during the winter months.
  2. Yes, but not until I sell the story to Jerry Springer first.
  3. No. All he's doing is pasting two strings together in a program.
2:

Why is the word String capitalized, while int and others are not?

  1. String is a full word, but int ain't.
  2. Like all objects in Java, String has a capitalized name.
  3. Poor quality control at Oracle.
3:

Which of the following characters will put a single quote in a string?

  1. <quote>
  2. \'
  3. '

Answers

A1:

c. Concatenation is just another word for pasting, joining, melding, or otherwise connecting two strings together. It uses the + and += operators.

A2:

b. The types of objects available in Java are all capitalized, which is the main reason variable names have a lowercase first letter. It makes it harder to mistake them for objects.

A3:

b. The single backslash is what begins one of the special characters that can be inserted into strings.

      
Comments