Sunday, 1 November 2015

UGC-NET Computer Science C Language Programming Questions with Explanation

In this Blog we are providing all the UGC-NET Computer Science previous year Questions with explanation:

Q:1 What is the result of the following expression?
        (1 & 2) + (3 & 4)
(A) 1
(B) 3
(C) 2
(D) 0

Answer: (D)

(UGC-NET Computer Science December 2012)

Explanation:

In this question the operator '&' is bitwise AND operator So, it will work on individual bits.
Binary of 1 in 8 bits will be : 00000001
Binary of 2 in 8 bits will be : 00000010
Binary of 3 in 8 bits will be : 00000011
Binary of 4 in 8 bits will be : 00000100

   1 : 00000001
   2 : 00000010
1&2: 00000000

   3 : 00000011
   4 : 00000100

3&4: 00000000

1&2 results in 0 in decimal number system.
3&4 results in 0 in decimal number system.

(1 & 2) + (3 & 4) = 0+0=0.
So, correct option is (D).
This question was from UGC-NET Computer Science December 2012.

2 comments: