Unit-1 1 (PPS)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Unit-1.

1(PPS)(BCS201)

Unit-1

Pseudo code

Algorithms can be represented in the form of pseudo-code and flow chart


both. Pseudo code is the way to write any algorithm using some formal
notations of mathematics, programming syntax and English words step by
step.

Difference Between Algorithm and Pseudocode

1. An algorithm is defined as a well-defined sequence of steps that


provides a solution for a given problem, whereas a pseudo code is one
of the methods that can be used to represent an algorithm.

2. While algorithms are generally written in a natural language or plain


English language, pseudo code is written in a format that is similar to
the structure of a high-level programming language. Program on the
other hand allows us to write a code in a particular programming
language.

Ques: Draw the memory hierarchy structure of a computer system.


[2018-19(sem-1)]

Memory Organization in Computer Architecture / Memory


hierarchy of a computer system

Memory:
Memory is a place in computer where we can store the data. Generally,
memory/storage is classified into 2 categories:

1) Volatile Memory: This loses its data, when power is switched off.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

2) Non-Volatile Memory: This is a permanent storage and does not lose


any data when power is switched off.

Memory Access Methods


To access data from any memory, first it must be located and then the data
is read from the memory location. Following are the methods to access
information from memory locations:

1. Random Access: Main memories are random access memories, in


which each memory location has a unique address. Using this unique
address any memory location can be reached in the same amount of
time in any order.
2. Sequential Access: This method allows memory access in a
sequence or in order.
3. Direct Access: In this mode, information is stored in tracks, with
each track having a separate read/write head.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

Memory Hierarchy

The total memory capacity of a computer can be visualized by hierarchy of


components. The memory hierarchy system consists of all storage devices
contained in a computer system from the Auxiliary Memory to Register.

Main Memory/ Primary Memory:


➢ It is the central storage unit of the computer system.
➢ It is also known as volatile memory and it stores the data for short
period of time.
➢ It is a large and fast memory used to store data during computer
operations.
➢ There are two types of main memory: RAM and ROM.

1) RAM: Random Access Memory

➢ It stores the current working data and responsible for processing


speed of the computer system.
3

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

➢ There are 2 types of RAM:

1) DRAM: Dynamic RAM, is made of capacitors and transistors, and


must be refreshed every 10~100 ms. It is slower and cheaper
than SRAM.
2) SRAM: Static RAM, has a six transistor circuit in each cell and
retains(holds) data, until power off.

2) ROM: Read Only Memory, is non-volatile and is more like a permanent


storage for information. It also stores the bootstrap loader program, to
load and start the operating system when computer is turned
on. PROM(Programmable ROM), EPROM(Erasable PROM)
and EEPROM(Electrically Erasable PROM) are some commonly used ROMs.

Auxiliary Memory/Secondary Storage:


➢ It stores the data permanently.
➢ The access time of this memory is slower than the primary memory.
➢ Devices that provide backup storage are called auxiliary memory.
➢ It is not directly accessible to the CPU, and is accessed using the
Input/Output channels.
For example: Flash memory or pen drive, floppy, hard disk,
CD/DVD/Memory Card, Magnetic tapes etc..

Cache Memory:

➢ The cache memory stores the currently used data.


➢ The data or contents of the main memory that are used again and
again by CPU, are stored in the cache memory so that we can easily
access that data in shorter time.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

➢ Whenever the CPU needs to access memory, it first checks the cache
memory. If the data is not found in cache memory then the CPU
moves onto the main memory. It also transfers block of recent data
into the cache and keeps on deleting the old data in cache to
accommodate the new one.

Computer Registers

➢ Registers are a type of computer memory used to quickly accept,


store, and transfer data and instructions that are being used
immediately by the CPU.
➢ The registers used by the CPU are often termed as Processor registers.
➢ A processor register may hold an instruction, a storage address, or any
data
➢ Following is the list of some of the most common registers used in a
basic computer:

Register Symbol Number of bits Function

Data register DR 16 Holds memory operand

Address register AR 12 Holds address for the memory

Accumulator AC 16 Processor register

Instruction register IR 16 Holds instruction code

Program counter PC 12 Holds address of the instruction

Temporary register TR 16 Holds temporary data

Input register INPR 8 Carries input character

Output register OUTR 8 Carries output character

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

Ques: Difference between RAM and ROM. [2016-17, 2018-2019]

Difference between RAM and ROM

S.No. RAM ROM

RAM is a volatile memory which ROM is a non-volatile memory


1 could store the data as long as which could retain the data even
the power is supplied. when power is turned off.

The access speed of RAM is Its speed is slower in comparison


2
faster. with RAM.

The price of RAM is quite high. The price of ROM is


3
comparatively low.

RAM is used to store temporary ROM memory is used to store


4 information. permanent information, which is
non-erasable.

Both R (read) and W (write) The ROM memory allows the


operations can be performed over user to read the information.
5
the information which is stored in But, the user can't alter the
the RAM. information.

Information stored in the RAM is The processor can't directly


easily accessed. access the information that is
stored in the ROM. In order to
6 access ROM information first, the
information is transferred into
the RAM, and then it can be
executed by the processor.

RAM allows the computer to read ROM stores all the application
data quickly to run applications. which is needed to boot the
7
computer initially. It only allows
for reading.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

Ques: Differentiate High Level and Low Level language. [2021-22]

Difference between High Level and Low level languages

HIGH LEVEL LANGUAGE LOW LEVEL LANGUAGE

1 It is programmer/user friendly It is a machine friendly language.


language. as this language is i.e., the computer understands the
written in simple English words, machine language, which is
which can be easily understood represented in 0 or 1.
by humans.

2 The high-level code can run on The machine code cannot run on all
all the platforms, so it is a machines, so it is not a portable
portable language. language.

3 It is less memory efficient. It is memory efficient.

4 It is easy to understand. It is tough to understand.

5 Debugging and maintenance are Debugging and maintenance are not


easier in a high-level language. easier in a low-level language.

6 It can run on any platform. It is machine-dependent.

7 BASIC, Perl, Pascal, COBOL, Machine language and Assembly


Ruby etc are examples of High- language are Low-Level Languages.
Level Languages.

8 It needs compiler or interpreter It needs assembler for translation.


for translation.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

Difference Between Compiler and Interpreter

COMPILER INTERPRETER

1 It takes an entire program at a It takes a single line of code or


time. instruction at a time.

2 It generates intermediate object It does not produce any


code. intermediate object code.

3 Compilers usually take a large Interpreters usually take less


amount of time to analyze the amount of time to analyze the
source code. However, the source code. However, the overall
overall execution time is execution time is comparatively
comparatively faster than slower than compilers.
interpreters.

4 Memory requirement is more It requires less memory as it does


due to the creation of object not create intermediate object code.
code.

5 Display all errors after Displays error of each line one by


compilation, all at the same one.
time.

6 C, C++, C#, Scala, typescript Basic, PHP, Perl, Python, Ruby,


uses compiler. SNOBOL, MATLAB uses an
interpreter.

Ques: What is the difference between .obj and .exe file in C?[2016-
2017,2018-2019]

Object Code and Executable Code

Object Code-
The computer does not understand the source program or the source code.
Therefore, the compiler converts the source program into an object
program.
8

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

It contains the instructions for the machine to perform. These instructions


are in the form of binary digits. The machine understands this object code.
Therefore, the computer can execute this code.
Generally, the object code is specific to the system architecture. Extension of
object code is .obj.

Executable code-
Executable (also called the Binary) is the output of a linker after it
processes the object code. A machine code file can be
immediately executable (i.e., runnable as a program), or it might
require linking with other object code files (e.g. libraries) to produce a
complete executable program.

S.No. Object Code Executable Code

1 A sequence of statements in A file or a program that


binary that is generated after indicates tasks according to
compiling the source program. encoded instructions which is
directly executed by the CPU.

2 An intermediate file. A final file.

3 A compiler converts the source A linker links the object files


code to an object file. with the system library and
combines the object files
together to create an
executable file.

4 Can not be directly executed by Can be directly executed by


the CPU. the CPU.

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

Ques: Write Short Notes on the following:


(i) Top down programming (ii) Structured Programming

Ans : (i) Top down programming :


In this approach of programming a system is break down into smaller sub
systems , so that we can see more detail concept of modules. In a top down
approach an overview of the system is firstly formulated, then specifying but
not detailing any first level sub systems.
Each sub system is then refined into more primary and smaller sub systems.
This is called modularization. Modularization makes the program to
understand , write and debug.

Structured Programming :

This implements logical structure on the program to be written. Thus


program becomes more efficient, simple and easy. This allows program
loaded into memory and to be reused .Modules are coded separately and
tested. After that all the modules are combined together to make larger sub
system. Language like C , Pascal support structured programming. Each
module has its own local data and performs specific task.

Differentiate between system software and application software.


S.No System Softwares Application Softwares
These are low level programs that These are high end softwares used
1. interact with computer at very to solve specific problems
basic level.
Mostly written in assembly These are written in C , C++, Java,
2. language, C Dot Net, Android

Some utility programs like device These are portable to any type of
3. drivers are also system softwares. platform/Operating system
These are generally hardware
specific.
Example : Operating system, MS Office, Adobe photo shop,
4. Device drivers, compilers, linker , Gaming softwares,

10

@Jeetesh Srivastava[UCER(CSE)]
Unit-1.1(PPS)(BCS201)

loader. Android apps, reservation sites.

What is an Operating System(OS) in computer terminology ?


Mention any five types of Operating System.
Ans: (i) An operating system is a system software which works as an
interface between the user and hardware of computer system.
(ii) OS is responsible for managing and coordinating various activities and
resource sharing within the given limit of computer. Example : Microsoft
windows, Linux, Android, Mac OS, Symbian etc.
Various types of OS are as follows :
(i) Real time OS (ii) Multi user and single user OS (iii) Multitasking OS (iv)
Multi Programming OS (v) Distributed OS (vi) Network OS (vii) Embedded
OS.

11

@Jeetesh Srivastava[UCER(CSE)]

You might also like