Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

completed in 75 minutes. No calculators may be used. There are 15 questions each

ID: 3590813 • Letter: C

Question

completed in 75 minutes. No calculators may be used. There are 15 questions each worth 1 point. Write your name at t top of this sheet. Show all work. 1) 0xc5 & 0xD6 = (Answer in Hexadecimal) (Answer in Hexadecimal) 3) (0x5E 2) = Ox (Answer in Hexade 4) When variable vb is dereferenced (*vb), what is its value af code executes? int va int vb; *vb = 5; va = 6; vb++i a) 5 b) 6 c) 7 d) Unknown members get assigned their own memory space members share the same memory space. a) Union, enumeration b) Structure, enumeration c) Structure, union d) Union, structure

Explanation / Answer

1)

0xC5 & 0xD6 = 0x C4

explanation

D6 = 1101 0110 (i.e 0xD6=0000 0000 1101 0110)

C5=1100 0101 (i.e 0xC5= 0000 0000 1100 0101)

Perform and operation

You will get 0000 0000 1100 0100 i.e c4

1100 0100 = C4

1100= C

0100=4

2)

C4 neation of c4 = 3B

i.e 1100 0100 after applying ~ it will become 0011 1011 i.e 3b

now perform or operation

4c =0100 1100

3b = 0011 1011

after applyin or it is 7f =  0111 1111

but as it is

0xc4 i.e 0000 0000 1100 0100 it will become 1111 1111 0011 1011 i.e FF3B

0x4c = 0000 0000 0100 1100

FF3B = 1111 1111 0011 1011

FF7F = 1111 1111 0111 1111

so ans is FF7F

5) C

Within a structure all members get memory allocated and members have addresses that increase as the declarators are read left-to-right.

For a union, compiler allocates the memory for the largest of all members and in a union, all members have offset zero from the base, the container is big enough to hold the WIDEST member, and the alignment is appropriate for all of the types in the union