Computer System Q&A (CPT101)

l Lecture 2

1. Q: Using a diagram, illustrate the concept of Input-Process-Output Model.

A:

2. Q: Which model gives the fundamental structure of the current generation of digital computers?

A: The Input-Process-Output Model is the fundamental structure of the current generation of digital computers.

3. Q: Process is controlled by what?

A: The process is controlled by a special, custom-made program.

4. Q: Highlight the three components require for the implementation of Input-Process-Output and von Neumann

model.

A: There are three components require for the implementation of Input-Process-Output and von Neumann model:

-Hardware -Software -Data that is being manipulated

5. Q: Name 5 examples of computer hardware.

A: The secondary storage. (Long-term storage. Hard disk CDs DVD)

Input devices: Keyboard, mouse, scanner, etc.

Output devices: monitor, speaker, printer, etc.

6. Q: Identify the active part within a computer which performs calculations and other operations.

A: A processor is an active part of the machine that executes the program instructions.

7. Q: Which part of a computer holds data and programs for access by CPU?

A: The secondary storage holds programs and data.

8. Q: Give 3 examples of secondary storage.

A: CD, DVD, Hard disk, etc.

9. Q: Give 3 examples of input devices.

A: Keyboard, mouse, scanner, etc.

10. Q: Give 3 examples of output devices.

A: monitor, speaker, printer, etc.

11. Q: Define ‘software’.

A; The hardware of a computer (e.g. CPU) can carry out only very simple operations like adding numbers (very

quickly). To make it perform useful tasks, these simple steps are combined in the form of programs, which are

collectively known as software.

12. Q: Difference between these two models Input-Process-Output model & von Neumann model.

A:

13. Q: For a particular machine, the machine instruction set is usually fixed. True or false?

A: True. For a particular machine, this set is fixed.

14. Q: There exists a standard instruction set for industry purpose. True or false?

A: False. Although the instruction sets of different CPUs are similar, there is no standard instruction set.

15. Q: High Level Programming Languages (HLLs) are more suitable for programming than the languages of machine

instructions. Why?

A: It has greater expressiveness, can easily represent the operations on data and the control structure of a program,

can better describe various algorithms, and is easy to learn to master.

16. Q: Mention 4 major categories of machine instructions.

A: Input-output: IN, OUT (Intel x86 and Pentium, but does not exist in some CPUs).

Data transfer and Manipulations: MOV, ADD, MUL, AND, OR, ...

Transfer of program control: JMP, JC, …

Machine control: can halt processing, reset the hardware, INT, HLT …

17. Q: Why HLL programs need to be translated before execution?

A: Computers do not understand high-level languages directly, only machine languages.

18. Q: What is the von Neumann model?

A: The computer is a general-purpose machine controlled by an executable program.

19. Q: What is the difference between von Neumann machine and Harvard architecture?

A:

20. Q: Motivate the use of Harvard architecture.

21. Q: What is the additional cost from the usage of Harvard architecture?

A:

22. Q: Both ? and ? are held in computer’s memory and both represented by?

A: Program and data.

23. Q: Identify the von Neumann bottleneck.

A: CPU is continuously forced to wait for vital data (and instructions) to be transferred to or from memory.

24. Q: How could computers distinguish data from instructions since they are both represented by binary codes?

A: 1) Distinguish between commands and data by different time periods.

2) Distinguished by the source of the address.

25. Q: Most desktop CPUs have an internal “instruction cache” feeding the control unit and a completely separate

“data cache”. This mimicks which computer architecture?

A: Harvard architecture.

l Lecture 3

1. Q: Name 4 examples of HLLs.

A: FOTRAN, COBOL, C, C++, Java, Perl, …

2. Q: Translation fills in the semantic gap in computer systems. True or false?

A: True.

3. Q: Name 3 different ways of translation. Identify the crucial role of translation under each.

A: Compilers: translating HLL instructions into machine code (sequence of instructions) before the code can be run

on the machine.

Assemblers: translating mnemonic form of machine instructions (like MOV, ADD, etc) into their binary codes.

Interpreters: translating HLL instructions into machine code on-the-fly (while the program is running).

4. Q: When compile-time errors occur, what do we do?

A: Check grammar.

5. Q: What are the purposes of linking?

A: Linking: resolving external references.

6. Q: ‘Loading’ is carried out before ‘linking’ after a program is complied. True or false?

A: False.

7. Q: Program modules can be compiled separately. True or false?

A: True.

8. Q: A compiler can translate a module into binary codes, but it cannot resolve those references to other modules.

this occurs when?

A:

9. Q: Library files are usable if linked into your program code. True or false?

A: True. Library files provide many functions for programmers, but are only usable if linked into your code.

10. Q: Interpreters typically convert program code into what?

A: Instructions are converted into an intermediate form, consisting of tokens. (In Java, tokens such as: static,

boolean, file, string, void, return).

11. Q: What is the output of program compilation?

A: Take a program and translate it as a whole into machine code. The process of translation and execution are

separate.

12. Q: Name 2 scenarios where interpreters are more useful than compilers.

A: Interpreters are more accurate in terms of error reporting. Interpretation can provide uniform execution

environment across several diverse computers.

13. Q: Interpreters are sometimes called as virtual machine because?

A: Interpreters are somewhat similar to the computer hardware.

14. Q: Mention 3 approaches to code sharing.

A:

Source-level subroutines and macro libraries.

Pre-translated re-locatable binary libraries.

Dynamic libraries and dynamic linking.

15. Q: Name 2 disadvantages (or issues) of macro libraries.

A: Who owned the code?

Who should maintain it?

16. Q: Libraries can be linked into your program code, but not altered. True or false?

A: True. Pre-translated relocatable binary libraries can be linked into your new code, but not altered.

17. Q: What are the disadvantages of program execution with pre-translated program library?

A: Each program is to have a private copy of the subroutines, wasting valuable memory space, and swapping time,

in a multitasking system.

18. Q: There exists a de-facto standard of dynamic libraries and dynamic linking. True or false?

A:

l Lecture 4

1. Exercise: Convert the following decimal numbers into binary.

-1023 1111111111

-998 1111100110

2. Exercise: Translate the following hex number into decimal.

-03AB 939

-0FEE2 65250

3. Exercise: Convert the following into Hex.

-255 FF

-128 80

4. Q: Define ‘bit’

A: A bit is the most basic unit of information. It contains the information necessary to distinguish two alternatives.

(1 or 0, YES or NOT).

5. Q: Decimal notation is more compact than binary. True or false?

A: False.

6. Q: Binary is more “convenient” for computers due to?

A: Based on the two-state, ON/OFF technology.

7. Q: Every number can be used as a base. True or false?

A: True.

8. Q: Hexadecimal notation uses ? as a base.

A: 16.

9. Q: Octal notation uses ? as a base.

A: 8.

10. Q: Why do we use hexadecimal, or base 1, number notation?

A: Any hexadecimal digit represents some 4-digit pattern (binary number) and vice versa.

11. Q: How many bits are required to encode ASCII?

A: 8bits. The maximum number of characters that can be represented in ASCII is 256, so 2^8 8bits.

l Lecture 5

1. Q: The most widely used binary code with non-IBM mainframes and virtually all microcomputers:

A: ASCII.

2. Q: ASCII is divided into two classes of codes?

A: The table is divided into two classes of codes: -Printing codes -Control codes

3. Q: What is the most widely-used standard for floating-point computation?

A: IEEE 754 standard.

4. Q: Two things happen when you declare variables in a program. What are they?

A: Integers and real values. Positive and negative.

l Lecture 6

1. Exercise: Demonstrate the concept of client-server computing using Web as an example.

-Identify key entities under the Web.

-Explain how services are rendered via client-server computing.

-Pinpoint potential bottleneck under this Web scenario.

2. Q: What is the most important development during the past 40 years evolution of OS?

A: Windowing interfaces.

3. Q: Explain ‘multitasking’.

A: Programs can run simultaneously, if they are not too resource consuming.

4. Q: Mention 3 functions that need to be provided when an OS is to support ‘multi-tasking’.

A: -Memory manager. -Scheduler. -Security kernel.

5. Q: Explain ‘multi-user’.

A: Support for multiple users.

6. Q: How does operating system provide access to network facilities?

A: Via networking API. e.g. socket interface

7. Q: Telecommuting or online shopping are enabled through the introduction of?

A: Connectivity.

l Lecture 7

1. Q: What is the difference between a ‘general purpose machine’ and a ‘special purpose machine’ (‘CPU’ vs

‘coprocessor’)?

A:

2. Q: Assume that there are 6 devices to be interconnected via 8 data lines (wires) plus 2 control lines (wires), how

many wires will be needed if point-to-point connection scheme is used? [n*(n-1)/2]

A:

3. Q: Name 2 registers that are always used during each instruction execution.

A: -Instruction Pointer (IP) -Accumulator (AX) -Instruction Register (IR)

4. Q: How many pixels are rendered with 1024x768 screen resolution?

A: 786432.

5. Q: Name 2 typical applications run by coprocessors.

A: -Math -Graphics

6. Q: Name 3 different types of bus in a computer system.

A: -Address bus -Data bus -Control bus

7. Q: List 2 reasons behind bus bottleneck.

A: -The number of wires required for a bus is much smaller than that for point-to-point connections.

-A bus can only transfer one item of data at a time, like a railway line.

8. Q: Highlight the 2 major components of a CPU.

A:

9. Q: What tasks are performed during a machine cycle?

A: I-cycle: -Instruction fetch -Instruction decode

E-cycle: -Execute -Store results

10. Q: Computers & printers are usually connected via what type of ports?

A: USB (Universal Serial Bus).

11. Q: RISC refers to?

A: Processors that support fewer instructions than do CISC chips.

12. Q: The computer’s main processor follows its instructions to manipulate data into information.

A: CPU.

13. Q: Name 4 register that are always used during each instruction execution.

A: Instruction Pointer (IP). Accumulator (AX, EAX in Pentium) Instruction Register (IR). Memory Address Register

(MAR).

l Lecture 8

1. Q: The ‘execute’ phase is the same for different types of instructions. True of false?

A: True. The fetch-execution is the same for different types of instructions, while execute phase depends on the

type of instruction.

2. Q: The assembler program takes as input a program written in assembly language, and translate instructions into ?

form.

A: Translate instructions into their binary machine-code form.

3. Q: Assembler associates labels with?

A: Associates labels with memory addresses.

4. Q: A CPU may execute only instructions loaded in the main memory. True or false?

A: True. A program has to be loaded into somewhere in main memory in order to be executed.

5. Q: Access time is the same for all the RAM cells. True or false?

A: True. Access time is the same for all the stored items.

6. Q: What is the meaning of MOV EBX, [EBX]?

A: Find the address in EBX and send the value to the EBX register.

7. Q: JNZ L2 means?

A: Force a new address into EIP if register EFLAG Z does not equal to 0.

8. Q: When will there be compile time error for the above instruction?

A:

9. Q: Is MOV maxval, loc 1 a valid assembly code?

A: No. There is no register.

l Lecture 9

1. Q: Name 3 use cases of the Flag register in Pentium.

A: The flag register holds the CPU status flag.

2. Q: The flag register can be used to pass information between one instruction and the subsequent instructions. True

or false?

A: True.

3. Q: Which register is used to store the result of subtraction from this instruction?

CMP AL, BL

A: CPU EFLAG register.

4. Q: Under inline assembly, what mechanism is used to pass arguments to printf routine?

A: To pass arguments to printf we use stack.

5. Q: Inline assembler can be used to call a C library function within an assembly segment in a C program. True or

false?

A: True.

6. Q: Status flags are set (or cleared) before an instruction is being executed. True or false?

A:

7. Q: D Flag is used to set the direction of looping. True or false?

A: False.

l Lecture 10

1. Q: The Pentium instruction set has a fixed width for all instructions to speed up instruction decoding. True or false?

A: True. Pentium instructions can be from 1 to 15bytes long, depending on:

-The operation required. -The addressing modes employed.

2. Q: What are those 3 major components covered by every instruction?

A: -The action or operation of the instruction.

-The operands involved (where to find the information to operate with).

-Where the result is to go.

3. Q: Which of the following is the fastest to execute?

-MOV EAX, B -MOV A, EBX -MOV EAX, EBX

A: The last is the fastest to execute.

4. Q: The following instruction will involve the calculation of ‘effective address’. True or false?

A: True. MOV EAX, [table+ESI] and MOV EAX, table[ESI] both cases the effective address is obtained by adding

the address ‘table’ contained in the operand field of the instruction to the content of a register(s).

The symbol of ‘table’ is the address of the array base.

5. Q: After the execution of the following instruction, EAX will contain the content of message1 inside. True or false?

-lea eax, message1

A: False. This instruction, contains the address of ‘message1’ variable, which is loaded into eax register after the

execution of the instruction.

l Lecture 11

1. Q: To pass two parameters to printf in inline assembly code, the first parameter should be pushed onto the stack

first. True or false?

A: False. Push the second parameter (integer variable to the stack), then push the first parameter (actually, address

of the string) to the stack.

2. Q: When calling printf in inline assembly, the parameters passed to it will be popped off stack by printf. True or

false?

A: True. Call printf, it will take two parameters from the stack.

3. Q: When calling scanf in inline assembly, the address of the variable to receive input needs to be pushed onto the

stack. True or false?

A: True.

4. Q: What is the conversion specifier to be used when printing a string under printf?

A: %d or %i for decimal %s for string %c for character

5. Q: If three integer parameters were pushed onto stack when calling ‘scanf’ in inline assembly, how could you adjust

the value of register ‘esp’ when returning from ‘scanf’?

A:

6. Q: The execution of “cmp eax, ebx” will check upon the setting of zero flag. True or false?

A: True. It compares two values without changing them, while it changes the status flags according to the results

of the comparison.

l Lecture 12

1.

  • 3
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值