C Programming _ Weekly Test 01 _ Test Paper
C Programming _ Weekly Test 01 _ Test Paper
GATE
Weekly Test-01
Computer Science & Information Technology
C Programming
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 1/5
2/12/24, 2:47 PM GATE_Weekly Test-01_DPP
GATE
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 2/5
2/12/24, 2:47 PM GATE_Weekly Test-01_DPP
GATE
Answer Key
Q1 (B) Q6 (C)
Q2 (C) Q7 (D)
Q3 1 Q8 (A)
Q4 (D) Q9 –32756
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 3/5
2/12/24, 2:47 PM GATE_Weekly Test-01_DPP
GATE
Q6 Text Solution:
int a=0, b=1;
a=(a=5)||(b=0);
// Assignment operator assigns and returns the
assigned value. Here, short-circuiting will be
Q2 Text Solution: applied. Since the logical operator is OR, if the
(2* (8/5) + (4* 5 – 3)) % (8 – 5 –2) first part is true, second part is not evaluated at
(2* 1 + 17) % 1 all. Hence, b=1, a=1.
19% 1 printf("%d", a);//1 is printed
0 printf("%d", b);//1 is printed.
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 4/5
2/12/24, 2:47 PM GATE_Weekly Test-01_DPP
GATE
j = 0 × 20
⇒ 2 × 161 + 0 × 160 ⇒ 32
k = i|j ⇒ 32 16 8 4 2 1
i⇒1 0 0 0 0 0
j ⇒1 0 0 0 0 0
or
1 0 0 0 0 0 ⇒ 32
k = 32
l=i&j
i⇒1 0 0 0 0 0
j⇒1 0 0 0 0 0
AND ⇒
1 0 0 0 0 0 ⇒ 32
l = 32
m = k^l;
k⇒1 0 0 0 0 0
l⇒1 0 0 0 0 0
x-OR
0 0 0 0 0Þ0
m=0
Print;
i ⇒ 32
j ⇒ 32
k ⇒ 32
l ⇒ 32
m⇒0
https://qbg-admin.penpencil.co/finalize-question-paper/preview-pdf 5/5