CS 271 Midterm

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/171

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

172 Terms

1
New cards

In 32-bit mode, which register points to the top of the stack?

ESP

2
New cards

(True/False) The PUSH instruction can have an immediate operand.

True

3
New cards

(True/False) The POP instruction can have an immediate operand.

False

4
New cards

What directives are used to bracket a procedure?

PROC and ENDP

5
New cards

(True/False) If RET was left out of a procedure, execution would stop at the ENDP directive.

False

RET updates EIP to return to the calling procedure. Without it, execution will run right over the ENDP and continue to the next address in memory immediately after the procedure.

6
New cards

What does CALL push to the stack?

The address of the instruction immediately following the CALL instruction.

7
New cards

What does PUSH OFFSET myVar, where myVar is a data-segment variable, put on the stack?

The address of (pointer to) the memory location where the value of myVar is stored.

8
New cards

What does PUSH myVar, where myVar is a data-segment variable, put on the stack?

The current value in memory at the location myVar refers to.

9
New cards

What are some disadvantages of passing parameters using globals?

Modifying a global in a procedure modifies it outside the procedure.Use of globals makes a procedure far less modular.

10
New cards

Which parameter-passing method is commonly used by compilers?

Passing parameters on the stack.

11
New cards

If you're passing a pointer, which of the three parameter types might your parameter be classified as?

May be either an output parameter or an input-output parameter. In fact, it may even be an input parameter (for example with Irvine's WriteString).

12
New cards

What single instruction would I use to save all general purpose registers?

PUSHAD

13
New cards

(True/False) In the IA32 architecture, ESP (the stack pointer) is incremented each time data is pushed onto the stack.

False

14
New cards

What instruction would I use to save the current value of the flags register?

PUSHF

15
New cards

PUSHF is used to preserve all general purpose register contents on the stack.

False

16
New cards

Which of the following is true about the POP instruction?

It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).

17
New cards

The CALL instruction functions similarly to which of the following?

Push, then Jump

18
New cards

A stack frame is _____

The area of the stack set aside for passed arguments, return address, local variables, and saved registers.

19
New cards

A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.

nested

20
New cards

(True/False) A subprocedure's stack frame contains the return address and its local variables.

True

21
New cards

(True/False) An input parameter may be passed by reference.

True

22
New cards

(True/False) Passing by reference requires accessing a parameter's offset from inside the called procedure.

True

23
New cards

When values are received by a called subroutine, they are called __________.

parameters

24
New cards

(True/False) High-level languages always pass arrays to subroutines by value.

False

25
New cards

(True/False) Arrays are passed by reference to avoid copying each element into the stack/registers.

True

26
New cards

Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack?

on the stack

27
New cards

Where is the runtime stack located in memory?

It is located in the Stack Segment of the program's memory space (Main Memory/RAM).

28
New cards

Consequence of improper runtime stack management

Stack overflow (running out of stack space), stack underflow (popping too many times), or corrupting the return address, which leads to program crashes.

29
New cards

A copy of the actual data is passed to the procedure. Changes made inside the procedure do not affect the original variable in the caller.

Passing by Value

30
New cards

The memory address of the variable is passed. Changes made inside the procedure do affect the original variable in the caller.

Passing by Reference/Address

31
New cards

Assembly Language programs are 'higher level' than C programs. (T/F)

False

Assembly Language programs are lower level than C program. A C program will compile into assembly on its way to Machine Code.

32
New cards

(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.

33
New cards

(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.

34
New cards

(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.

35
New cards

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)

36
New cards

(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.

37
New cards

(True/False) Assembly Language programs are portable to a variety of computer architectures.

False

Assembly Languages are architecture-specific.

38
New cards

Little-Endian

The least significant BYTE is stored at the lowest memory address.

39
New cards

Big-Endian

The most significant BYTE is stored at the lowest memory address.

40
New cards

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

41
New cards

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.

42
New cards

How many bits are there in 35 MB (note: bytes, so binary prefixes apply)

293,601,280 bits35 220 Bytes 8 bits/Byte = 36,700,160‬ Bytes * 8 bits / Byte = 293,601,280 bits

43
New cards

Define "Bus"

A set of parallel "wires" for transferring a set of electrical signals simultaneously.

44
New cards

What is the Address Bus used for?

To communicate a specific memory location for reads or writes, e.g. Read from "this address on the address bus"

45
New cards

Which register holds the opcode of current instruction being executed?

IR - Instruction Register

46
New cards

Which register points to the address of the next instruction to be executed?

IP - Instruction Pointer (EIP in IA32)

47
New cards

Which register holds the current machine instruction?

The Instruction Register (IR)

48
New cards

Which register holds the current micro-instruction?

The Control Register

49
New cards

What is the main purpose of caching?

Moving information from slower storage to faster storage, where it can be accessed more quickly.

50
New cards

In a vonNeumann architecture, how are programs organized?

Programs are stored in memory and executed according to an instruction execution cycle.

51
New cards

On a computer, where is simple integer math computed?

ALU - Arithmetic/Logic Unit

52
New cards

What component's primary duty is synchronizing processes inside a computer?

System clock

53
New cards

What storage unit is the closest/fastest on the chip?

Registers

54
New cards

What would you call an ordered list of organized instructions existing somewhere in memory, and associated with a data structure for storage of data?

A program!

55
New cards

Where is a major data transfer bottleneck in a computer, and what helps resolve it?

The data bus, because both the program instructions and the data must be retrieved from the same memory to be executed or used. Caching helps reduce the impact.

56
New cards

What is the width of the address and data buses?

32 bits

57
New cards

What is the size of the general-purpose registers?

32 bits

58
New cards

Name at least four CPU status flags.

Carry, Overflow, Parity, Auxiliary Carry, Sign, Zero

59
New cards

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

60
New cards

Which flag is set when an arithmetic or logical operation generates a negative result?

Sign Flag

61
New cards

Which flag is set when the result of an unsigned arithmetic operation is too large to fit into the destination?

Carry Flag

62
New cards

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

63
New cards

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.

64
New cards

What best describes the relationship from assembly language instructions to machine language instructions?

nearly one to one

65
New cards

Language Hierarchy: The purpose of a Compiler is to...

Convert High/Low level Program Code to Assembly/Machine Code

66
New cards

The linker combines object files into an executable file.

True

67
New cards

What type of tool can convert ARM Assembly to x86 Assembly?

Cross Assembler

68
New cards

What is the range of decimal values for an unsigned DWORD?

0 to 4,294,967,295

69
New cards

The ASCII code values for alphabetic letters (e.g. 'a') are smaller than for decimal digits (e.g. '1').

False

70
New cards

How many bytes long is a QUADWORD on x86 systems?

8

71
New cards

The two's complement of a binary value is formed by which process?

reversing (inverting) the bits and adding 1

72
New cards

How many bits long is a WORD on x86 systems?

16

73
New cards

How many binary digits are represented by a series of 4 hexadecimal characters?

16

74
New cards

What are components of the Control Unit?

Instruction Pointer

Instruction Register

Status Register

75
New cards

The CPU clock cycle length is the only contributing factor to the speed of operations on a computer.

False

76
New cards

During which phase of the instruction execution cycle is the instruction pointer incremented?

fetch

77
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 1 is?

Fetch the instruction at the address in the Instruction Pointer into the Instruction Register

78
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 2 is?

Increment the instruction pointer to point to the next instruction.

79
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 3 is?

Decode the instruction in the instruction register

80
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 4 is?

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

81
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 5 is?

Execute the instruction

82
New cards

Please place the following steps of the instruction execution cycle in their proper order. Step 6?

If the output operand is in memory, the control unit uses a write operation to store the data.

83
New cards

The status flags are implemented as individual bits within the Status Register.

True

84
New cards

What is the size of the EAX register?

32 bits

85
New cards

What is the size of the AX register?

16 bits

86
New cards

What is the size of the AH register?

8 bits

87
New cards

Which Operation Mode provides compatibility for legacy 8086 programs?

Real-Address mode

88
New cards

What is the name of the lowest 8 bits of the EDX register?

DL

89
New cards

The datatype of BYTE is what?

8-bit unsigned integer

90
New cards

The datatype of WORD is what?

16-bit unsigned integer

91
New cards

The datatype of SWORD is what?

16-bit signed integer

92
New cards

The datatype of DWORD is what?

32-bit unsigned integer

93
New cards

The datatype of SDWORD is what?

32-bit signed integer

94
New cards

The datatype of REAL4 is what?

32-bit IEEE short real

95
New cards

The datatype of REAL8 is what?

64-bit IEEE long real

96
New cards

What does AL refer to (8 bit register references)

Bits 0-7 of EAX

97
New cards

What does DH refer to (8 bit register references)

Bits 8-15 of EDX

98
New cards

(True/False): END main is a directive that tells the operating system where to begin execution of the program

True

99
New cards

(True/False): A MASM program must have a procedure named "main".

False

The 'main' procedure can have any valid identifier, as long as the END directive properly points the assembler to start execution at that identifier address.

100
New cards

This directive is used to mark the beginning of the code segment in memory.

.code