Question 15Asked in UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)

Given i = 0, j = 1, k = –1 x = 0.5, y = 0.0

Given i = 0, j = 1, k = –1 x = 0.5, y = 0.0 What is the output of given 'C' expression? x * 3 && 3 || j | k
  1. A–1
  2. B0
  3. C1
  4. D2
Show answerHide answer

Correct answer: (C) 1

Explanation

x * 3 = 1.5, which is non-zero (true), and 3 is true, so x * 3 && 3 = 1. Then 1 || (j | k) = 1 (logical OR returns 1). The output is 1.

From UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions)

This is question 15 of UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions). 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.