CSC231 Sample Midterm Questions
--D. Thiebaut (talk) 08:32, 27 February 2017 (EST)
Below are typical questions you might expect during the in-class CSC231 Midterm Exam
- Question
- Assume that eax, ebx, ecx, and edx all 4 contain the value 0 before the program below start. Indicate the value of each 32-bit register after each instruction has been executed.
;; eax = ebx = ecx = edx = 0x00000000 or ax, 0xffff ; eax = __________ or bl, 0xff ; ebx = __________ or cx, 0xff ; ecx = __________ or edx,0xffff0000 ; edx = __________ and ax, 0xff00 ; eax = __________ and bx, 0x0f ; ebx = __________
- Question
- What is a big-endian processor?
- Question
- Write a program that uses only one string of characters "********" and that prints this pattern:
******** ****** **** **
- Question
- The RAM containing the data section of the program below is shown here, as a collection of successive bytes. The top byte has the lowest address of the group. In other words, addresses increase as we go down the array of bytes.
- Show the contents of the RAM once the array has been initialized with the variables a, b, msg and c.
section .data a dd 10 b dd 0x1234 msg db 1,2,3,4,5,6,7 c dw 0xaa
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
| |
+--------------+
Questions
- Convert the following hexadecimal numbers in binary
- 1
- 10
- 16
- Convert the following decimal numbers to binary
- 1
- 10
- 16
- Convert the following binary numbers to hexadecimal
- 1001
- 11001101
- 111000111000
- 'A' has ASCII code 0x41.
- What is the code for 'B'?
- What is 'A' + 0x20, in hex, in ASCII, or in decimal?