Question 4

What is the output of the following code snippet of VBScript ?

What is the output of the following code snippet of VBScript ? 18 MOD 7+4*2−10
  1. A4
  2. B1
  3. C0
  4. D2
Show answerHide answer

Correct answer: (D) 2

Explanation

In VBScript, * is evaluated before MOD, and MOD before + and −. 18 MOD 7 = 4 and 4*2 = 8, so 4 + 8 − 10 = 2.

From DSSSB TGT Computer Science Practice Set 2

This is question 4 of DSSSB TGT Computer Science Practice Set 2. 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.