...
Question 3556 – UGC NET CS 2016 Aug- paper-2
October 29, 2023
ICT
October 29, 2023
Question 3556 – UGC NET CS 2016 Aug- paper-2
October 29, 2023
ICT
October 29, 2023

UGC NET CS 2016 Aug- paper-2

Question 11
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
A
-1
B
0
C
1
D
2
Question 11 Explanation: 
Step-1: Evaluate x ​ * 3 because multiplication has more priority than remaining operators x * 3→ 1.5
Step-2: && is logical AND. Both the statements are TRUE, then it returns 1 otherwise 0.
1.5 && 3 is TRUE. So, it returns 1.
Step-3: j | k is bitwise OR operator. It returns -1.
Step-4: ((x * 3) && 3) || (j | k) islogical OR operator. It returns 1
Note: The precedence is ((x * 3) && 3) || (j | k)
Correct Answer: C
Question 11 Explanation: 
Step-1: Evaluate x ​ * 3 because multiplication has more priority than remaining operators x * 3→ 1.5
Step-2: && is logical AND. Both the statements are TRUE, then it returns 1 otherwise 0.
1.5 && 3 is TRUE. So, it returns 1.
Step-3: j | k is bitwise OR operator. It returns -1.
Step-4: ((x * 3) && 3) || (j | k) islogical OR operator. It returns 1
Note: The precedence is ((x * 3) && 3) || (j | k)

Leave a Reply

Your email address will not be published. Required fields are marked *