Difference between revisions of "CSC231 Sample Midterm Questions"

From dftwiki3
Jump to: navigation, search
(Question 10)
(Question)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 08:01, 21 October 2015 (EDT)
+
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 08:32, 27 February 2017 (EST)
 
----
 
----
 
<br />
 
<br />
 
Below are typical questions you might expect during the in-class CSC231 Midterm Exam
 
Below are typical questions you might expect during the in-class CSC231 Midterm Exam
 
<br />
 
<br />
 +
<!--
 
;Question 1
 
;Question 1
 
: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.
 
: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.
Line 25: Line 26:
 
</source>
 
</source>
 
<br />
 
<br />
 +
-->
 +
;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.
  
;Question 2
 
:Same as Question 1
 
 
<br />
 
<br />
 
::<source lang="asm">
 
::<source lang="asm">
Line 42: Line 44:
 
</source>
 
</source>
 
<br />
 
<br />
;Question 3
+
<!--
 +
;Question  
 
: Write a short program that displays all the numbers from 25 down to 1.  We assume that _printDec and _println are available.
 
: Write a short program that displays all the numbers from 25 down to 1.  We assume that _printDec and _println are available.
  
Line 72: Line 75:
 
</source>
 
</source>
 
<br />
 
<br />
; Question 7
+
-->
 +
; Question  
 
: What is a big-endian processor?
 
: What is a big-endian processor?
  
; Question 8
+
; Question  
 
: Write a program that uses only one string of characters "********" and that prints this pattern:
 
: Write a program that uses only one string of characters "********" and that prints this pattern:
 
   
 
   
Line 83: Line 87:
 
  **
 
  **
 
   
 
   
; Question 9
+
; 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.
 
: 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.
 
: Show the contents of the RAM once the array has been initialized with the variables a, b, msg and c.
Line 139: Line 143:
 
</source>
 
</source>
 
<br />
 
<br />
=Question 10=
+
=Questions =
 
<br />
 
<br />
 
* Convert the following hexadecimal numbers in binary
 
* Convert the following hexadecimal numbers in binary

Latest revision as of 09:32, 27 February 2017

--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?