Question 52Asked in DSSSB TGT Computer Science (Technical), 12 Sep 2025, Shift 3 (5:00 PM)

What will be the output of the following JavaScript code? const email = "example@domain";

What will be the output of the following JavaScript code? const email = "example@domain"; const regex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; console.log(regex.test(email));
  1. AError: Invalid regex
  2. Bundefined
  3. CFALSE
  4. DTRUE
Show answerHide answer

Correct answer: (C) FALSE

Explanation

The regex needs a dot and a 2-4 letter top-level domain after the @ part. "example@domain" has no ".com"-style ending, so test() returns false.

From DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 3 (5:00 PM)

This is question 52 of DSSSB TGT Computer Science PYQ (Technical), 12 Sep 2025, Shift 3 (5:00 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.