Recent questions tagged goclasses-cs-dpp-day-289

7 7 votes
1 1 answer
243
243 views
Which of the following exact decimal expressions can be represented in binary notation with a finite number of bits?$0.84-0.33$ $0.64-0.015$ $0.72+0.02$ $0.45-0.125$
10 10 votes
2 2 answers
258
258 views
In a $10$-bit $2$’s complement system, how many bit patterns represent negative integers that are divisible by $8$, not divisible by $16$, and have even parity?
4 4 votes
2 2 answers
185
185 views
Which of the following $2$’s complement bit strings represents the smallest decimal value? Each bit string must be interpreted using its own given bit-width.$1001011$ as ...
4 4 votes
1 1 answer
175
175 views
A $12$-bit $2$’s complement number has hexadecimal representation $(B6D)_H$. This number is sign-extended to $16$ bits and then arithmetic right-shifted by $2$ positions....
5 5 votes
2 2 answers
249
249 views
Suppose we have two $16$-bit $2$’s complement numbers:$$101xx101101xxxxx$$$$1101101xx11xxxxx$$Here, each $x$ is an independent unknown bit and can be either $0$ or $1$.Co...
9 9 votes
2 2 answers
351
351 views
What is the output of the following code?#include <stdio.h int main() { int a = 10, b = 20; int *p, *q; p = &a; q = &b; *p = *p + 5; *q = *p + *q; p = q; *p = *p - 10; pr...
8 8 votes
3 3 answers
316
316 views
What is the output of the following code?#include <stdio.h int main() { int x = 3, y = 1; switch (x - 1) { case 1: y = y + 2; case 2: y = y * 3; case 3: y = y - 1; break;...
5 5 votes
2 2 answers
239
239 views
What is the output of the following code?#include <stdio.h int main() { int i, j, count = 0; for (i = 1; i <= 4; i++) { for (j = 1; j <= 4; j++) { if (i == j) continue; i...
3 3 votes
2 2 answers
253
253 views
What is the output of the following code?#include <stdio.h int update(int x) { x = x + 3; return x * 2; } int main() { int a = 4, b; b = update(a); printf("%d %d", a, b);...
5 5 votes
2 2 answers
279
279 views
What is the output of the following code?#include <stdio.h int main() { int a[5] = {2, 4, 1, 3, 5}; int i, sum = 0; for (i = 0; i < 5; i++) { if (a[i] % 2 == 0) sum = sum...
To see more, click for the full list of questions or popular tags.