CS 271 Module 1 Summary
What is the largest signed integer that may be stored in 32 bits?
(2^31) -1
What are the minimum numbers of binary bits needed to represent the unsigned decimal integers (a) 33 (b) 309
(a) 33 10 0001 = 6 numbers (b) 309 1 0011 0101 = 9 numbers
Convert the following signed SWORD to a decimal value. 1100 1101 0011 1100
-12,996
What is the range of decimal values for a signed BYTE?
-128 to 127
Convert the following signed SWORD to a decimal value. 1111 0101 0001 0100
-2796
Convert the following signed SWORD to a decimal value. 1110 0001 0010 1000
-7,896 (with margin: 0)
What is the range of decimal values for an unsigned DWORD?
0 to 4,294,967,295
Complete the following unsigned Binary Subtraction: 01110000 - 01101110 ----------
00000010
Complete the following unsigned Binary Subtraction: 11101001 - 11010111 ----------
00010010
Complete the following unsigned Binary Subtraction: 11101001 - 11010111 ---------- NOTE: Represent answer as an 8-bit value, with no spaces or characters other than 0s and 1s.
00010010
Which of the following binary values is equivalent to hexadecimal 7CBE?
0111 1100 1011 1110
A [ Select ] ["CISC", "RISC"] Architecture's instructions are decoded to micro-programs which are executed by the CPU, whereas a [ Select ] ["RISC", "CISC"] Architecture's instructions are directlyexecuted by the CPU.
1. CISC 2. RISC
Place the following steps of the instruction execution cycle into the proper order Decode the instruction in the Instruction Register. If the instruction requires memory access, determine the memory address, and fetch the operand from memory into a CPU register, or send the operand from a CPU register to memory. Increment the Instruction Pointer to point to next instruction's address. Store resultant operands. Execute the instruction. Fetch the instruction at the address in the Instruction Pointer into the Instruction Register.
1. Fetch the instruction at the address in the Instruction Pointer into the Instruction Register. 2. Increment the Instruction Pointer to point to next instruction's address. 3. Decode the instruction in the Instruction Register. 4. If the instruction requires memory access, determine the memory address, and fetch the operand from memory into a CPU register, or send the operand from a CPU register to memory. 5. Execute the instruction. 6. Store resultant operands.
Please place the following steps of the instruction execution cycle in their proper order.
1. Fetch the instruction at the instruction pointer, into the instruction register 2. Increment the instruction pointer to the next register 3. Decode the instruction in the instruction register. 4. If the instruction requires memory access, determine the memory address, and fetch the operand from memory into a CPU, or send the operand from CPU register to memory 5. Execute the instruction 6. If the output is in memory, the control unit uses a write operation to store the data.
Convert the following value from signed decimal to 8-bit binary: -33 NOTE: Canvas may add a decimal point and thousands place commas, for example 11001100 may appear as 11,001,100.0 ... Please ignore these.
1101 1111
Complete the following Unsigned Binary Addition (answers should also be in Binary): NOTE: Canvas may add thousands place commas (for example 11001100 may appear as 11,001,100) ... Please ignore these. 10110010 + 00100001 ----------
11010011
Complete the following Unsigned Binary Addition (answers should also be in Binary): NOTE: Canvas may add thousands place commas (for example 11001100 may appear as 11,001,100) ... Please ignore these. 10111010 + 00110001 ----------
11101011
How many bits long is a WORD on x86 systems?
16
What is the largest unsigned integer that may be stored in 24 bits?
16,777,215
Which list contains the correct hexadecimal translation (in order) of the following unsigned decimal integers? 33, 95, 257
21 5F 101
How many bits are there in 35 MB (note: bytes, so binary prefixes apply)
293,601,280 bits 35 * 2^(20) Bytes * 8 bits/Byte = 36,700,160 Bytes * 8 bits / Byte = 293,601,280 bits
How many bits long is a DWORD (doubleword) on x86 systems?
32 bits
What is the size of the general-purpose registers?
32 bits
What is the width of the address and data buses?
32 bits
Complete the following unsigned Hexadecimal Subtraction: 5568 - 1ADC ------
3A8C
Complete the following unsigned Hexadecimal Subtraction: 83AA - 47AB ------ NOTE: Represent answer as a 16-bit hex (four character) value, with no spaces or characters other than 0-9, A-F.
3BFF
Convert the following string into its ASCII hex representation: Cache Don't use 0x or h to represent the hex values. For example, the ASCII hex representation for "1+z" is 31 2B 7A Cache
43 61 63 68 65
Which of the following binary values is equivalent to hexadecimal 4A2B?
4: 0100 A: 1010 2: 0010 B: 1011
Complete the following unsigned Hexadecimal Subtraction: 6A6F - 1F89 ------
4AE6
Convert the following ASCII hex representation to a character string: 4D 61 67 69 63 61 6C Do not add any spaces. For example, the hex 31 2B 7A represents the string: 1+z
4D 61 67 69 63 61 6C Magical
Convert the following string into its ASCII hex representation: Optical Don't use 0x or h to represent the hex values. For example, the ASCII hex representation for "1+z" is 31 2B 7A
4F 70 74 69 63 61 6C
Convert the following unsigned WORD to a decimal value. 1100 1000 0100 0001
51,265
Convert the following string into its ASCII hex representation: Turing Don't use 0x or h to represent the hex values. For example, the ASCII hex representation for "1+z" is 31 2B 7A
54 75 72 69 6E 67
Convert the following unsigned WORD to a decimal value. 1101 0111 0011 0010
55,090
There are (blank) segment registers
6
How many bytes long is a QUADWORD on x86 systems?
8
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): NOTE: Canvas may add thousands place commas (for example 9C4B may appear as 9,C4B) ... Please ignore these. 2C16 + 573B ------
8351
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): NOTE: Canvas may add thousands place commas (for example 9C4B may appear as 9,C4B) ... Please ignore these. 2C27 + 573B ------
8362
Complete the following Unsigned Binary Addition (answers should also be in Binary): NOTE: Canvas may add thousands place commas (for example 11001100 may appear as 11,001,100) ... Please ignore these. 10110010 +10100001
= 101010011
Complete the following unsigned Hexadecimal Subtraction: 83AA - 47AB ————— NOTE: Represent answer as a 16-bit hex (four character) value, with no spaces or characters other than 0-9, A-F.
= 3BFF
Complete the following Unsigned Hexadecimal Addition (answers should also be in Hexadecimal): NOTE: Canvas may add thousands place commas (for example 9C4B may appear as 9,C4B) ... Please ignore these. 2C17 + 572B
= 8342
Which of the following are valid 8-bit register references? If so, describe what they reference? If not, why? AL DH SH EL
AL: Yes, refers to bits 0-7 of EAX DH: Yes, refers to bits 8-15 of EDX SH: No, this would be ambiguous, because we have ESP, ESI, and SS registers EL: No, ES register can't be byte-referenced.
When transferring instructions and data between the Main Memory Unit and the CPU, the memory location where the data is stored must be placed on the [ Select ] Bus.
Address Bus
What is an instruction?
An instruction is a control phrase for the computer which will be translated (with its operands) into a op code (Machine Language)
What mechanism is used to turn Assembly Language code to Machine Code?
Assembler
Which utility program reads an assembly language source file and produces an object file?
Assembler
Convert the following ASCII hex representation to a character string: 41 73 73 65 6D 62 6C 79 Do not add any spaces. For example, the hex 31 2B 7A represents the string: 1+z
Assembly
Match the datatype to its use/description. 8-bit unsigned 16-bit unsigned 16-bit signed integer 32-bit unsigned integer 32-bit signed integer 32-bit (4-byte) IEEE short real 64-bit (8-byte) IEEE long real
BYTE: 8-bit unsigned WORD: 16-bit unsigned SWORD: 16-bit signed integer DWORD: 32-bit unsigned integer SDWORD: 32-bit signed integer REAL4:32-bit (4-byte) IEEE short real REAL8: 64-bit (8-byte) IEEE long real
Which segment register points to the beginning of the code segment?
CS
In the IA-32 architecture, which of the following are valid 16-bit register references?
CX, SP, SS
High-speed memory that reduces the frequency of access by the CPU to conventional memory is called
Cache memory
Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?
Carry
Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?
Carry Flag
Name at least four CPU status flags.
Carry, Overflow, Parity, Auxiliary Carry, Sign, Direction, Zero
Language Hierarchy: The purpose of a Compiler is to...
Convert High/Low level Program Code to Assembly/Machine Code
What type of tool can convert ARM Assembly to x86 Assembly?
Cross Assembler
What is the name of the lowest 8 bits of the EDX register?
DL
The three types of buses connected to the CPU are:
Data, address, control
Which register is known as a loop counter?
ECX
Why does protected mode prevent programs from changing the EIP register directly?
EIP contains the memory address of the next instruction to be fetched. Since the programmer ordinarily will not know the absolute address where any of the instructions are stored, protected mode restricts access to EIP, and allows it to be changed only by the operating system.
The CPU clock cycle length is the only contributing factor to the speed of operations on a computer.
False
True/False) Assembly Languages are portable.
False
If an integer's sign bit is 1, the integer is positive.
False 1 is negative 0 is positive
(True/False) A single computer architecture may have programs written for it using more than one Assembly Language (x86, RISC-V, ...).
False An Assembly Language is defined by an ISA (Instruction Set architecture), and is the only Assembly Language defined for that computer architecture.
(True/False) Assembly Language programs are 'higher level' than C programs.
False Assembly Language programs are lower level than C program. A C program will compile into assembly on its way to Machine Code.
(True/False) Assembly Language programs are portable to a variety of computer architectures.
False Assembly Languages are architecture-specific.
During which phase of the instruction execution cycle is the instruction pointer incremented?
Fetch
How many bytes does it take to represent the following set of characters in ASCII: HELLO
Five. One byte per ASCII character, five ASCII characters.
Convert the hex value 0A1D2F638h to binary.
HEX A1D2F638 BINARY 1010 0001 1101 0010 1111 0110 0011 1000
Compared to higher-level languages, which of the following are benefits of Assembly Language programming?
Hands-on Code Optimization Direct Manipulation of Memory
Which of the following are components of the Control Unit? (Check all that apply)
Instruction register Instruction pointer Status register
What component is responsible for communication among the various internal CPU components?
Internal bus
Language Hierarchy: Rank the following languages from low level (1) to high level (4). Level 4 (Highest Level): [ Select ] ["ARM Assembly", "Python", "English", "Machine Code"] Level 3: [ Select ] ["ARM Assembly", "Python", "English", "Machine Code"] Level 2: [ Select ] ["Machine Code", "ARM Assembly", "Python", "English"] Level 1 (Lowest level): [ Select ] ["Machine Code", "ARM Assembly", "Python", "English"]
Level 4: English Level 3: Python Level 2: ARM Assembly Level 1: Machine Code
A program that combines object files into an executable program is called a
Linker
Which flag is set when the result of a signed arithmetic operation is either too large or too small to fit into the destination?
Overflow Flag
What would you call an ordered list of organized instructions existing somewhere in memory, and associated with a data structure for storage of data?
Program
Which flag is set when an arithmetic or logical operation generates a negative result?
Sign Flag
What are the smallest and largest values which can be represented with an signed SDWORD
Smallest: -2^(31) = -2,147,483,648 Largest: 2^(31)-1 = 2,147,483,647
What are the smallest and largest values which can be represented with an unsigned DWORD
Smallest: 0 Largest: 2^(32)-1 = 4,294,967,295
Place the steps for a memory read in the correct order. Assert a Read Wait until operation in complete Specify the memory address on the Address Bus via MAR Move data to its destination
Specify the memory address on the Address Bus via MAR Assert a Read Wait until operation in complete Move data to its destination
In 32-bit mode, aside from the stack pointer (ESP), what other register points to stack addresses?
Stack Segment (SS), possibly EBP depending on usage
Match the Instruction Execution steps to the correct order and description. The ALU executes the instruction using the named registers and internal registers as operands. If the output operand is in memory, the control unit uses a write operation to store the data. The control unit increments the instruction pointer (IP, also known as instruction counter). The control unit fetches the next instruction from the instruction queue. The control unit decodes the instruction's function to determine what the instruction will do.If the instruction uses an input operand located in memory, the control unit uses a read operation to retrieve the operand and copy it into internal registers.
Step 1 The control unit fetches the next instruction from the instruction queue. Step 2 The control unit increments the instruction pointer (IP, also known as instruction counter). Step 3 The control unit decodes the instruction's function to determine what the instruction will do. Step 4 If the instruction uses an input operand located in memory, the control unit uses a read operation to retrieve the operand and copy it into internal registers. Step 5 The ALU executes the instruction using the named registers and internal registers as operands. Step 6 If the output operand is in memory, the control unit uses a write operation to store the data
A primary limitation on the speed of internal communication on a machine is the width of the internal bus.
True
Adding 5 to 0FBh in an 8-bit register sets the Zero flag.
True
Adding 7Fh and 05h in an 8-bit register sets the Overflow flag
True
Higher level languages are more likely to be portable than lower level languages.
True
In a Von Neumann architecture, each instruction in a program may be individually addressed and accessed.
True
(True/False) A single computer architecture may have programs written for it using more than one assembler (MASM, NASM, FASM, ...)
True Different assemblers give software developers different capabilities in the way their assembly language programs are written, assembled, and debugged. MASM and NASM can both be used to author x86 Assembly for IA32 processors, for example. Assemblers have a many-to-one correspondence to assembly languages; that is, even though there is only one assembly language for a particular ISA, there may be several assemblers available to choose from.
(True/False) High-level language (HLL) programs are portable to a variety of computer architectures.
True HLL programs require compilers to create architecture-specific code.
(True/False) Assembly Language instructions have a nearly 1:1 correspondence with Machine Code.
True Some Assembly Languages and architectures have a 1:1 correspondence from Assembly to Machine.
If the AH register is modified by the software engineer, is there any change in the EAX register? Why or why not?
Yes, the AH register is part of the EAX register. Specifically, the bits 0-7 of the AH are exactly bits 8-15 of EAX.
A program is considered portable if it . . .
can be executed on multiple platforms.
The two's complement of an binary value is formed by which process?
reversing (inverting) the bits and adding 1