CS360 Midterm Exam #1. March 1, 2018. James S. Plank

Answers and Grading

You can compile and run the programs yourself (you'll have to compile last two with -m32).

Question 1: 27 points

0: 0x992b0000
1: 0x00014a7d
2: 0x9108e0c9
3: 0x00a00900
4: 0xffaffeff
5: 0x14a7de7e
6: 0xa7de0000
7: 0xa4
8: 0xb0
9: 0xb6

Grading

Three points for each of lines 0 through 6. Two points for the others.


Question 2: 20 points

0: '012345678Fred'
1: '5678Fred'
2: 'AACBECGDIE'
3: 'JJKKLUVWXYZ'
4: 'LUVWXYZ'
5: 'XYZ'
6: 'BB'
7: 'RRSS'
8: 5
9: H

Grading


Question 3: 12 points

0: 0x99869121
1: 0x74795106
2: 0x51069121
3: 0x21 0x91 0x06 0x51
4: 0xa6 0x9b 0x16 0x52

Grading


Question 4: 21 points

Grading

Three points for the first line. Two points for the others. You got one point for answering 8 on line 9.


Question 5: 20 points

First, the size of Mystruct is 12 bytes. There are three bytes of padding after b. Here's the program running:
UNIX> q5 | tail -n 10
0: n
1: 'iamoiaynh'
2: 1728082432
3: v
4: 'nh'
5: 6844025
6: 'igoia'
7: 1769631488
8: i
9: d
UNIX>

Grading