Question 132Asked in DSSSB TGT Computer Science, 25 Jun 2023, Shift 2 (12:30 PM)

What will the output of the following code snippet be? <script>

What will the output of the following code snippet be? <script> document.write ("Hello") document.write ("\nIndia") </script>
  1. AHello
  2. BI--lellolndia
  3. CIndia
  4. DHello India
Show answerHide answer

Correct answer: (D) Hello India

Explanation

document.write sends text into HTML, where a newline character is displayed as a single space. The page therefore shows 'Hello India' on one line.

From DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 2 (12:30 PM)

This is question 132 of DSSSB TGT Computer Science PYQ, 25 Jun 2023, Shift 2 (12:30 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.