Cso Questionbank
Cso Questionbank
A computer in its simplest form comprises of five units namely input unit, output
unit, memory unit, arithmetic and logical unit and control unit.
INPUT UNIT
Input units are used by the computer to read the data. The most commonly used
input devices are keyboards, mouse, joysticks, trackballs, microphones, etc.
CENTRAL PROCESSING UNIT
MEMORY UNIT
The Memory unit can be referred to as the storage area in which programs are kept
which are running, and that contains data needed by the running programs.
The Memory unit can be categorized in two ways namely, primary memory and
secondary memory.
• It enables a processor to access running execution applications and services that are
temporarily stored in a specific memory location.
Primary storage is the fastest memory that operates at electronic speeds. Primary
memory contains a large number of semiconductor storage cells, capable of storing
a bit of information. The word length of a computer is between 16-64 bits.
Cache memory is also a kind of memory which is used to fetch the data very soon.
They are highly coupled with the processor.
The most common examples of primary memory are RAM and ROM.
Secondary memory is used when a large amount of data and programs have to be
stored for a long-term basis.
The most common examples of secondary memory are magnetic disks, magnetic
tapes, and optical disks
Most of the computer operators are executed in ALU of the processor like addition,
subtraction, division, multiplication, etc. the operands are brought into the ALU from
memory and stored in high-speed storage elements called register. Then according to
the instructions, the operation is performed in the required sequence.
The control and the ALU are many times faster than other devices connected to a
computer system. This enables a single processor to control a number of external
devices such as keyboards, displays, magnetic and optical disks, sensors and other
mechanical controllers.
CONTROL UNIT
It effectively is the nerve centre that sends signals to other units and senses their states.
The actual timing signals that govern the transfer of data between input unit,
processor, memory and output unit are generated by the control unit.
OUTPUT UNIT
These actually are the counterparts of the input unit. Its basic function is to send the
processed results to the outside world.
The simplest and most common way of interconnecting various parts of the
computer. To achieve a reasonable speed of operation, a computer must be
organized so that all its units can handle one full word of data at a given time. A
group of lines that serve as a connecting port for several devices is called a bus.
Since the bus can be used for only one transfer at a time, only two units can actively
use the bus at any given time. Bus control lines are used to arbitrate multiple requests
for use of one bus.
Performance:
Let us examine the flow of program instructions and data between the memory and
the processor. At the start of execution, all program instructions and the required
data are stored in the main memory. As the execution proceeds, instructions are
fetched one by one over the bus into the processor, and a copy is placed in the cache
later if the same instruction or data item is needed a second time, it is read directly
from the cache.
For example:
Suppose a number of instructions are executed repeatedly over a short period of time
as happens in a program loop. If these instructions are available in the cache, they
can be fetched quickly during the period of repeated use. The same applies to the
data that are used repeatedly.
The Central Processing Unit can also be defined as an electric circuit responsible
for executing the instructions of a computer program.
The major components of CPU are Arithmetic and Logic Unit (ALU), Control Unit
(CU) and a variety of registers.
1. CU (Control Unit)
The Control Unit of a computer system controls the operations of components
like ALU, memory and input/output devices.
2. Registers
Registers refer to high-speed storage areas in the CPU. The data processed by
the CPU are fetched from the registers.
Following is the list of registers that plays a crucial role in data processing.
3. Buses
Buses are the means by which information is shared between the registers in a
multiple-register configuration system.
A bus structure consists of a set of common lines, one for each bit of a register,
through which binary information is transferred one at a time. Control signals
determine which register is selected by the bus during each particular register
transfer.
3.What bus and memory transfer? Explain common bus system with neat
diagram.
2. A common bus consists of a set of common lines, one for each bit of a register.
3. Control signals determine which register is selected by the bus during each
particular register transfer.
o Using Multiplexers
o Using Tri-state Buffers
The multiplexers select the source register whose binary information is then placed
on the bus.
The construction of a bus system for four registers is shown in the Figure.
The bus consists of four 4 x 1 multiplexers each having four data inputs, 0
through 3, and two selection inputs, S1 and S0.
2. The diagram shows that the bits in the same significant position in each
register are connected to the data inputs of one multiplexer to form one line of
the bus.
3. Thus MUX 0 multiplexes the four 0 bits of the registers, MUX 1 multiplexes
the four 1 bits of the registers, and similarly for the other two bits.
4. The two selection lines Si and So are connected to the selection inputs of all
four multiplexers.
The selection lines choose the four bits of one register and transfer them into the
four-line common bus.
When S1S0 = 00, the 0 data inputs of all four multiplexers are selected and applied
to the outputs that form the bus.
This causes the bus lines to receive the content of register A since the outputs of
this register are connected to the 0 data inputs of the multiplexers.
Similarly, register B is selected if S1S0 = 01, and so on. Table 4-2 shows the
register that is selected by the bus for each of the four possible binary value of the
selection line as shown in example
When the bus is includes in the statement, the register transfer is symbolized as
follows:
The content of register C is placed on the bus, and the content of the bus is loaded
into register R1 by activating its load control input. If the bus is known to exist in
the system, it may be convenient just to show the direct transfer.
R1← C
When bits are transmitted over the computer network, they are subject to get
corrupted due to interference and network problems. The corrupted bits lead to
spurious data being received by the receiver and are called errors.
Error – detecting codes ensures messages to be encoded before they are sent over
noisy channels. The encoding is done in a manner so that the decoder at the receiving
end can detect whether there are errors in the incoming signal with high probability
of success.
Error detecting codes are adopted when backward error correction techniques are
used for reliable data transmission. In this method, the receiver sends a feedback
message to the sender to inform whether an error-free message has been received
or not. If there are errors, then the sender retransmits the message.
1. Error-detecting codes are usually block codes, where the message is divided into
fixed-sized blocks of bits, to which redundant bits are added for error detection.
2. Error detection involves checking whether any error has occurred or not. The
number of error bits and the type of error does not matter.
Checksum
Parity check is done by adding an extra bit, called parity bit to the data to make
number of 1s either even in case of even parity, or odd in case of odd parity.
While creating a frame, the sender counts the number of 1s in it and adds the parity
bit in following way
In case of even parity: If number of 1s is even then parity bit value is 0. If number
of 1s is odd then parity bit value is 1.
In case of odd parity: If number of 1s is odd then parity bit value is 0. If number of
1s is even then parity bit value is 1.
On receiving a frame, the receiver counts the number of 1s in it. In case of even
parity check, if the count of 1s is even, the frame is accepted, otherwise it is
rejected. Similar rule is adopted for odd parity check.
LRC (Longitudinal Redundancy Check)
LRC generally applies to a single parity bit per bit stream. Although simple
longitudinal parities only detect errors, a combination with additional error control
coding, such as a transverse redundancy check, are capable of correcting errors
1 1 1
1 0 0
0 1 1
This is a block code method where a checksum is created based on the data values
in the data blocks to be transmitted using some algorithm and appended to the data.
When the receiver gets this data, a new checksum is calculated and compared with
the existing checksum. A non-match indicates an error.
• Receiver’s End − The receiver adds the incoming segments along with the
checksum using 1’s complement arithmetic to get the sum and then complements
it.
Suppose that the sender wants to send 4 frames each of 8 bits, where the frames
are 11001100, 10101010, 11110000 and 11000011.
The sender adds the bits using 1s complement arithmetic. While adding two
numbers using 1s complement arithmetic, if there is a carry over, it is added to the
sum.
After adding all the 4 frames, the sender complements the sum to get the checksum,
11010011, and sends it along with the data frames.
The receiver performs 1s complement arithmetic sum of all the frames including
the checksum. The result is complemented and found to be 0. Hence, the receiver
assumes that no error has occurred.
number system, and hexadecimal number system etc. But Binary number system
is most relevant and popular for representing numbers in digital computer system.
Fixed-point representation:
This representation has fixed number of bits for integer part and for fractional
part. For example, if given fixed-point representation is IIII.FFFF, then you can
store minimum value is 0000.0001 and maximum value is 9999.9999. There are
three parts of a fixed-point number representation: the sign field, integer field,
and fractional field.
1 00010011 10010101
Floating-point representation:
This representation does not reserve a specific number of bits for the integer part
or the fractional part. Instead, it reserves a certain number of bits for the number
(called the mantissa or significand) and a certain number of bits to say where
within that number the decimal place sits (called the exponent).
The floating number representation of a number has two parts: the first part
represents a signed fixed-point number called mantissa. The second part of
designates the position of the decimal (or binary) point and is called the exponent.
The fixed-point mantissa may be fraction or an integer.
Representation
Single Precision
Double Precision
1 00010011 10010101
1 00010011011 10010101.. N
10 * 5^4 10 4 5
254756.145 254756145 -3 10
1.N * 2 ^ E-127
• Single Precision
1.N * 2 ^ E-1023
• Double Precision
• Formula for single and double precision format.
• Example:
1. 85.125
2. 85 = 1010101
3. 0.125 = 001
4. 85.125 = 1010101.001 = 1.010101001 x 2^6
5. sign = 0
6. Single precision: biased exponent 127+6=133
7. 133 = 10000101
8. Normalized mantissa = 010101001
9. We will add 0's to complete the 23 bits
10. The IEEE 754 Single precision is:
0 10000101 01010100100000000000000
1. What is register?
Computer registers are designated by upper case letters (and optionally followed
by digits or letters) to denote the function of the register.
For example, the register that holds an address for the memory unit is usually
called a memory address register and is designated by the name MAR.
Other designations for registers are PC (for program counter), IR (for instruction
register, and R1 (for processor register).
The most common way to represent a register is by a rectangular shape with the
name of the register inside.
The statement R2← R1 denotes a transfer of the content of register R1 into register
R2.
By definition, the content of the source register R 1 does not change after the
transfer.
If we want the transfer to occur only under a predetermined control condition then
it can be shown by an if-then statement. if (P=1) then R2← R1.
We can separate the control variable from the register transfer operation by
specifying a control function.
Figure shows the block diagram that depicts the transfer from R1
The letter n will be used to indicate any number of bits for the register. It will be
replaced by an actual number when the length of the register is known.
It is assumed that the control variable is synchronized with the same clock as the
one applied to the register.
The basic symbols of the register transfer notation are listed in below table
A comma is used to separate two or more operations that are executed at the same
time.
They transfer data between registers and between external buses of theCPU and
also perform ALU (Arithmetic and logical operations) on registers.
1. Register Transfer
This type of microoperations is used to transfer from one register to another binary
information
2. Arithmetic Micro-operation
This type of microoperations is used to perform on numeric data stored on registers
some arithmetic operation
3. Logic Micro-operation
This type of microoperation used to perform bit style operation/manipulation on
non-numeric data
4. Shift Micro-operation
As name suggest this operation is used to perform for shift operation in data stored
in register
In computer architecture and digital logic design, micro-operations refer to the basic
operations performed by a computer's control unit. These operations are typically
low-level and involve manipulating individual bits or groups of bits within the
computer's registers and memory.
7. Logical operations: These include bitwise operations such as AND, OR, XOR
(exclusive OR), and NOT (complement). These operations manipulate individual
bits within binary numbers.
These arithmetic microoperations are the building blocks for executing more
complex arithmetic and logical computations within a microprocessor or computer
system. They are performed at the digital logic level, often using arithmetic and
logic units (ALUs) or specialized arithmetic processing units within the CPU.
R1 <- R2 + R3
As you can see three registers one for storing the result and rest of two are used
for the addition operation and as an explanation R1 is the register which stores
the result of addition of R2 and R3 register.
1. Logical Shift:
Left Logical Shift (LSL): In an LSL operation, the bits of a binary number are
shifted to the left by a specified number of positions. The vacant bits on the right are
filled with zeros, and the bits on the leftmost side are discarded.
Right Logical Shift (LSR): In an LSR operation, the bits of a binary number are
shifted to the right by a specified number of positions. The vacant bits on the left are
filled with zeros, and the bits on the rightmost side are discarded.
2. Arithmetic Shift:
Left Arithmetic Shift (ASL): In an ASL operation, the bits of a binary number
are shifted to the left by a specified number of positions. The vacant bits on the
right are filled with zeros, and the bits on the leftmost side are discarded. The
leftmost bit, also known as the sign bit, remains unchanged.
Right Arithmetic Shift (ASR): In an ASR operation, the bits of a binary number
are shifted to the right by a specified number of positions. The vacant bits on the
left are filled with the value of the sign bit (the leftmost bit), preserving the sign of
the number. The bits on the rightmost side are discarded.
The length of machine language instructions can vary, including single-byte, two-
byte, or three-byte instructions.
The length of an instruction determines the amount of data it can operate on and the
complexity of the operation it performs.
3. Briefly explain Single-byte, Two-byte, and Three-byte instructions.
Single-byte Instructions: Single-byte instructions are machine language instructions
that consist of only one byte.
They are generally used for simple and basic operations that don't require large
amounts of data or complex calculations.
They allow for a wider range of operations and can handle larger data values.
Three-byte Instructions: Three-byte instructions are machine language instructions
that consist of three bytes.
They provide even more versatility and complexity in terms of operations and data
manipulation.
ADD R1, R2
Example: ADD R1, R2 (Add the content of register R2 to the content of register
R1)
Direct Addressing:
Example: LOAD R1, 0x1000 (Load the value from memory address 0x1000 into
register R1)
Indirect Addressing:
Example: LOAD R1, (R2) (Load the value from the memory address stored in
register R2 into register R1)
Indexed Addressing:
Example: LOAD R1, 0x1000(R2) (Load the value from the memory address
calculated by adding the content of register R2 with the displacement 0x1000
into register R1)
Load (LD):
Example: LD A, B - copies the contents of register B to register A.
Store (ST):
Examples:
Conditional Branch:
Example: BEQ Label - Branch to the instruction at "Label" if the previous
comparison resulted in equality (zero flag set).
Unconditional Branch:
Example: JMP Label - Unconditionally jump to the instruction at "Label".
Example: POP A - Pops the value from the top of the stack and stores it in register
A.
9. I/O operation.
Input/Output (I/O) operations involve communication between the computer and
external devices.
Machine control operations manage the execution and control of the computer.
Input/Output instructions facilitate the transfer of data between the computer and
input/output devices.
Machine control instructions manage the flow of execution, such as starting or
stopping the execution of a program or handling interrupts.
Input/Output Operations:
Input (IN): Reads data from an input device, such as a keyboard, and stores it in a
register or memory location.
Output (OUT): Sends data from a register or memory location to an output device,
such as a display or printer.
Example: IN A, Port1 - Reads data from input port "Port1" and stores it in register
A.
OUT Port2, A - Sends the contents of register A to output port "Port2".
Assembly language programs are translated into machine code using an assembler.
Assembly language programming allows for direct control over the computer's
hardware and is used in situations where the performance or low-level access is
critical.
Assembly language is often used for device drivers, embedded systems, and
performance-critical applications.