AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Escape Sequences: Backslashes, Double Quotes

APCSA-VX1DV6

Consider the following console output.

\\"cat"//
\\"dog"//

Which of the following code segments produces the same output?

A

System.out.print("\\\"cat\"////\n\\\"dog\"////");

B

String d = "dog";
System.out.print("\\\\\"cat\"//\n\\\\\""+d+"\"//");

C

System.out.println("\\\"cat\"////");
System.out.println("\\\"dog\"////");

D

System.out.println("\\"cat"//");
System.out.println("\\"dog"//");

E

String c = "cat";
String d = "dog";
System.out.println("\\\""+c+"\"////");
System.out.println("\\\""+d+"\"////");