Reference no: EM132559915 , Length: 4 pages
CYBR 215 Computer Programming with a Low Level Language - Norwich University College
1) Suppose you have an empty generic stack. What does the stack look like after the following operations have been performed? Be sure to indicate the top of the stack.
Push 4
Push 9
Push 1
Push 9
Pop
Push 8
Pop
Pop
Push 3
2) In the above example, what is the esppointing to after the operations have been completed?
3) Suppose you have an empty generic stack. Indicate which of the following instructions will invoke a stack underflow.
1. Push 1
2. Push 2
3. Pop
4. Push 9
5. Pop
6. Pop
7. Pop
8. Pop
9. Push 3
4) Suppose you have the following function prototype:
void compute(intw, intx, inty, intz);
Now suppose the function is called:
compute(3, 4, 1, 0);
Show the assembly code generated by this function call using CDECL.
5) Briefly explain what the heap data structure is used for in terms of memory. How does the heap differ from the stack?
6) Explain the purpose of relative virtual addressing in Win32 executables.
7) Which header file in the Win32 SDK contains the variables and data structures used to construct PE files?
8) In a Win32 binary executable, what two letters are stored in the character array DOS_Header.signature[2]?
9) Suppose you have a Win32 binary executable and you have COFFHeader.Machine=496. What machine architecture was this executable compiled for?
10) What is the value of COFFHeader.Characteristics for a Win32 DLL file?
11) Which Windows subsystem will be invoked to run the executable if PEOptHeader.Subsystem = 2?
For problems 12, 13, 14, and 15, use the section definitions provided below.

12) Based on the section flags above,
a. Which section is readable?
b. Which section is executable?
c. Which section is writable?
13) What is the size of the .text section once it is loaded into memory?
14) What is the RVA of the .data section once it is loaded into memory?
15) What is the physical size of the .data section on disk?
16) Briefly describe static linking and dynamic linking. Include the advantages and disadvantages of dynamic linking over static linking.
17) In terms of modules, define an export.
18) Which entry of the resource directory identifies the start of the export directory?
19) What is the role of the import table in dynamic linking?
20) What is the primary benefit of storing a precomputed import address into IMAGE_IMPORT_DESCRIPTOR.FirstThunk?
21) Describe a Windows DLL.
22) Suppose you are writing a DLL and need to export the function voidCYBR215(). Show the C syntax to export this function for use by other modules or executables.
23) Show how you could import the same function for local use in another module or executable.