Tuesday, October 18, 2022

Getting Started with Python and Data Handling

 

REVISION – REVIEW OF PYTHON

 

1)    What is the difference between keyword and identifier?

2)    How many ways are there to represent an integer literal?

3)    What will be the sizes of following constants:

i)                   ‘\a’

ii)                 “Reema\’s”

iii)               “XY \

 YZ”

iv)               “””XY<Enter>

      YZ”””

 

 

4)    How do you create multi line strings

5)    Write the following real constants in exponent form:

i)                   17.25              ii) ).452

6)    Write a program that displays a joke. But display the punchline only when the user presses enter key.

7)    Input 2 dates from the user and display difference between 2 dates.

8)     What are augmented opertors? How are they useful?

9)    Evaluate and Justify:

a)     0 or None and “or”

b)    “abc”==”Abc” and not(2==3 or 3==4)

c)     3<5 or 50/5 –(3+2))

d)    2*(2 * (len(“01”)))

10)                       What is the result produced by i) bool(0) ,ii) bool(str(0))

11)                       Predict the output:

a)     a=va=3

b=va=3

print(a,b)

 

b)    a=3

b=3.0

print(a==b)

print(a is b)

 

c)     a,b,c=1,1,2

d=a+b

e=1.0

f=1.0

g=2.0

h=e+f

print(c==d)

print(c is d)

print(g==h)

print(g is h)

 

d)    x,y=4,8

z=x/y*y

print(z)   

 

e)     a=True

b=(0<5)+0

print(a,b)

print(a==b)

print(a is b)

c=str(a)

d=str(bool(b))

print(c==d)

print(c is d)

 




 

1

Friday, July 29, 2022

2020-21

 




COMPUTER SYSTEM ORGANIZATION - NOTES

 

Computer - Electronic device which can store and process data , sends out in a meaningful form which the user can understand with the help of software.

Hardware - Components of the computer and also the devices attached to it.

Software - Set of programs that is designed to perform well defined functions in order to run the hardware smoothly.

I-P-O- Cycle - Input - Proces - Output cycle means the computer takes in input from input devices, stores it in memory, processes it, and sends it as output .

John Von Newmann - Founded concept of stored program.

Components of computer

Component

Function

Memory

stores data and programs

Processor

executes instructions or processes data

ALU

Performs arithmetic and logical operations

CU

The control unit (CU) is a component of a computer's central processing unit (CPU) that directs the operation of the processor.

Register

type of computer memory used to quickly accept, store, and transfer data and instructions

Cache

small-sized type of volatile computer memory that provides high-speed data access to a processor and stores frequently used computer programs, applications and data.

RAM

Temporary memory that stores active programs and data. It is volatile , i.e.contents get erased when powered off.

ROM

Non-volatile memrory which contains  pre-defined set of programs used to run the operations of the computer .

Dynamic RAM

Contains transistors and capacitors. Refresh operation happens automatically.

Static RAM

Contains only transistors, faster than DRAM, never refreshes.

Types of ROM

PROM(Programmable Read Only Memory)
EPROM(Erasable Read Only Memory)
EEPROM(Electrically Erasable Read Only Memory)

INPUT DEVICES

Keyboard

Uses keys as entire character set to press keys, which are converted to the binary equivalent and processed.

Mouse

Pointing device, optical mouse uses sensors to detect the movement.

Light Pen

Pointing device to point objects on the screen, uses photocells on the tip of the stylus.

OMR(Optical Mark Reader)

Recognizes pencil or ink shaded marks on pre-printed forms.

SCR(Smart Card Reader)

Uses microprocessor in the card that holds personal data.

Bar Code Reader

Recognizes the stripes at the back of the product in different widths which has a special meaning and generates unique code.

QR Code Reader

It is a machine readable optical label, a type of barcode that can contain information about the item to which it is attached.

Biometric Sensor

converts biometric traits of an individual into electrical signals like eyes, fingerprints etc.

Touch Screen sensor

Uses sensor to recognize the human finger touch or stylus to select objects.

Microphone

takes sound as input and converts into electrical signal.

OCR(Optical Character Reader)

Recognizes text with digital image. Used to recognize text in scanned documents and image.

MICR(Magnetic Ink Character Recognition)

Used to verify the authenticity of paper checks. Uses special ink to recognize the characters in checks.

Webcam

digital video device that can capture pictures and video in real time

OUTPUT UNIT

VDU(Visual Display Unit)/Monitor/Screen – used to display information on the screen by using CRT(Cathode Ray Tube),LCD(Liquid Crystal Display),LED(Light Emitting Diode), OLED(Organic LED).

Speakers – generates sound.

Printer – 3 types – dot matrix – there is a contact between the printer head and the ribbon. No cartridge is used. Printing is done by patterns formed through dots.

Inkjet/Deskjet – uses cartridges filled with liquid ink.

Laser jet – Uses laser technology. Cartridge filled with toners.

SECONDARY STORAGE

Hard disk – contains disk platter using magnetic material where files are stored.

DVD(Digital Video Disk) – Uses optical disk storage device.

Blue Ray Disk – Superseds DVDs,optical disk which is faster than DVDs and has more storage space. Stored HD(High Definition) video, where video quality is better.

CD(Compact Disk) – First generation of CDs that came into the market using optical technology.

Tapes – In earlier days, magnetic tapes , where speed is slower and capacity much lesser than HD-disks now a days, were used to take back up of data.

USB/Pendrive – Small portable memory that is better in capacity of the normal cds, which is reliable, that can be plugged in USB port.

Memory cards – Also called flash cards mainly used with cameras, computers, mobiles ,music players etc. Advantage is power free storage, larger storage capacity.

COMMUNICATION BUS

Address Bus – Used to specify address of a data/memory location. It is 16-bit width.

Data bus – Carries data in binary form. Contains 8-bit of data.

Control Bus – Carries instructions to carry out operations such as Read/write,Input/Output.

SOFTWARE CONCEPTS

Software is set of programs designed to run the smooth working of the hardware .

Types of software –

1)      System software – Interacts directly with hardware. Is responsible for the complete I-P-O process of the computer.

Examples – OS(Operating System),Language translators like Assembler,compiler,interpreter

 

OS – Acts as an interface between the hardware and the user.

Functions –  

a) Resource management – Resources like processor, memory, I/O devices, files ,communication channels will be allocated to different users or other components.

b) Process Management – Ensures it does  not keep the resource idle at any given time. Process is kept busy ,by allocating the jobs on priority to the processor.

c) Memory Management – Allocating memory for all the data and programs that are running , by generating unique addresses, re-allocating same memory space for subsequent processes and also de-allocating the resources when no longer required.

d) Device Management – Any new I/O or external device connected to the computer needs to be configured so that it can be used by the users. Also authorizing the user to use device as a security measure is done.

 

                Interface – A software that allows communication between user and computer.

                Types of interface –

a)      Command Interface – Generally , the user does this interface in the DOS(Disk Operating System) mode. This is enabled by typing the commands. The user has to remember to type the commands to perform an operation in the computer. Input is only through keyboard.

b)      GUI(Graphical User Interface) – In this interface, user interface allows to interact with computer through images rather than text commands in the form of icons, menus and other visual options. Input can be through mouse or keyboard.

c)       Touch-based Interface – Using the  touch screen sensor, one can perform an operation in the computer by touching using the finger and selecting the required option.

d)      Voice-based interface – Modern computers cater to the needs of those people who are unable to use mouse or keyboard or touch screen. It allows voice as the input as a command to perform an operation. Eg – Google Assistant,Cortana for Windows 10 etc.

e)      Gesture based interface – Some interfaces allow gestures like waving, tilting, eye motion etc. This can be seen as a promising potential for applications like gaming, medicine etc.

2)      Language Translator – Software that translates source code written in high level language to object code.

Types of language translator

a)      Assembler – Converts assembly language into machine code.

b)      Compiler – converts complete source program in one go into machine code

c)       Interpreter – translates single statement of source code into machine code immediately before moving on to next line.

APPLICATION SOFTWARE – Software that is bought by the user to perform several  applications like typing text ,computing,creating presentations , storing data, calculations etc is application software.

2 types of application software - general purpose software and specific purpose software.

General Purpose software- Examples - MS-OFFICE applications, ADOBE PHOTOSHOP, browsers like MOZILLA FIREFOX, CHROME, 

Types of Application Software – General Purpose and Specific purpose

General purpose – Generic applications for day-to-day use – eg MS-Word, MS-Powerpoint,Adobe Photoshop, Google chrome,GIMP etc.

Specific purpose – It is customer-specific and tailor-made. Eg – Financial Accounting, Payroll,Banking etc.

UTILITY SOFTWARE - is the software that assists the computer in performing  housekeeping functions like scanning, data backup, removing viruses etc.

Examples – Anti-virus software, Disk Defragmenter, Backup utility, compressor, disk cleaner, device drivers

 

PROGRAMMING TOOLS – Software tools used to type and execute programs . These can be program editors like C++ editors, Python IDLE, IDE’s like ANACONDA,NETBEANS,ECLIPSE etc which integrates programming features with other software in the same environment.