nerdexam
GIAC

GSSP-JAVA · Question #106

What will happen when you try to compile and execute the following code? class strconcat {public static void main(String args[]) {String str =" Correct answers";String perc…

Sign in or unlock GSSP-JAVA to reveal the answer and full explanation for question #106. The question stem and answer options stay visible for context.

Question

What will happen when you try to compile and execute the following code? class strconcat {public static void main(String args[]) {String str =" Correct answers";String perc ="a"+"b";System.out.println(80+ '%' + str);}} Note. The ASCII value of % is 37.

Options

  • AIt will compile and execute successfully and will print 80 Correct answers as the output.
  • BIt will compile and execute successfully and will print 117 Correct answers as the output.
  • CIt will compile and execute successfully and will print 80% Correct answers as the output.
  • DIt will fail to compile because % cannot be concatenated to a string.

Unlock GSSP-JAVA to see the answer

You've previewed enough free GSSP-JAVA questions. Unlock GSSP-JAVA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full GSSP-JAVA Practice