Problem Sheet 1

This problem sheet was created by Sir Narasimhan T, Assistant Professor, IT Department LBS College of Engineering, Kasaragod

The softcopy in .pdf is available here.

1. A C program contains the following declarations and initial assignments:
int i = 8, j = 5, k;
float x = 0.005, y = -0.01, z;
char a, b, c = ’c’ , d = ’d’ ;
Determine the value of each of the following assignment expressions
(a) 2 * ((i / 5) + (4 * (j – 3)) % (i + j – 2))
(b) (i – 3 * j) % (c + 2 * d) / (x – y)
(c) 5 * (i + j) > c
(d) (x > y) && (i > 0) || !(j < 5)
(e) k = (j==5) ? i : j
(f) z = (y >= 0) ? y : 0
(g) a = (c < d) ? c : d
(h) i -= (j > 0) ? j : 0
(i) i *= i++ * j – –i
2. Suppose that a is an unsigned integer whose value is 0xa2c3. Evaluate the following
(a) a & 0x3f06
(b) a | 0x3f06
(c) a∧0x3f06
(d) a << 3
(e) a >> 4
(f) a | ∼0x3f06 << 3

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s