Data types and operators _ DPP
Data types and operators _ DPP
Q1 What will be the output of the following code? Q4 What will be the output of the following code?
#include <stdio.h> #include <stdio.h>
int main() int main() {
{ unsigned int a = 45, b = 35;
int x = 10; int result = (a & b) | (a ^ b);
int y = x++ + x++ + x--; printf("%d\n", result);
printf("%d\n", y); return 0;
return 0; }
}
(A) 30 (B) 31
(C) 32 (D) 33 (A) 43 (B) 45
(C) 47 (D) 49
Q2 Consider the following code snippet:
#include <stdio.h> Q5 Consider the following code snippet:
int main() #include <stdio.h>
{ int main()
int a = 5; {
int b = 10; unsigned int x = 7, y = 25;
int c = a++ + b++ + a++ - b--; int result = ~(x << 2) & (y >> 2);
printf("%d\n", c); printf("%d\n", result);
return 0; return 0;
} }
(A) 8 (B) 9 What is the output?
(C) 10 (D) 11
(A) 2 (B) 6
Q3 What will the following code print?
(C) 7 (D) 8
#include <stdio.h>
int main() Q6 What will be the result of the following code?
{ #include <stdio.h>
int i = 3, j = 4; int main()
int k = i++ * j-- + i++ * j--; {
printf("%d\n", k); int a = 100, b = 45;
return 0; int result = (a ^ b) << 3;
} printf("%d\n", result);
(A) 15 (B) 16 return 0;
(C) 17 (D) 24
https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 1/3
} return 0;
}
https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 2/3
Answer Key
Q1 (D) Q6 (C)
Q2 (C) Q7 (C)
Q3 (D) Q8 1
Q4 (B) Q9 (A)
Q5 (A) Q10 1
https://qbg-admin.penpencil.co/finalize-question-paper/print-preview 3/3