nerdexam
GIAC

GSSP-JAVA · Question #106

GSSP-JAVA Question #106: Real Exam Question with Answer & Explanation

The correct answer is B. It will compile and execute successfully and will print 117 Correct answers as the output.. See the full explanation below for the reasoning.

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.

Community Discussion

No community discussion yet for this question.

Full GSSP-JAVA Practice