
Module 1 (Lectures 1-2) Program execution and Data Representation
1. The `Hello World program’ is a program that prints the string `Hello World’ to
the output. Write such a program in C and compile it to generate an executable
file, a.out on a Linux system. What is the size of this a.out file? What do the first
16 Bytes in this a.out file contain?
2. Write a C program which checks whether the machine it is running on supports
the IEEE Floating Point representation. Your program should also verify whether
the machine handles special forms (such as infinity) correctly.
3. Show the following in hexadecimal (radix 16): (a) the 16 bit 2’s complement
representation of the signed integer decimal value -10,000, (b) 32 bit IEEE single
precision floating point representation of the decimal value -15.325
4. Show the value in decimal corresponding to: (a) the 16 bit 2s complement value
0xED7E, (b) the 32 bit IEEE single precision floating point value
0xBDCCCCCC.
5. Recall that the Stack and the Heap of a program can grow and shrink during
execution. In fact, it is possible for them to grow so much that they run into each
other. Write 2 different programs which suffer from this problem – one in which
the stack runs into the heap, and another in which the heap runs into the stack.
Run each of these programs. How does their execution terminate?