Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : 16

Advertisement

Detailed Solution

सही उत्तर 16 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Consider the C fragment: int i = 2; printf("%d", i << 2 + 1); What is printed? / C कोड खंड पर विचार करें: int i = 2; printf("%d", i << 2 + 1); क्या मुद्रित होगा?

1.
5
2.
8
3.
9
4.
16

Correct Answer: 16

Addition binds tighter than the left shift, so the expression is i << (2+1) = 2 << 3 = 16, not (2<<2)+1 = 9. / योग बाएँ शिफ्ट से अधिक दृढ़ता से बँधता है, अतः व्यंजक i << (2+1) = 2 << 3 = 16 है, (2<<2)+1 = 9 नहीं।

Downloaded from PrepSnap (prepsnap.in)