Exercise 2         Name       _______________________   Points __/22

1. (16) Declare the following:

    a. an 8-bit variable named a1 initialized to 'A',                                  a1    byte    'A' 
 

    b. an 8-bit variable named b1 initialized to 100011012,                            b1    byte    10001101b
 

    c. a zero-terminated string variable named c1 initialized to your first name,      c1     byte    'Ray', 0
 

    d. a 16-bit variable named d1 initialized to your age,                              d1    word    17
 

    e. a 16-bit array variable named e1 of 20 values initialized to all zeroes,         e1    word    20 dup( 0 )
 

    f. a 32-bit variable named f1 initialized to the current USA population,            f1    dword   308399433
 

    g. a signed 16-bit variable named g1 initialized to the most negative 16-bit value,  g1   sword   -32738
 

    h. a 32-bit real variable named h1 initialized to pi,                                 h1   real4   3.1415926

 

2. (6 points) Assume each variable defined below starts at offset 00000000.

    List the individual bytes as they would be arranged in memory, lowest to highest offset, for the following definitions:

a) 2a    byte    1, 2, 3, 4, 5       
Value 01 02 03 04 05
Offset 00000000 00000001 00000002 00000003 00000004

b) 2b    word    1, 2, 3, 4, 5
Value 01 00 02 00 03 00 04 00 05 00
Offset 00000000 ..01 ..02 ..03 ..04 ..05 ..06 ..07 ..08 ..09

c) 2c    dword   1, 2, 3, 4, 5
Value 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 05 00 00 00
Offset 00000000 ..01 ..02 ..03 ..04 ..05 ..06 ..07 ..08 ..09 ..0A ..0B ..0C ..0D ..0E ..0F ..10 ..11 ..12 ..13