First Semister Finalist
First Semister Finalist
Q. Define Computer.
Ans. The computer is an electronic device that can accept input data. Process the data and
give the result of the process data according to instruction.and store the result.
History of Computers:
The history of computers is ancient; i.e., it goes back to some 500 years BC.
The Chinese used the first computing machine before the 15th century. The name of this
machine was Abacus. '
In 1812, an English mathematician from Cambridge University. Mr Charles Babbage
designed a machine called DIFFERENCE ENGINE.
Processing:-It can perform different type of processing like addition, subtract, division
Accuracy:-Accuracy means to provide result without any error. Computer can Process
large amount of data and generate accurate result.
1.2HARDWARE COMPONENTS:
BASIC COMPONENTS OF COMPUTER
3-Output Unit
4. Storage unit
1) Input Unit
The devices through which we enter data and instructions (Programs) into computer is called
input devices, e.g. keyboard—Mouse, Scanner, digital camera etc.
2) Central Processing Unit (CPU) -
Central Processing Unit (CPU) is the administrator section of computer. It is the brain
of computer. CPU is located on motherboard.
3) Storage Unit (Primary Memory)
NISAR COLLEGE HAJI BABA ROAD MINGORA 0349-9614746
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
This memory is the place where the computer program and data are stored during processing
There is usually two type's primary storage.
RAM:-It stands for Random-Access-Memory or read/write Memory because
i n f o r m a t i o n can either be read from or written to the RAM. RAM is called volatile
or semiconductor memory. Page | 3
ROM:-It stands for Read-Only-Memory. Information can be read from ROM but
we cannot write information to it. This is the memory whose e information can be not
changed. The information stored in it cannot be lost if we turn off the Computer.
4) Output Unit
The device used to display information to the user is called output device. An output device
can be used to store, display or print the information, e.g. monitor, printer, speaker etc.
Software is a set of instructions that tells a computer what to do. Software is a written
computer program or a series of instructions. Software is a program that allows the
hardware to perform helpful work.
A. SYSTEM SOFTWARE
System Software is a group of programs that controls all computer operations. For
example. Operating System, utilities, device drivers.
B. Application Software.
Application Software is a type of software used to perform specific user tasks. St is used to
perform tasks such as word processor, spreadsheet, database, etc. An application is the job or
task a user wants the computer to do. Application software enables you to perform specific
tasks, solve problems, and perform work.
Hybrid Computers combine the properties of both Digital Computers and analogue
Computers for solving problems e.g. Hybrid Computers have the speed of analogue
Computers and the accuracy of Digital Computers.
❖ Super Computers: -
Super Computers are also called "Number Crunchers " because they are specialized
Computers for dealing with numbers, i.e., they can perform over 10 Mega flops (i.e., millions
floating point operations per second ). These Computers are very much expensive.
Two families of commercially available Super Computers are the CRAY-I and Cyber205
Area of Application:
weather prediction,
weapon design,
Preparing models of chemical and biological systems.
Studying the neural network of the brain.
Atomic reactor.
❖ Mainframe Computers:
. Mainframes have the facilities to communicate with large amounts of data and support
several input and output devices. A typical mainframe costs a million rupees and can
serve as many as 150 users.
These computers have a memory of several hundred Mbs and operate at a speed of
measurement in nanoseconds, e.g., IBM/360, IBM/3090, etc.
❖ Mini Computers:
These Computers are larger than PCs, both in size and other facilities such as “speed,
storage capacity, etc. These computers can serve many users at the same time. They are
costly as compared to PCs. Their speeds are rated between 1 and 50 MIPS. E.g.
Vax/11730. IBM/8370, etc.
❖ Micro Computers:
These are also called Personal Computers (PC). These are the most popular digital
Computers used in all fields of life. These are small in memory and have less processing
capability. These are also called chip computers because their entire circuitry is
fabricated on a single chip; today's microcomputer is equivalent to the main frame of
tomorrow, e.g., 1BM -PC, XT. A 1. Compatibles, 286. 386.486, 5 8 6 ,
GENERATION OF COMPUTER
Although the development of computers is a continuous process, it can be categorized into the
following generations based on the technology used for computer systems.
1. First Generation (1942-1955):-
All the computers developed in this generation were based on vacuum-tube technology. For example.
Page | 5
EN1AC (Electronic Numerical Integrator and Computer), Mark-1. Mark-11 etc.
Advantage
Vacuum tube technology made it possible to make electronic digital computers.
This computer could calculate data in milliseconds.
Disadvantage
These were very large.
It consumed a large amount of energy.
Very slow
Expensive.
Use machine language only.
It was heated very soon due to thousands of vacuum tubes.
2. Second Generation (1955-1964):-
The computers of this generation were based on transistor technology (Vacuum tube replaced by
transistor), and they opened the gateway to commercial development for the sale of computers.
The transistors -were tiny in size, fast in operation, and less expensive than vacuum tubes, e.g.,
EDVAC, IBM-14.
Advantages
Smaller in size than first-generation computers.
Less energy used
Produce less heat
Less costly.
The speed of these Computers was high.
Use of assembly language instead of machine language
The Computers of this generation were based on integrated circuits (ICs) technology (transistors
replaced by ICs). In the early 1960s, solid-state electronic technology was introduced. Developing
integrated circuits (ICs) is called solid-state technology or Small Scale Integration (SSI).
Integrated circuits (ICs) are the collection of many electronic devices like transistors on a single
silicon chip. This technology enabled computers to enter into the electronic revolution. IBM -360
etc.
Advantages
Smaller in size as compared to the previous generation
Less energy used
Produce less heat
More good speed, calculate data in Nano seconds.
Less expensive
It could use high-level language.
Disadvantage
Air conditioning was required
5. Fifth Generation(AI)(1980-1990)
The rapid progress in computer technology is continued, and active research is going on in
different fields of computer technology
Hence, the Computers of this generation were based on the principles of AI, and also in this
generation, Software development was given more importance than Hardware, as a result of
which Artificial Intelligence was introduced, e.g., Robotics, Computer Vision etc
6.Sixth Generation(ANN’S)(Since 1990):-
The Computers of this generation are based on the principles of Artificial Neural Network Systems
(ANNS). As a result, now computers can think and decide how to solve different problems, e.g.,
character recognition.
Computer application:
Business
A computer has high speed of calculation, diligence, accuracy, reliability, or versatility, making it an
integrated part of all business organizations.it is used for:
Payroll calculations
Budgeting
Sales analysis
Financial forecasting
Managing employee database
Maintenance of stocks, etc.
Banking
Today, banking is almost dependent on computers.
Banks provide the following facilities −
Online accounting facility
checking current balance,
making deposits and overdrafts,
checking interest charges,
shares,
and trustee records.
ATMs
Insurance
Insurance companies are keeping all records up-to-date with the help of computers.
Procedure to continue with policies
Starting date of the policies
The next due installment of a policy
Maturity date
Interests due Page | 7
Survival benefits
Bonus
Education
The computer helps provide many educational facilities.
The computer provides a tool in the education system known as CBE (Computer Based
Education).
CBE involves control, delivery, and evaluation of learning.
Computer education is rapidly increasing the number of computer students.
There are several methods in which educational institutions can use a computer to educate
students.
It is used to prepare a database about the performance of a student and analysis is carried out on
this basis.
Healthcare
Following are some significant fields of health care in which computers are used.
Diagnostic System.
Lab-diagnostic System −
Patient Monitoring System
Pharma Information System
Surgery.
Engineering Design
Computers are widely used for engineering purposes.
One of the major areas is CAD (Computer Aided Design)
Structural Engineering –
Industrial Engineering
Architectural Engineering
Military
Computers are primarily used in defense. Modern tanks, missiles, weapons, etc. The military also
employs computerized control systems. Some military areas where a computer has been used are −
Missile Control
Military Communication
Military Operation and Planning
Smart Weapons
Communication
. Some main areas in this category are −
E-mail
Chatting
Usenet
FTP
Telnet
Video-conferencing
Government
Computers play an essential role in government services. Some major fields in this category are −
NISAR COLLEGE HAJI BABA ROAD MINGORA 0349-9614746
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
Budgets
Sales tax department
Income tax department
Computation of male/female ratio
Computerization of voters lists
Computerization of PAN card
Weather forecasting Page | 8
The motherboard serves as a single platform to connect all of the parts of a computer. It connects the
CPU, memory, hard drives, optical drives, video cards, sound card, and other ports and expansion cards
directly or via cables. It can be considered as the backbone of a computer.
Description of Motherboard
The motherboard is mounted inside the case and is securely attached via small screws
through pre-drilled holes. The motherboard contains ports to connect all of the internal
components. It provides a single socket for the CPU, whereas one or more slots are normally Page | 9
available for memory. Motherboards provide ports to attach floppy, complex, and optical
drives via ribbon cables. The motherboard carries fans and a particular port designed for
power supply.
A peripheral card slot in front of the motherboard uses video cards, sound cards, and other
expansion cards to connect to the motherboard.
On the left side, motherboards carry several ports to connect the monitor, printer, mouse,
keyboard, speaker, and network cables. Motherboards also provide USB ports, which allow
compatible devices to be connected in a plug-in/plug-out fashion—for example, pen drives,
digital cameras, etc.
c) Floppy Disk
It is a removable plastic Disk. It is not fixed in the computer. It is encoded with a magnetic
object, which is iron oxide. It has less storage capacity than a hard disk. You mustn't have
a floppy Disk drive to use a floppy Disk.
Page | 11
Capacity V
Size Density
e) Magnetic Tape
Magnetic tape is a flexible plastic tape coated with magnetic iron oxide material on one
side. It is used when large amounts of data are to be processed sequentially. An advantage
NISAR COLLEGE HAJI BABA ROAD MINGORA 0349-9614746
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
of magnetic tape is that it is a very cheap and economical storage medium that is very slow
in processing.
f) Magnetic Drum
It is a rotate able cylinder whose surface is coated with a magnetically sensitive iron
oxide compound. The surface is divided into several tracks, each with o n e or more fixed
Page | 12
reading and recording heads. Magnetic Drums are commonly used when very fast access
and transfer speeds are required. One disadvantage is that they cannot be removed from
a unit.
g) FLASH MEMORY
The latest and most modern storage device is a flash memory or USB, used as a secondary
storage device. It is semiconductor memory. It is the same as RAM and ROM in circuitry. It
is used as a secondary storage for moving data.
Ports are slots on the motherboard into which an external device cable is plugged in.
Examples of external devices attached via ports are the mouse, keyboard, monitor,
microphone, speakers, etc.
❖ Serial Port
Used for external modems and older computer mice
Two versions: 9 pins, 25-pin models
Data travels at 115 kilobits per second
Page | 13
❖ Parallel Port
Used for scanners and printers
Also called a printer port
25 pin model
IEEE 1284-compliant Centroids port
❖ PS/2 Port
Used for old computer keyboard and mouse
Also called the mouse port
Most old computers provide two PS/2 ports for the mouse and keyboard.
It connects to the computer's power cable, plugged into a power bar or wall socket.
Firewire Port
Transfers large amounts of data at a breakneck speed.
Connects Flat panel LCD monitor to the computer's high-end video graphic cards.
Very popular among video card manufacturers.
It is an input device used for voice input instead of the keyboard and mouse. Special software
is used to convert voice into text.
❖ VIDEO CAMERAS
Video cameras are an input devices that can capture images of any data.
❖ DIGITAL CAMERA. Page | 16
Digital Camera is used to take and store pictures in digital form. It does not use
traditional camera film. It save money and the photos can be customized using different
application software.
Digital Camera stores images using different techniques like floppy disk. Super Disk.
PC Card. Compact flash card, memory stick. Mini -CD and microdrive. The digital
camera can easily connect to a computer through a USB port.
A printer is an output device that prints characters, symbols, and graphics on paper. The
printed output is called a hard copy. Print resolution is commonly measured in dots per
inch (dpi). There are many types of printers, and their speeds and quality vary. Different
types of printers are as follows. i- Impact ii-Non-impact
➢ IMPACT PRINTER :
Impact printer works like a typewriter. It prints characters or images by striking a print
hammer or wheel against an inked ribbon. Impact printers are the following
Page | 17
DOT-MATRIX PRINTER
Dot Matrix printer produces printed images when tin pins on a print head strikes an inked
ribbon. When the ribbon presses against the paper, it creates dots that form characters
and graphics. The expensive p r i n t e r use 300 DPI and a speed of 3000 to 1000
character per minute.
DAISY-WHEEL PRINTERS
Daisy wheel is similar to type writer. They produce rather excellent letter quality
printout as compared the dot matrix printer. They work just like the typewriter and use a
hammer and a wheel to print something on paper. But they are very much noisy and
hence are not so popular.
➢ NON IMPACT PRINTER
Non-impact printer produces character without striking devices on paper. They are much
quieter than impact printer. The following are the non -impact printer.
LASER PRINTERS
The most expansive and quality bearer printers are the Laser printers, which produce
high-quality printout and are used for desktop publishing and graphics. A laser printer
works on the principles of a Photocopier. Simply a metal drum called TONER is filled
with special ink which, just sprinkle ink onto the paper and thus prints the character.
They are very fast and use multiple fonts for text and graphics.
INK-JET
It prints character and graphics by spraying tins drops of liquid, ink on paper. These Printers
can produce text and graphics in both black and-white and color. Inkjet printer is slower
than laser printers. They can print 1 to 6 pages per minute. Its print quality is higher than
dot matrix printer.
❖ PLOTTERS
A plotter is an output device that is used to produce image quality graphics in a variety of
colors. Plotters works by drawing lines on paper using pens held in a mechanical arm. They
are mostly used for Engineering and Maps drawing purposes.
❖ SPEAKER and HEADSET
A speaker is an output device that produces audio output. These devices produce music,
speech, or other sounds like beeps etc. Speakers and Headsets are two commonly used
audio output devices. It produces softcopy output. We use speakers to hear any type of
sound.
❖ Smart board
An interactive whiteboard, also known as a smart board, is an interactive display in the
whiteboard format that reacts to user input directly or through other devices.
❖ Memory Management
Memory management refers to management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part
are not in use.
In multiprogramming, the OS decides which process will get memory when and how
much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.
❖ Processor Management
In multiprogramming environment, the OS decides which process gets the processor when
and for how much time. This function is called process scheduling. An Operating System
does the following activities for processor management −
Keeps tracks of processor and status of process. The program responsible for this task
is known as traffic controller.
Allocates the processor (CPU) to a process.
NISAR COLLEGE HAJI BABA ROAD MINGORA 0349-9614746
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
Page | 20
Â
Backward Ski
Advantages of Batch OS
1.The use of a resident monitor improves computer efficiency as it eliminates CPU time
between two jobs.
Disadvantages of Batch OS
1. Starvation
2. Not Interactive
2)Multiprogramming Operating System
Multiprogramming is an extension to batch processing where the CPU is always kept busy.
Each process needs two types of system time: CPU time and IO time.
In a multiprogramming environment, when a process does its I/O, The CPU can start the
execution of other processes. Therefore, multiprogramming improves the efficiency of the
system.
Page | 21
Advantages of Multiprogramming OS
Throughout the system, it increased as the CPU always had one program to execute.
In Multiprocessing, Parallel computing is achieved. More than one processor present in the
system can execute more than one process simultaneously, which will increase the
throughput of the system.
Page | 23
An operating system that includes software and associated protocols to communicate with
other computers conveniently and cost-effectively via a network is called a network operating
system.
Advantages of Network Operating System
In this operating system, network traffic is reduced due to the division between clients and
the server.
This type of system is less expensive to set up and maintain.
Disadvantages of Network Operating System
In this type of operating system, the failure of any node in a system affects the whole system.
Security and performance are important issues. So, trained network administrators are
required to administer the network.
6) Real-Time Operating System
In Real-Time Systems, each job carries a specific deadline within which it is supposed to be
completed; otherwise, there will be a huge loss, or even if the result is produced, it will be
completely useless.
Page | 24
The Application of a Real-Time system exists in the case of military applications, if you want
to drop a missile, then the missile is supposed to be dropped with a certain precision.
Advantages of Real-time operating system:
Easy to layout, develop and execute real-time applications under the real-time operating
system.
In a Real-time operating system, the maximum utilization of devices and systems.
Disadvantages of Real-time operating system:
Real-time operating systems are very costly to develop.
Real-time operating systems are very complex and can consume critical CPU cycles.
7) Time-Sharing Operating System
In the Time Sharing operating system, computer resources are allocated time-dependent to
several programs simultaneously. Thus it helps to provide a large number of user's direct
access to the main computer. It is a logical extension of multiprogramming. In time-sharing,
the CPU is switched among multiple programs given by different users on a scheduled basis.
Or Page | 27
Contact us at Whatsapp:
03499614746
03305822150
Software for healthcare applications for seamless connectivity and quick response
Software for educational purposes, such as Learning Management Systems and e-learning
systems
Emails, text messaging, audio and video conferencing involved in the presentation
Management of accounting, finance, and payroll helping the HR department and other
businesses
The most frequent applications used by millions of people daily are listed below.
• A collection of Microsoft software including MS Office, PowerPoint, Word, Excel, and Outlook.
• Graphics and designing software such as Canva, Adobe Photoshop, CorelDraw, and AutoCAD.
• Real-time online communication tools like Skype, Hangouts, Google Meet, Zoom, and Whatsapp for
video and audio calls and messages.
• Multimedia and music streaming software such as Wynk, Gaana, MX Player, VLC Media Player,
Spotify, Pandora, etc. are used for entertainment purposes.
• Project management software like Teams, Asana, Zoho, Slack, Forecast, etc for official purposes.
Word processing:
Word processing describes creating or editing a document using a word processor, such as Microsoft
Word, Google Docs, or OpenOffice Writer. For example, a student could create a book report using a
Word processor application. Then, the student could print it, save it to a disk, display it on the screen, or
send it over e-mail. Also, a person looking for a job could create a résumé using a word processor, then
e-mail or print and mail it to job recruiters.
spreadsheet
A spreadsheet is a computer program that captures, displays, and manipulates data arranged in rows and
columns. Spreadsheets are one of the most popular tools available with personal computers.A
spreadsheet is generally designed to hold numerical data and short text strings. In a spreadsheet
program, spaces that hold items of data are called spreadsheet cells. These can be renamed to better
reflect the data they hold and can be cross-referenced through row numbers and column letters.
Page | 29
Database Software
Database software is a program or utility used to create, edit and maintain database files and records.
This type of software allows users to store data in structured fields, tables, and columns, which can then
be retrieved directly and through programmatic access.
Presentation Software
Presentation software is a category of application software that is specifically designed to allow users to
create a presentation of ideas by stringing together text, images and audio/video. The presentation tells a
story or supports speech or the presentation of information.
Project management software is used for project planning, scheduling, resource allocation and change
management. It allows project managers (PMs), stakeholders and users to control costs and manage
budgeting, quality management and documentation and also may be used as an administration system.
Project management software is also used for collaboration and communication between project
stakeholders.
Accounting Software
Accounting software is a computer program that assists bookkeepers and accountants in recording and
reporting a firm's financial transactions. The functionality of accounting software differs from product
to product. Larger firms may choose to implement a customized solution that integrates a vast amount
of data from many different departments. Small firms often choose an off-the-shelf product.
WHAT IS CAD/CAM
A typing tutor is a tool designed to help the user enhance their typing skills. This can be done by
repeatedly taking lessons, playing games, or giving a typing test.
Typing Master
Typing Master is a web-based platform. It is a complete package with real-time meter analysis that
analyzes the user's progress and then designs the tests according to the user's progress.
The World Wide Web (WWW) is a collection of documents and other web resources that are
identified by URLs, interlinked by hypertext links, and can be accessed and searched by browsers via
the Internet. World Wide Web is also called the Web and it was invented by Tim Berners-Lee in 1989.
Client (Browser):
Web browser is a program used to communicate with web server on the Internet.
Each browser has three parts: a controller, client protocol, and interpreter.
The controller receives input from input device and use the programs to access the documents.
After accessing the document, the controller uses one of the interpreters to display the document on the
screen.
Server:
A computer that is available for the network resources and provides service to the other computer on
request is known as a server. The web pages are stored at the server. The server accepts a TCP
connection from a client browser. It gets the name of the file required.
The protocol is the client or server program which is used to retrieve the document or file. The
protocol can be ftp or http.
The URL can optionally contain the port number separated from the hostname by a colon.
The path is the pathname of the file where the file is stored.
❖ DHCP
❖ HTTP
• The Hypertext Transfer Protocol (HTTP) is used to access the data on WWW (World Wide Web).
• The functions of HTTP are the combination of FTP (File Transfer Protocol) and SMTP (Simple Mail
Transfer Protocol).
• HTTP is similar to FTP, because it uses only one TCP connection (data is transferred between Client
and Server).
• HTTP uses the services of TCP on well-known port 80.
❖ Telnet
• It is an application layer protocol that can be used on the internet or in a local area network (LAN).
• It provides a bi-directional interactive text-oriented communication service by using the virtual
terminal connection.
• Telnet is basically a client-server protocol, which is based on a reliable connection- oriented transport.
• It uses port 23 to establish the connection with TCP (Transmission Control Protocol).
What is ecommerce?
"Ecommerce" or "electronic commerce" is trading goods and services on the internet. It is your bustling
city center or brick-and-mortar shop translated into zeroes and ones on the internet superhighway. An
estimated 2.14 billion people worldwide buy goods and services online, and the number of Prime
members shopping Amazon stores globally now tops 200 million.
Businesses might create a branded store experience on a store like Amazon, build their own commerce
Page | 32
site on a dedicated domain, or do it all for a multi-channel approach.
What is an e-commerce business?
An e-commerce business is a company that generates revenue from selling products or services online.
For example, an e-commerce company might sell software, apparel, housewares, or web design
services. You can run an e-commerce business from a single website or through multiple online
channels like social media and email.
How does e-commerce work?
Ecommerce works by connecting buyers and sellers using various electronic channels. For example,
you need a channel, such as a website or social media, so customers can find products and services to
purchase. Then, a payment processor enables the exchange of the goods or services. Once the
transaction succeeds, the customer receives a confirmation email, SMS, and a printable receipt.
If the transaction is for goods, then the seller ships the items and sends the customer a tracking number
via email or SMS. If the transaction is for a service, the service provider can schedule and complete the
service.
Steps to starting an E-commerce Business
The steps to starting an e-commerce business can vary depending on factors like what you want to sell.
For example, if you're selling services, then there’s no need to manage inventory or fulfillment.
However, if you want to sell products online, then inventory and fulfilment will likely play a critical
part in your operations.
2. Make sure there’s demand for the products you want to sell
5. Choose which online channels you'll sell through (e.g., an Amazon store)
• B2C – Businesses sell to individual consumers (end-users). The most common model with many
variations.
• B2B – Businesses sell to other businesses. Often the buyer resells products to the consumer.
• C2B – Consumers sell to businesses. C2B businesses allow customers to sell to other companies.
• C2C – Consumers sell to other consumers. Businesses create online marketplaces that connect
consumers.
COMPUTER VIRUSES:
What is Virus?
Biologically, a Virus is defined as a tiny scrap of genetic code that attacks a living cell
and produces replications of it.
❖ MISCUSES OF COMPUTER
Hacking
Immorality
Security Problems
Wastage of Time
Cyber Crime
Others are
The excessive use of computers damages eye sight.
Playing movies.
Mostly the, students and teenage uses it for playing different games
THE END
OF
PREPARED BY
ENGR.NISAR AHMAD
A computer network is a system in which multiple computers are connected to share information and
resources.
A host is any hardware device that can permit access to a network via a user interface, specialized
software, network address, protocol stack, or any other means.
Sender: A sender is a computer or device capable of sending data over a network. It can be a computer,
mobile phone, smart watch, walkie- talkie, video recording device,
Receiver: A receiver is a computer or any such device capable of receiving data from the network.
Media :
There are two main types of transmission media in computer networks. These are guided and unguided
media. While guided media requires a physical medium, unguided media requires air for
communication.
Message:
Any data transmitted over a network that is intended for human interpretation.
Protocol:
In networking, a protocol is a set of rules for formatting and processing data. Network protocols are like
a common language for computers. The computers within a network may use vastly different software
and hardware; however, protocols enable them to communicate with each other regardless.
Receiver: A device that accepts a signal from the transmission system and converts it into a usable
form for the destination device.
Destination: Accepts the incoming data from the receiver. The destination device can be a telephone, a
computer, a network switch, etc.
Networks are often classified by their physical or organizational extent or their purpose.
NISAR COLLEGE HAJI BABA ROAD MINGORA 0349-9614746
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
Usage, trust level, and access rights differ between these types of networks.
A personal area network (PAN) is a computer network used for communication among
computers and different information technological devices close to one person. Some
examples of devices used in a PAN are personal computers, printers, fax machines,
telephones, PDAs, scanners, and even video game consoles. A PAN may include wired and
wireless devices.
A sample EPN was made of frame relay WAN connections and dialup remote access.
3) Internetwork
MODULE 2 TOPOLOGY
The physical layout of a network is called network topology. The physical topology of a
network refers to the configuration of cables, computers, and other peripherals. Physical
topology should not be confused with logical topology, the method used to pass
information between workstations. Logical topology was discussed in the Protocol chapter
The following sections discuss the physical topologies used in networks and other
related topics.
• Linear Bus
• Star
• Tree (Expanded Star)
• Ring topology
• Mesh Topology
• Hybrid Topology
1) Linear Bus
A linear bus topology consists of a main run of cable with a terminator at each end. All
nodes (file server, workstations, and peripherals) are connected to the linear cable.
• The entire network shuts down if there is a break in the main cable.
Terminators are required at both ends of the backbone cable.
• It is difficult to identify the problem if the entire network shuts down.
• It is not meant to be used as a stand-alone solution in a large building.
2) Star Topology
A star topology is designed with each node (file server, workstations, and
peripherals) connected directly to a central network hub, switch, or concentrator
(See fig. 2).
Data on a star network passes through the hub, switch, or concentrator before continuing
to its destination. The hub, switch, or concentrator manages and controls all functions of
the network. It also acts as a repeater for the data flow. This configuration is common with
twisted pair cable; however, it can also be used with coaxial cable or fiber optic cable.
A tree topology combines characteristics of linear bus and star topologies. It consists of
groups of star-configured workstations connected to a linear bus backbone cable (See fig.
3). Tree topologies allow for expanding an existing network and enable schools to
configure a network to meet their needs.
• The overall length of each segment is limited by the type of cabling used.
• If the backbone line breaks, the entire segment goes down.
• More difficult to configure and wire
4) Ring topology?
A ring topology consists of a set of stations connected serially by cable. In other words,
it‘s a circle or ring of computers. There are no terminated ends to the cable; the signal
travels around the circle in a clockwise direction.
5) MESH TOPOLOGY:
In mesh topology, every node is connected to every other node.
1. Node
2. Routers
3. Switches
4. Hubs
5. Modems
6. LAN Cards
7. Multiplexer
8. Bridge
9. NIC Card
10. Repeater
11. B-router
12. Gateways
1. Node
2. Routers
A router is a communication
device that is used to connect two
logically and physically different
networks, two LANs, two WANs
and a LAN with WAN. The main
function of the router is to sorting
and the distribution of the data
packets to their destinations based
on their IP addresses. Routers
provides the connectivity between
the enterprise businesses, ISPs and
in the internet infrastructure, router
is a main device. Cisco routers are
widely used in the world.
3. Switches
4. Hubs
5. Modems
A modem is a
communication device that
is used to provide
connectivity with the
internet. Modem works in
two ways i.e. modulation
and demodulation. It
coverts the digital data into
the analog and analog to
digital.
6. LAN Cards
LAN cards or network adapters are the building blocks of a computer network. No
computer can communicate without a properly installed and configured LAN card. Every
LAN card is provided with a unique IP address, subnet mask, gateway and DNS (if
applicable). An UTP/STP cable connects a computer with the hub or switch. Both ends of
the cable have the RJ-45 connectors one is inserted into the LAN card and one in the
hub/switch. LAN cards are inserted into the expansion slots inside the computer. Different
LAN cards support different speed from 10/100 to 10/1000.
6) Multiplexer
A multiplexer is a device that is used to combine several electrical signals into one signal.
7) Bridge
A bridge is a network
communication device used to
connect one segment of the
network with another that uses
the same protocol. It operates at
the Data link layer of the OSI
layers model. In the Ethernet
network, the bridge is also
known as IEEE 802.1D. A
bridge processes the information at the data link layer of the OSI layers model. There are
8) NIC Card
NIC Stands for Network Interface card. It is one of the most important computer network
devices that are used for the
data communication and to
connect computers. It is
plugged inside the computer
either in the PCI slot or built
into the motherboard.
9) Repeater
Repeater is a communication device that retransmits the weak signals with greater power.
It receives the signals over the wireless, optical transmission, and network cable mediums
such as copper wire, UTP/STP and fiber optic cables and regenerates the analog or digital
signals. It can relay the data signals between the different subnetworks.
1.2)COAXIAL CABLE
Coaxial cable consists of insulated copper or aluminum wire covered by insulating
material. The insulated copper wire is covered by copper mesh. It is widely used for
cable television and local area networks. Advantage: - The extra insulation makes
coaxial cable much better at resisting noise than twisted pair wiring. These can
transmit data much faster than twisted pairs.
TCP/IP MODEL
The four layers in the TCP/IP protocol suite are −
[Type text] [Type text]
NISAR COLLEGE OF MANAGEMENT&TECHNOLOGY SWAT
• The host-to-network layer is the lowest layer concerned with data's physical transmission.
TCP/IP does not explicitly define any protocol here but supports all the standard protocols.
• Internet Layer −It defines the protocols for logical data transmission over the network. The
primary protocol in this layer is Internet Protocol (IP), which is supported by the protocols
ICMP, IGMP, RARP, and ARP.
• Transport Layer − This layer is responsible for error-free end-to-end data delivery. The
protocols defined here are Transmission Control Protocol (TCP) and User Datagram Protocol
(UDP).
• Application Layer − This is the topmost layer and defines the interface of host programs with
the transport layer services. This layer includes all high-level protocols like Telnet, DNS, HTTP,
FTP, SMTP, etc.
OSI, or the Open System Interconnection model, was developed by the International Standards
Organization (ISO). It gives a layered networking framework that conceptualizes how communications
should be done between heterogeneous systems. It has seven interconnected layers. The seven layers of
the OSI Model are a physical layer, data link layer, network layer, transport layer, session layer,
presentation layer, and application layer, as shown in the following diagram −
The network support layers are physical, data link, and network layers. The layers manage the physical
transfer of data from one device to another. The Session, presentation, and application layers are the
user support layers. These layers allow communication among unrelated software in dissimilar
environments. The transport layer links the two groups.
• Physical Layer − its function is to transmit individual bits from one node to another over a
physical medium.
• Data Link Layer − It is responsible for the reliable transfer of data frames from one node to
another connected by the physical layer.
• Network Layer − It manages the delivery of individual data packets from source to destination
through appropriate addressing and routing.
• Transport Layer −It is responsible for the delivery of the entire message from the source host
to destination host.
• Session Layer − It establishes sessions between users and offers services like dialog control and
synchronization.
• Presentation Layer − It monitors syntax and semantics of transmitted information through
translation, compression, and encryption.
• Application Layer − It provides high-level APIs (application program interface) to the users
The Internet Protocol hierarchy contains several classes of IP addresses that can be used efficiently in
various situations as per the requirement of hosts per network. Broadly, the IPv4 Addressing system is
divided into five classes of IP Addresses. The first octet of IP Address identifies all five classes.
Internet Corporation for Assigned Names and Numbers is responsible for assigning IP addresses.
The first octet referred here is the left most of all. The octets numbered as follows depicting dotted
decimal notation of IP Address −
This formula can derive the number of networks and the number of hosts per class −
When calculating hosts' IP addresses, 2 IP addresses are decreased because they cannot be assigned to
hosts, i.e. the first IP of a network is network number, and the last IP is reserved for Broadcast IP.
Class A Address
The first bit of the first octet is always set to 0 (zero). Thus, the first octet ranges from 1 – 127, i.e.
Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The IP range 127.x.x.x is
reserved for loopback IP addresses.
The default subnet mask for Class A IP address is 255.0.0.0, implying that Class A addressing can
have 126 networks (27-2) and 16777214 hosts (224-2).
Class A IP address format is thus: 0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
Class B Address
An IP address that belongs to class B has the first two bits in the first octet set to 10, i.e.
Class B IP Addresses range from 128.0.x.x to 191.255.x.x. The default subnet mask for Class B is
255.255.x.x.
Class B has 16384 (214) Network addresses and 65534 (216-2) Host addresses.
Class B IP address format is: 10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class C Address
The first octet of a Class C IP address has its first 3 bits set to 110, that is −
Class C IP addresses range from 192.0.0.x to 223.255.255.x. The default subnet mask for Class C is
255.255.255.x.
Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.
Class C IP address format is: 110NNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH
Class D Address
The very first four bits of the first octet in Class D IP addresses are set to 1110, giving a range of −
Class D has an IP address range from 224.0.0.0 to 239.255.255.255. Class D is reserved for
Multicasting. In multicasting, data is not destined for a particular host, so there is no need to extract the
host address from the IP address, and Class D does not have any subnet mask.
Class E Address
This IP Class is reserved for experimental purposes only for R&D or Study—IP addresses in this class
range from 240.0.0.0 to 255.255.255.254. Like Class D, this class is not equipped with any subnet
mask.
THE END
OF
PREPARED BY
ENGR.NISAR AHMAD
WWW.NCMT.EDU.PK
Prepared by
Engr.Nisar Ahmad
Users can get open software free of Users must have to pay to get the
08. charge. proprietary software.
Microsoft Office 2016 consists of five core programs: Word, Excel, PowerPoint, Access, and
Outlook, where each program specializes in manipulating different data. Word manipulates
text; Excel manipulates numbers; PowerPoint manipulates text and pictures to create a slide
show; Access manipulates organized, repetitive data such as inventories; and Outlook
manipulates personal information such as e-mail addresses and phone numbers.
Although each Office 2016 program stores and manipulates different types of data, they all
work similarly. First, you must enter data into an Office 2016 program by typing on the
keyboard or loading data from an existing file. Second, you must tell Office 2016 how to
manipulate your data, such as underlining, sorting, arranging it on the screen, or deleting it.
Third, you have to save your data as a file.
Microsoft Word is a word-processing application that helps us design and create professional-
looking documents such as newsletters, reports, brochures, and letters.
In short, Word allows users to produce different types of documents depending on the
situation and need. With the help of MS Word, you can create professional-looking
documents for your Academic and Professional Careers.
Click on Start Menu-> Programs-> Microsoft Office-> Microsoft Word. Or click on the
Microsoft Word icon on your desktop.
MS-Word Interface
The picture below shows the first screen you see when you open Word.
1. Title Bar: It is topmost on the screen. It displays the name of the document on which
you are currently working.
2. Menu Bar: Generally found directly below the Title bar. The Menu bar displays the
menu. The Menu bar begins with the word File and continues with Edit, View, Insert,
Format, Tools, Table, Window, and Help.
4. Text Area: You type your document in the text area. The cursor is the blinking
vertical line in the upper left corner of the text area. It marks the insertion point. As
you type, your work shows at the cursor location.
5. Getting Started Pane: You can create a new document or open an existing open to
start using Word. It can be closed because other options can do all the work.
6. Status Bar: The Status bar appears at the very bottom of the screen and provides such
information as the current page, current section, total number of pages, inches from
the top of the page, current line number, and current column number. The Status bar
also provides options that enable you to track changes or turn on the Record mode, the
Extension mode, the Overtype mode, and the Spelling and Grammar check.
Title Bar
It lies next to the Quick Access Toolbar. It displays the title of the currently open document
or application. It is present on almost all windows displayed on your computer. So, if several
windows are across the screen, you can identify each window by looking at the title bar. You
can also move a window in many graphical user interfaces by dragging the title bar.
Quick Access Toolbar lies next to the Microsoft Office Button. It is a customizable toolbar
that comes with a set of independent commands. It gives you quick access to commonly used
commands such as Save, Undo, Redo, etc.
The Ribbon is a user interface element that Microsoft introduced in Microsoft Office 2007. It
is located below the Quick Access Toolbar and the Title Bar. It comprises seven tabs: Home,
Insert, Page Layout, References, Mailing, Review, and View. Each tab has specific groups of
related commands. It gives you quick access to the commands you need to complete a task.
Home tab:
The Home tab is the default tab in Microsoft Word. It has five groups of related commands:
Clipboard, Font, Paragraph, Styles, and Editing. It helps you change document settings like
font size, add bullets, adjust styles, and many other common features. It also helps you to
return to the home section of the document.
Cut
• Deleting unnecessary data from a document is called cutting.
• In Microsoft Word, you can cut text from one area of a document and paste that text
anywhere in the document.
• After you cut the text, it gets stored in the clipboard.
• If you want to cut any text or word from a document, it is advisable to highlight the
word first.
• To cut, Right Click → Cut.
• The shortcut key is "Ctrl + X".
Copy
• The copy option can be used when we need to retype the exact text, as it reduces time
and effort.
• You can copy the text from one location to another using the copy option.
• Information stored on the clipboard stays there until new information is cut or copied.
• Each time you cut or copy, you replace the old information on the clipboard with the
information you just copied.
• To copy, Right Click → Copy.
• The shortcut key is "Ctrl + C."
Paste
• Select your text and then copy it.
• The mouse moves the cursor to the desired position to paste the copied text.
• Click paste to insert the copied text in its new place.
• You can paste clipboard information as often as you like.
• To paste, Right Click → Paste.
• The shortcut key is "Ctrl + V."
Alignment of Text
• You can align text to Left, Right, Center, and Justify.
• By default, the content always appears on the left side of the document.
• Alignment can be done by using mouse or keyboard shortcuts.
• For center alignment, click on the "center align" icon or use the shortcut key "Ctrl +
E".
• For right alignment, click on the "right align" icon or use the shortcut key "Ctrl + R".
• For left alignment, click to the "left align" icon or use the shortcut key "Ctrl + L"
• If you click on "justify," it will align concerning both left and right margins. The
shortcut key used here is "Ctrl + J".
Formatting Text
• A font refers to a set of characteristics that support the characters of Word.
• The process of formatting a document includes controlling the appearance of text and
the layout of text on the page.
Paragraph Indenting
• Indentation improves the readability of document.
• Options for indentation includes Left, Right, Center And Justify.
• When a document is in the form of long paragraphs, the reader may not be able to
notice essential points or messages quickly. Bullets and numbering emphasize lists of
things.
• Bullets are used to list points or topics in a document.
• A numbered list works well for directions or other points.
• While typing a document, details should be given step-by-step for easy understanding.
MS Word’s feature "Bullets and Numbering" fulfills this purpose.
• You can use the word defaults for bullets and numbers or define your list.
Changing Case
We usually type the content of documents in different forms, such as Lower case, Upper case,
Sentence case, etc.
• Sentence Case → First character of the sentence is capitalized.
• Lower Case → The entire selected text will be changed to small letters.
• Upper Case → The entire selected text will be changed to capital letters.
• Title Case → First character of each word begins with a capital letter.
• Toggle Case → It changes lowercase to uppercase and vice-versa.
Step 2 − Selecting the New option from the first column will display a list of templates in the
second column. Double-click on the Blank document; this is the first option in the template
list. We will discuss the other templates in the list in the following chapters.
You should have your blank document, as shown below. The document is now ready for you
to start typing your text.
You can use a shortcut to open a blank document anytime. Try using the Ctrl + N keys; you
will see a new blank document similar to the one in the screenshot above.
Opening Existing Document
There may be a situation when you open an existing document and edit it wholly or partially.
Follow the steps given below to open an existing document −
Step 1 − Click the File tab and select the Open option.
Step 2 − This will display the following file Open dialog box. This lets you navigate through
different folders and files, and also lets you select a file which you want to open.
Step 3 − Finally, locate and select a file you want to open and click the small triangle on
the Open button to open the file. You will have different options to open the file but simply
use the Open option.
This will open your selected file. You can use the Open Read-Only option if you are willing
just to read the file and you have no intention to modify, i.e., edit the file. Other options can
be used for advanced usage.
Create a Table
The following steps will help you understand how to create a table in a Word document.
Step 1 − Click the Insert tab, followed by the Table button. This will display a simple grid,
as shown below. Moving your mouse over the grid cells makes a table in the table that
appears in the document. You can make your table have the desired number of rows and
columns.
Step 2 − Click the square representing the lower-right corner of your table, which will create
an actual table in your document, and Word will go into table design mode. The table design
mode has many options, as shown below.
Step 3 − This is an optional step that can be worked out if you want a fancy table. Click
the Table Styles button to display a gallery of table styles. Moving your mouse over any of
the styles shows an accurate time preview of your actual table.
Step 4 − To select any of the styles, just click the built-in table style and you will see that the
selected style has been applied on your table.
Delete a Table
The simple step is to delete an existing table from a Word document.
Step 1 − Click anywhere in the table you want to delete.
Step 2 − Click the Layout tab and the Delete Table option under the Delete Table
Button to delete the complete table from the document along with its content.
MS Excel
What is MS Excel?
1. Excel builds data in columns and rows, unlike a word processor such as Microsoft
Word. An Excel spreadsheet can be interpreted as a collection of columns and rows
that create a table. Rows and columns meet in a space termed a cell.
2. Alphabetical letters are generally allocated to columns, and numbers are ordinarily
allocated to rows. Each cell can contain a single piece of data, such as a numerical
value, text, or formula.
3. The address of a cell is furnished by the letter depicting the column and the number
symbolizing a row. Microsoft Excel is beneficial when we want to record, examine,
and save numeric data.
4. Microsoft Excel is a spreadsheet program that records and analyzes numerical and
statistical data. Microsoft Excel provides several features to perform various
operations like mathematical calculations, graph tools, pivot tables, macro
programming, etc. It fits with multiple OS like Windows, macOS, Android, and iOS.
Alternatively, if it has been added there, one can begin it from the start menu(by typing MS
Excel in the available search option). You can open it from the desktop shortcut if you have
created one.
Features of MS Excel
MS Excel processes data in tabular form and then performs mathematical functions to
analyze it. This is what the Excel window looks like (version 2007):
Excel is a tool for coordinating and performing calculations on data. It can examine data,
compute statistics, create pivot tables, and express data as charts or graphs. MS Excel
performs the following essential functions:
In MS Excel, there are rows and columns. The intersection of rows and columns makes a cell.
So, each of the cells is an individual unit of data. Each cell has a cell address, the number of
rows, and the column alphabet in which it appears. No two cells have the same address ever.
The Home & Insert menu of MS Excel is similar to MS Word. Users can change the
formatting of the content from home & include pie charts, tables, and other files related to
data from the insert menu.
Font size, font color, font styles, alignment, background color, formatting options and styles,
insertion, deletion, and editing in the cells options are also available.
One can insert images, figures, headers, footers, charts, and sparklines and even attach
graphs, equations, and symbols.
The unique functions that MS Excel has are Formulas & Data. Users can use the formula to
analyze data quickly. Users must select the cells; one cell becomes one data unit.
So if the user selects 10 cells and applies an average formula to them, the user will get an
average of the data output of those 10 cells.
The user must select a formula without space to apply a formula to any data. Then, in the
function bar, the user needs to type ‘=’ and the abbreviation of the formula the user wishes to
apply.
Data
The user can perform functions from the Data menu without changing the original data. Users
can filter, add external data from the web & sort data without changing it. For example, the
user can sort the data in alphabetical order.
From essential functions like addition & subtraction, the user can perform complex statistical
functions like correlation & t-tests. Moreover, users can convert them into Pie charts or
graphs within moments. This makes data analysis easy.
Page Layout
Users can apply themes and orientation and check the page setup through the layout option.
Review
Proofreading, like spell check, can be performed for an Excel sheet in the review section, and
a user can even add comments or remarks in this part.
View
Different views and layouts in which the user wants the spreadsheet to be displayed can be
selected here. Options to zoom in and out, full screen, and pane arrangement are available
under this section. Buy Testbook Pass
MS Excel Terminologies
1. Cell- A cell is a rectangle block/box present in a worksheet. Any data the user wants
to enter into the worksheet must be arranged in a cell.
2. Cells can be color-coded to show text, numbers, and the outcomes of calculations
based on the operations. An Active Cell is currently an open cell for editing.
3. Workbook- The workbook relates to an Excel spreadsheet record. It includes all the
data that have been listed/sorted/calculated. A workbook available to be seen and
edited by various users on a network is recognized as a shared workbook.
4. Worksheet- Inside the workbook, we get documents called worksheets. Also
recognized as spreadsheets, users can have multiple worksheets in a single workbook.
5. Workspace- Similar to worksheets in a workbook, a workspace enables users to open
numerous files simultaneously.
6. Formula Bar- The Formula Bar displays the data of an active cell. In the case of
formulas, the formula bar will showcase all formula components.
7. Toolbar- The toolbar holds quick shortcuts like save, undo, and redo.
8. Chart- An object that displays data visually / graphically.
9. Data Validation- This feature of MS Excel helps to limit incorrect data from being
inserted into the worksheet. Data validation ensures consistency and precision in the
data to be entered.
10. Ribbon- Over the workbook is a section of command tabs named the Ribbon. Several
options are present behind every tab of the ribbon.
MS Excel Extensions
Step 2: Type PowerPoint & click on the MS Office version you have in your
system. MS Office window will pop up.
In Windows 7 or below:
Step 1: Go to the program section in the Windows start menu.
Step 2: Go to MS Office & click on it. A drop-down list is seen.
Step 3: Click on MS PowerPoint & MS PowerPoint window will pop up.
Creating a Presentation
Once your MS PowerPoint Window pops up, you can create & save the file
by:
Step 1: Click on the Microsoft button on the top left.
Step 4: Select the drive (by clicking on it: Example: Local Drive (D)) where you
want to save the presentation. Then your drive will open up, select the folder in
which you want to save the presentation (Example: img folder here) & then give the
required name to your presentation (Example: MyPresentation here). Your
presentation is created & saved with the provided name.
Note: Shortcut for save: Ctrl + s
Essential Elements of a PowerPoint Window/Slide
You can see various bars in the presentation window. They are:
(i) Title Bar: This shows the name/title you gave for the current presentation. If the
user does not save the presentation by any name, the default name MS PowerPoint
gives appears in this bar.
(ii) Menu Bar: Contains menu items like insert, views, design, animations, etc.
(iii) Office Button: MS Office button on the left-most top.
(iv) Formatting Toolbar: Have tools like Bold, Italic, Underline, Font shape & size
etc. to format your data.
Step 3. The slide show will start (Press Esc key (escape) to come out of slide show)
Note: Shortcut for the slide show is: F5
Step 1: Click on the Microsoft icon
Step 2: Click On Print & a window for Print & Preview the document will pop up.
Step 3: Click on Print. Then a window for Print will pop up.
Step 4: Select the printer by which you want to take out a print of the document.
Select the page range (Print of all or some or current page) & number of copies you
want.
Step 5: Click on OK.
You will get a print of your Presentation.
Note: The shortcut for print is Ctrl + p
Microsoft Access also has the distinction of being the first mass-market database program for
Windows.
Microsoft Access enables business and enterprise users to manage data and analyze vast
amounts of information efficiently. The program provides a blend of database functionality
and programming capabilities for creating easy-to-navigate forms.
Microsoft Access is like Microsoft Excel in that you can store, edit, and view data. However,
Access has much more to offer, as we are about to see.
MS Access Features
User-Friendly Interface
MS Access provides a user-friendly interface that allows you to create and manage databases
using a drag-and-drop interface. This makes it easy to create tables, forms, queries, and
reports without requiring extensive technical knowledge.
Customizable Templates
MS Access includes a range of customizable templates that you can use as a starting point for
your database. This includes templates for inventory management, customer management,
project tracking, and more.
MS Access includes an influential query designer that allows you to extract specific data
from tables based on user-defined criteria. This includes sorting, filtering, and aggregating
data from multiple tables.
MS Access includes integrated reporting tools that allow you to create professional-looking
reports based on data from one or more tables. This includes the ability to create charts,
graphs, and summaries.
Customizable Forms
MS Access allows you to create custom forms with a user-friendly interface for entering and
viewing data in your tables. This includes adding controls like text boxes, drop-down lists,
and buttons.
MS Access includes macros that allow you to automate everyday tasks in your database, such
as opening forms and running queries. This can save time and increase efficiency.
Customizable Code
MS Access allows you to write custom code using the Visual Basic for Applications (VBA)
programming language. This allows you to create custom functions and automate complex
tasks.
Collaboration Features
MS Access allows you to share your database with other users and control their access to the
data. This includes the ability to assign specific permissions to individual users or groups.
MS Access integrates with other applications in the Microsoft Office suite, such as Excel and
Word. This allows you to import and export data and generate reports and charts using data
from multiple sources.
Overall, MS Access provides a range of features that make it easy to create and manage
databases, with a user-friendly interface, powerful query and reporting tools, and the ability
to automate tasks and collaborate with others.
• Tables: Access stores its data in tables using a row and column format. Users can create one
database that includes all the data of one project. This database is known as a “flat” database.
More on databases later.
• Relational Databases: Although users can place a project's data in just one database, creating
numerous tables dedicated to a different aspect of the project is typically easier. Fortunately,
each table can be connected and interrelated, an arrangement known as a relational database.
• Forms: Forms enable users to enter data into the database without relying on a spreadsheet.
• Macros: Macros are small programming constructs consisting of commands and processes and
are a huge time saver.
• Modules. Modules are procedures, also called functions, which users can write with Visual Basic
Applications.
• Queries: Queries find information in databases, which is a helpful tool, considering the size of
many access databases.
• Reports: Reports simplify the processes of sorting, labeling, summarizing, and grouping data to
easily share or print.
Tables
Tables are the basic building blocks of any database. They store data in rows and columns
and are used to organize related information into groups. Tables in Microsoft Access can
have various data types, such as text, number, date/time, etc.
Forms
Forms are used to provide a user-friendly interface for entering data into tables. They can be
created using a drag-and-drop interface and customized using various tools and controls.
Queries
Queries are used to extract specific data from tables based on user-defined criteria. They can
be used to sort, filter, and aggregate data from multiple tables and can be created using a
graphical query designer.
Reports
Reports are used to present data in a visually appealing format. They can be used to create
summaries, charts, and graphs based on data from one or more tables.
Macros
Macros are used to automate everyday tasks in Microsoft Access. They can be used to
perform tasks such as opening forms and running queries and can be triggered by user actions
or by events in the database.
Modules
Modules are used to write custom code in Microsoft Access using the Visual Basic for
Applications (VBA) programming language. They can be used to create custom functions,
automate complex tasks, and interact with other applications.
Security
Microsoft Access includes built-in security features that allow you to control access to the
database and its objects. Access supports user-level security, which allows you to assign
specific permissions to individual users or groups.
For larger databases with multiple users, Microsoft Access can be used as a front-end
application that connects to a back-end database server such as Microsoft SQL Server or
Oracle. This allows multiple users to access the database simultaneously and provides better
scalability and performance.
Data Storage
MS Access is used to store large amounts of data in an organized and efficient manner. It
allows you to create tables, forms, queries and reports to manage your data.
Inventory Management
MS Access is commonly used for inventory management, where it can be used to track items,
their location, and other important details. It can also be used to create purchase orders and
track sales.
MS Access can be used for customer relationship management (CRM), where it can be used
to store customer information, track interactions, and generate reports.
Project Management
MS Access can be used for project management, tracking tasks, milestones, and resources. It
can also be used to generate reports on project progress.
Personnel Management
MS Access can be used for personnel management, where it can be used to store employee
information, track performance, and generate reports.
Event Planning
MS Access can be used for event planning, managing guest lists, tracking RSVPs, and
generating reports on event attendance.
MS Access is a popular choice for small business management, where it can be used to
manage finances, track inventory, and generate reports.
• First, flat file databases store data in plain text and can't incorporate multiple tables.
• Secondly, relational databases store data in forms that relate to each other. For example,
relational databases support multiple tables, which arrange the text into columns and rows.
Additionally, the Microsoft Access database uses the following data types:
• Auto Number: Either assigned by Access or the user when a new record is created
• Calculated: Creates an expression that uses data from one or multiple fields
• Currency: Stores currency values and numeric data featuring one to four decimal places
• Date/Time: Stores date and time information for a year range between 100 and 9999
• Long Text: Typically used for lengthy alphanumeric or text data, up to 63,999 characters
• OLE Objects: This data encompasses audio, video, and other Binary Large Objects
• The online Microsoft Access works nicely with many development languages that work on the
Windows operating system
• It’s a robust and flexible utility that can perform any demanding office or industrial database task
• MS-Access lets users link to data in its current location and use the information for viewing,
querying, updating, and reporting.
• It lets users create tables, forms, queries, and reports and connect with the aid of Macros.
• Macros in Access are simple programming constructs that help users add functionality to their
database.
• Microsoft Access Online can perform heterogeneous joins between many data sets that are
stored across various platforms
Of course, no application is perfect. Every product has its downside, and Microsoft Access is
no exception. Its drawbacks include:
• If too many users attempt to gain access to the same database at once, this may negatively
impact the speed and efficiency. There is an apparent limit to how many people can
simultaneously work on the same database.
• Related to the first point, the Microsoft Access database is more beneficial for small-to-medium
businesses but not as much for large-sized organizations.
• There are better database systems available when working with confidential data.
• Microsoft Access lacks the robustness that is found in other DBMS systems such as MS SQL
Server or Oracle.
• Since all the information from a database is saved into one file, this can slow down reports,
queries, and forms.
• Although the technical limit is 255 concurrent users, the real-world limit ranges from only 10 to
80, depending on the application the organization is currently running.
• Microsoft Access requires considerably more learning and training than other Microsoft
programs.
Versions of MS Access
Microsoft Access has been around for over 25 years, and many versions have been released.
Here are the major versions of Microsoft Access:
• Access 1.0 - Released in 1992 for Windows 3.0, Access 1.0 was the first version of Access.
• Access 2.0 - Released in 1993, Access 2.0 added several new features, including support for
importing data from Excel and Lotus 1-2-3.
• Access 95 - Released in 1995, Access 95 introduced support for VBA (Visual Basic for Applications)
and OLE Object Linking and Embedding.
• Access 97 - Released in 1997, Access 97 added support for replication and the ability to create
web-based applications using Active Server Pages (ASP).
• Access 2000 - Released in 1999, Access 2000 introduced support for the new Access project
(.adp) file format and support for XML.
• Access 2002/XP - Released in 2001, Access 2002/XP introduced a new user interface and
improved support for importing and exporting data.
• Access 2003 - Released in 2003, Access 2003 added support for new data types and the ability to
create and modify XML documents.
• Access 2007 - Released in 2007, Access 2007 introduced the ribbon interface and added support
for publishing to SharePoint.
• Access 2010 - Released in 2010, Access 2010 added support for web databases and introduced
the Navigation pane.
• Access 2013 - Released in 2013, Access 2013 introduced a new design interface and added
support for web apps
• Access 2016 - Released in 2015, Access 2016 added support for Large Number data type and
TempVar objects.
• Access 2019 - Released in 2018, Access 2019 added support for new data types, such as BigInt
and Attachments, and improved user experience.
Overall, each version of Access has added new features and functionality, making it easier to
manage and manipulate data. The most recent versions have added support for web-based
applications, mobile devices, and cloud-based services, allowing users to access their data
anywhere.
www.ncmt.edu.pk
THE END
OF
PREPARED BY
ENGR.NISAR AHMAD
1 Operating systems
An operating system (OS) is a set of programs that manage computer hardware resources
and provide standard services for application software. The operating system is the most
critical software in a computer system. A user cannot run an application program on the
computer without an operating system unless the application program is self-booting.
Examples of popular modern operating systems include Android, iOS, Linux, and Mac OS X,
all of which have their roots in UNIX and Microsoft Windows.
Â
Backward Ski
Advantages of Batch OS
Using a resident monitor improves computer efficiency by eliminating CPU time between
two jobs.
Disadvantages of Batch OS
1. Starvation
2. Not Interactive
2) Multiprogramming Operating System
Multiprogramming is an extension of batch processing where the CPU is always busy. Each
process needs two types of system time: CPU time and IO time.
In a multiprogramming environment, when a process does its I/O, The CPU can start
executing other processes. Therefore, multiprogramming improves the efficiency of the
system.
Advantages of Multiprogramming OS
Throughout the system, it increased as the CPU always had one program to execute.
Response time can also be reduced.
Disadvantages of Multiprogramming OS
Multiprogramming systems provide an environment in which various systems resources are
used efficiently, but they do not provide any user interaction with the computer system.
• Multiprocessing Operating System
In Multiprocessing, Parallel computing is achieved. There is more than one processor in the
system which can execute more than one process simultaneously. This will increase the
system's throughput.
In Multiprocessing, Parallel computing is achieved. More than one processor in the system
can execute more than one process simultaneously, increasing the system's throughput.
Advantages of Multiprocessing operating system:
Increased reliability: Due to the multiprocessing system, processing tasks can be distributed
among several processors. This increases reliability as if one processor fails; the task can be
given to another processor for completion.
Increased throughout: As several processors increase, more work can be done in less.
The multiple processors are busier simultaneously to complete any task in a multitasking
environment, so the CPU generates more heat.
4) Network Operating System
An operating system that includes software and associated protocols to communicate with
other computers conveniently and cost-effectively via a network is called a network operating
system.
Advantages of Network Operating System
This operating system reduces network traffic due to the division between clients and the
server.
This type of system is less expensive to set up and maintain.
Disadvantages of Network Operating System
In this type of operating system, the failure of any node in a system affects the whole system.
Security and performance are important issues. So, trained network administrators are
required to administer the network.
5) Real-Time Operating System
In Real-Time Systems, each job carries a specific deadline within which it is supposed to be
completed; otherwise, there will be a huge loss, or even if the result is produced, it will be
completely useless.
The Application of a Real-Time system exists in the case of military applications; if you want
to drop a missile, then the missile is supposed to be dropped with a certain precision.
The time-sharing operating system provides effective utilization and sharing of resources.
This system reduces CPU idle and response time.
Disadvantages of Time-Sharing Operating System
Data transmission rates are very high in comparison to other methods.
Security and integrity of user programs loaded in memory and data must be maintained as
many users access the system simultaneously.
A mobile operating system is an operating system that helps to run other application software
on mobile devices. It is the same kind of software as the famous computer operating systems
like Linux and Windows, but now they are light and simple to some extent.
The operating systems found on smartphones include Symbian OS, iPhone OS, RIM's
BlackBerry, Windows Mobile, Palm WebOS, Android, and Maemo. Android, WebOS, and
Maemo are all derived from Linux. The iPhone OS originated from BSD and NeXTSTEP,
related to Unix.
It combines the beauty of computers and hand-use devices. It typically contains a built-in
cellular modem and SIM tray for telephony and internet connections. If you buy a mobile, the
manufacturer company chooses the OS for that specific device.
1. Android OS: The Android operating system is the most popular operating system today. It
is a mobile OS based on the Linux Kernel and open-source software. Google developed the
Android operating system. The first Android device was launched in 2008.
2. Bada (Samsung Electronics): Bada is a Samsung mobile operating system that was
launched in 2010. The Samsung Wave was the first mobile to use the Bada operating system.
The Bada operating system offers many mobile features, including 3-D graphics, application
installation, and multipoint touch.
4. iPhone OS / iOS: The iOS was developed by Apple Inc. for use on its devices. The iOS
operating system is the most popular today. It is a very secure operating system. The iOS
operating system is not available for any other mobile device.
5. Symbian OS: Symbian operating system is a mobile operating system that provides high-
level integration with communication. The Symbian operating system is based on Java. It
combines middleware of wireless communications and personal information management
(PIM) functionality. The Symbian operating system was developed by Symbian
Ltd in 1998 for the use of mobile phones. Nokia was the first company to release Symbian
OS on its mobile phone.
6. Windows Mobile OS: Windows Mobile OS is a mobile operating system that Microsoft
developed. It was designed for pocket PCs and intelligent mobiles.
7. Harmony OS: The Harmony OS is the latest mobile operating system that Huawei
developed for its devices. It is designed primarily for IoT devices.
8. Palm OS: Palm OS is a mobile operating system that Palm Ltd developed for use on
personal digital assistants (PADs). It was introduced in 1996. Palm OS is also known as
the Garnet OS.
1) Memory Management
Memory management refers to the management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Keeps track of primary memory, i.e., what parts are in use by whom and what parts
are not.
In multiprogramming, the OS decides which process will get memory when and how
much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been terminated.
2) Processor Management
In a multiprogramming environment, the OS decides which process gets the processor when
and for how long. This function is called process scheduling. An Operating System does the
following activities for processor management −
Keeps track of processor and status of the process. The program responsible for this
task is known as a traffic controller.
Allocates the processor (CPU) to a process.
De-allocates processor when a process is no longer required.
3) Device Management
An Operating System manages device communication via their respective drivers. It does the
following activities for device management −
Keeps tracks of all devices. The program responsible for this task is known as the I/O
controller.
Decides which process gets the device when and for how much time.
Allocates the device in an efficient way.
De-allocates devices.
4)File Management
A file system is usually organized into directories for easy navigation and usage. These
directories may contain files and other directions.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Other Important Activities
Following are some of the essential activities that an Operating System performs −
Security − Passwords and other similar techniques prevent unauthorized access to programs
and data.
Control over system performance − Recording delays between request for a service and
response from the system.
Job accounting − Keeping track of time and resources used by various jobs and users.
Error detecting aids − Production of dumps, traces, error messages, and other debugging
and error detecting aids.
Coordination between other software and users − Coordination and assignment of
compilers, interpreters, assemblers, and other software to the various users of the computer
systems.
Explanation
Step 1 − whenever a new process is created, it is admitted into a ready state.
Step 2 − If no other process is present at the running state, it is dispatched to running based
on the scheduler dispatcher.
Step 3 − If any higher priority process is ready, the uncompleted process will be sent to the
waiting state from the running state.
Step 4 − Whenever the I/O or event is completed, the process will be sent back to the ready
state based on the interrupt signal the running state gives.
Step 5 − whenever the execution of a process is completed in the running state, it will exit to
the terminate state, which is the completion of the process.
What is Thread?
A thread is a flow of execution through the process code. It has a program counter that tracks
which instructions need to be executed. Next, the system registers its current working
variables and a stack containing the execution history.
A thread shares little information like code segment, data segment, and open files with its
peer threads. When one thread alters a code segment memory item, all other threads see that.
A thread is also called a lightweight process. Threads provide a way to improve application
performance through parallelism. Threads represent a software approach to improving the
operating system's performance by reducing the overhead thread, equivalent to a classical
process.
Each thread belongs to exactly one process, and no thread can exist outside of a process. Each
thread represents a separate flow of control. Threads have been successfully used to
implement network servers and web servers. They also provide a suitable foundation for
parallel execution of applications on shared memory multiprocessors. The following figure
shows the working of a single-threaded and a multithreaded process.
2 Process switching needs interaction with the operating Thread switching does not
system. need to interact with the
operating system.
3 In multiple processing environments, each process executes All threads can share the
the same code but has its own memory and file resources. same set of open files
child processes.
4 If one process is blocked, then no other process can execute While one thread is
until the first process is unblocked. blocked and waiting, a
second thread in the same
task can run.
6 In multiple processes, each process operates independently One thread can read, write
of the others. or change another thread's
data.
Advantages of Thread
▪ Latest OS: Make sure you're running the latest version—either Windows 7 SP1 or
Windows 8.1 Update.
▪ Find out which version you're running.
▪ Need the latest version? Download Windows 7 SP1 or Windows 8.1 Update.
▪ Processor: 1 gigahertz (GHz) or faster processor or SoC
▪ RAM: 1 gigabyte (GB) for 32-bit or 2 GB for 64-bit
▪ Hard disk space: 16 GB for 32-bit OS or 20 GB for 64-bit OS
▪ Graphics card: DirectX 9 or later with WDDM 1.0 driver
▪ Display: 800 x 600
Find a usable computer and install the program on it after the download is completed. Launch
the tool when installation is done. The main user interface is shown up like this:
Step 2Insert USB and Load Windows ISO File
Plug a USB drive into the computer and click the "Burn" text in the main window. A new
window will be opened, and where you should load the Windows ISO file from the local hard
drive by clicking the 'Browse' button.
Usually, the USB drive name should appear on the screen. If not, make sure the device is
well-connected. Then, leave the configuration in default settings, which are set based on the
Windows ISO file you just imported. Finally, click the 'Burn' button to start writing the
Windows ISO file to USB.
There is a progress bar alongside the burning task. It displays the time it takes and the
percentage for the whole task. Please be patient and keep the USB well-connected.
Another popular open-source tool for making bootable USB flash drives from multiple
sources, including DVDs, is WinUSB. Like Rufus, WinUSB can also pick up ISO files from
various sources, including DVDs. The major advantage of WinUSB is that you can create a
multiboot USB containing different versions of Windows that you can use on the same
computer. With that, let's see how to use WinUSB to create a bootable USB pen drive from a
DVD with a Windows bootable ISO file:
Step 1: Launch the program after downloading from the link above and installing it on your
PC.
Step 2: Select your target USB drive after inserting it in the center panel.
Step 3: On the right, you'll see a Windows section. Under that, select the DVD icon after
inserting the disk with the ISO into the optical drive.
Step 4: Hit Next and then name your pen drive, and, finally, hit the Start button at the bottom.
Your bootable USB drive will be ready in a little bit.
WinUSB is extremely versatile, but it doesn't have formal tech support. You must depend on
public forums; veteran users typically ask you to read through old posts. That's a waste of
time, so if you have trouble using WinUSB for any reason, you can try this next method
showcased below.
RUFUS:
A Windows utility that formats and creates bootable USB drives for Windows, Mac, and
Linux (a LiveUSB drive). Rufus is typically used to turn an ISO image into a bootable USB.
See ISO image.
Want to install a fresh version of Windows 10 on your PC? If you're running another
operating system or setting up a new PC, you can easily install Windows 10 from an
installation disc or USB flash drive. Upgrading from an earlier version like Windows 7 or 8.1
is even easier—no flash drive or DVD required! This wikiHow article will walk you through
installing or upgrading to Windows 10 on any PC.
Connect a blank USB flash drive or insert a blank writable DVD. You can install
Windows 10 by creating a bootable USB flash drive or DVD that contains the Windows 10
installation files. You'll need a USB flash drive that's at least 8GB or any blank DVD to get
started.[1]
• If you already have Windows 10 installed on the PC and just want to reinstall it, it'll
be easiest to reinstall it from within Windows 10 instead of creating installation
media.
• If you want to upgrade from Windows 7 or 8.1, you won't need to create an
installation disc or drive. However, you will need to follow most of this method to
start the upgrade.
Make sure you have a product key. If you bought Windows 10 through Microsoft using
your Microsoft account, your product key is already linked to your account. If you bought
Windows 10 from another retailer, you'll have a 25-character product key that you'll need to
have handy to activate Windows.[2]
• If you don't have a product key or are installing Windows 10 on a new hard drive,
ensure you've linked your Windows 10 digital license to your Microsoft account
before you start the installation.[3] Head to Settings > Update &
Security > Activation from the current installation—if the activation status says
Windows is activated with a digital license, click Add an account and follow the
on-screen instructions to link your Microsoft account.
• If you upgrade from an earlier version and your PC qualifies for a free upgrade, you
won't need a product key.
Click the Download tool now. This is a blue button in the middle of the page. This
downloads the Media Creation Tool, which you'll use to create your installation media (or
start your upgrade).
Double-click the downloaded file. Its name begins with "MediaCreationTool" and ends with
".exe." You'll find it in your default download folder, called Downloads.
Click Accept to accept the license. It's in the bottom-right corner of the window.
Select "Create installation media" and click OK. This option lets you create a Windows
installation disc or drive that will work on any compatible PC, not just the one you're using
now.
• If you're updating your PC from an earlier version of Windows, select Upgrade this
PC now instead, and then follow the on-screen instructions to install Windows 10.
You're done!
Select your preferences and click Next. If you're installing Windows on the current PC, you
can keep the default options. If you need to install it on a different PC, make sure you choose
the language and edition for which you have a license and select the architecture (64-bit or
32-bit) that matches the PC you're going to install it on.
• If you're not sure about the architecture, you can choose Both from the menu.
Choose an installation type and click Next. An ISO file is a type of file that can be burned
to a DVD, so choose that option if you plan to create a DVD. Otherwise, choose the USB
flash drive option.
10
Create your installation media. The steps are a little different depending on what you're
doing:
• Flash drive: Select your flash drive from the list, click Next, and wait for the
installation files to install. When the process is complete, click Finish.
• DVD/ISO: Click Save to save the ISO file to your computer—it may take a while
because the file is large and has to be downloaded. Once downloaded, you'll see a
progress screen that monitors the download. When the download is complete,
click Open DVD burner on the "Burn the ISO file to a DVD" screen, select your
DVD burner, and then click Burn to create your DVD.
Part2
Booting from Windows 10 Installation Media
Connect your Windows 10 installation media. If you created a flash drive, connect it to the
PC on which you want to install Windows 10. If you made a DVD, insert it into the drive
now.
2.
Boot the PC into the BIOS. If your PC is not already set up to boot from your flash or
optical drive, rebooting from your installation media won't work. You'll need to quickly
change your BIOS to change the boot order. There are a few ways to get in:
• Windows 8.1 or 10: From Windows, open Settings, select Update &
Recovery or Update & Security, and go to Recovery > Restart
now > Troubleshoot > Advanced Options > UEFI Firmware Settings > Restart.
• Any PC: Reboot the PC and immediately start pressing (over and over again) the
keyboard key required by your PC to enter "Setup" or the BIOS. The key varies by
computer, but here are some of the most common keys:
• Acer and Asus: F2 or Del
• Dell: F2 or F12
• HP: ESC or F10
• Lenovo: F1, F2, or Fn + F2
• Lenovo ThinkPads: Enter + F1.
• MSI: DEL
• Microsoft Surface Tablets: Press and hold the volume-up button.
• Samsung and Toshiba: F2
• Sony: F1, F2, or F3
Go to the Boot tab. You'll use the arrow keys to select it.
• The Boot tab may instead say Boot Options or Boot Order, depending on your
computer's manufacturer.
Select a device from which to boot. You have a couple of options here:
Press the + key until your boot option is first. Once either Removable Devices or CD-
ROM Drive is at the top of the list, your computer will select your choice as its default boot
option.
• On some computers, you'll instead press one of the function keys (e.g., F5 or the
arrow keys to navigate an option up to the top of the menu. The key will be listed on
the right side of the screen.
Save your settings. You should see a key prompt (e.g., F10 at the bottom of the screen that
correlates to "Save and Exit". Pressing it will save your settings and restart your computer.
Wait for your computer to restart. Once your computer finishes restarting, you'll see a
window here with your geographical data. You're now ready to begin setting up your
Windows 10 installation.
Installing Windows 10
Click Next when prompted. You can also change the options on this page (e.g., the setup
language) before continuing if need be.
Enter your Windows 10 key, then click Next. If you don't have a Windows 10 key,
click Skip in the bottom-right corner of the screen.
• If you've already installed Windows 10 on this PC and were signed in with your
Microsoft account, your key should be linked to your account. When prompted, just
sign in with your Microsoft account, and Windows will locate your key.[4]
• Suppose you've changed hardware in the PC, such as replacing the motherboard. In
that case, you can activate Windows after installing it by going to Settings > Update
& Security > Activation > Troubleshoot > I changed the hardware on this device
recently. When prompted, sign in with your Microsoft account, choose This is the
device I'm using right now, and then click Activate.
Follow the on-screen instructions to install Windows 10. You'll be asked to perform a few
tasks, such as connecting to Wi-Fi and choosing some preferences. Once the installation is
complete, you'll have a fresh new installation of Windows 10.
• If you're upgrading from an earlier version of Windows, you'll be asked if you want
to upgrade the current operating system or do a custom install. If you
choose Upgrade, you'll preserve existing apps and files.
To create a partition or volume (the two terms are often used interchangeably) on a hard disk,
you must be logged in as an administrator, and there must be either unallocated disk space or
free space within an extended partition on the hard disk.
If there is no unallocated disk space, you can create some by shrinking an existing partition,
deleting a partition, or using a third-party partitioning program.
3. Right-click an unallocated region on your hard disk, then select New Simple Volume.
5. Enter the volume size you want to create in megabytes (MB) or accept the maximum
default size, and then select Next.
6. Accept the default drive letter or choose a different one to identify the partition, then
select Next.
8.
▪ If you don't want to format the volume right now, select Do not format this
volume, and then select Next.
Note: When creating new partitions on a basic disk, the first three will be formatted as
primary ones. Beginning with the fourth, each one will be configured as a logical drive within
an extended partition.
3. Right-click the volume that you want to format, and then select Format.
4. To format the volume with the default settings, in the Format dialog box, select OK,
and then select OK again.
Notes:
▪ You cannot format a disk or partition currently in use, including the partition containing
Windows.
▪ The Perform a quick format option will create a new file table but will not fully
overwrite or erase the volume. A quick format is much faster than a normal format,
which fully erases any existing data on the volume.
Previous Page
Next Page
Once you get to the Windows Desktop screen, here are some basic features you will see.
One of the most important parts of your Desktop is the Taskbar. By default, it sits at the
bottom of your screen, giving you access to the Start Menu, several application icons, and the
Notification Area.
Windows
In Windows 10, if an application is active or opened, you will see a green line below its icon.
Clicking the icon will bring the application window up.
Every open window features three buttons in the upper-right corner. These are used to
minimize, maximize, or close the window −
Although the amount and type of icons will vary, depending on the computer, you can add
more icons by following these steps −
Step 1 − Right-click on the Desktop Background.
Step 2 − Choose “New” and “Shortcut”.
Step 3 − Browse for the application or file you want to create a shortcut to.
Step 4 − Assign a name to the shortcut and click “Finish.”
Icons can also be moved around by clicking on them and dragging them to another place on
the screen.
Desktop Background
Another component of your Desktop is the Background. This is simply an image that appears
at the back of your screen. Most computers come with a pre-selected background, but you
can change it to any image you want.
To change the background, follow these steps −
Step 2 − Choose from a series of pre-selected pictures from the Personalization window or
browse for your own.
Windows 10 - Taskbar
The Windows 10 taskbar sits at the bottom of the screen, giving users access to the Start
Menu and icons for frequently used applications. On the right side, the Taskbar features the
Notification Area, which informs the user of different things like the state of the Internet
connection or the laptop battery's charge.
The icons in the middle of the Taskbar are “pinned” applications, which is a way to have
quick access to applications you use frequently. “Pinned” applications will stay in the
Taskbar until you “unpin” them.
Pin an Application to the Taskbar
Step 1 − Search for the application you want to pin in the Start Menu.
Step 2 − Right-click on the application.
Step 3 − Select the “More” option at the top of the menu.
Step 4 − Select the “Pin to taskbar” option.
This will attach or “pin” the application icon to your Windows Taskbar.
Unpin an Application from the Taskbar
To “unpin” it, just right-click the icon in the Taskbar and select “Unpin from the taskbar.”
You can “pin” it back again any time you want.
Notification Area
The Notification Area is located on the right side of the Taskbar. It shows different
notifications from your computer, such as your Internet connection or the volume level.
At first, the Notification Area shows a limited amount of icons. But you can also click the
upward arrow on its left side to see other icons.
Task View
Task View allows you to move within your open windows and applications quickly. You can
access it by clicking the “Task View” button from the Taskbar.
You can also press and hold the Windows key and then press Tab to achieve the same result.
By pressing the Alt+Tab keyboard shortcut also serves a similar purpose.
Previous Page
Next Page
The Start Menu is the main point of access to your applications. There are two main ways to
open it −
Step 1 − Use your mouse to click the Windows icon in the lower-left corner of the taskbar.
The left pane resembles the traditional Start Menu from Windows 7 and earlier, while the
right pane features live tiles used in Windows 8.
Left Pane
Among the things you can do in the left pane are −
• Click the username at the top of the menu to change account settings or log in with
another user.
• Access the applications you use more frequently.
• A small arrow next to an application will open a sub-menu with a list of recent
documents opened with that application.
• Open the “File Explorer” to navigate your folders and files.
• Change the settings of your computer, like your Internet connection, or change your
background.
• See different options to shut down your computer.
• See a list of all the applications installed in your computer.
Search Box
The “Search box” on the Taskbar will allow you to search for anything you write within your
documents and files or on the Web. The initial results will appear within the Start Menu
itself.
The results will be grouped according to the closest match (or matches) labeled “Best match”
at the top.
The remaining results will be grouped according to what they are or their location −
• Web results
• Documents or folders
• Apps
• System settings
The icons on the left side of the menu do the following −
The Gear icon will allow you to configure your Search settings.
This icon will let you send Feedback to Microsoft on what you like or dislike about
Windows.
Right Pane
The right pane features a varied array of tiles, similar to those seen on the Start Screen of
Windows 8.
These tiles can be moved and dragged to different places by holding the mouse button.
You can also configure them by right-clicking on them to see options to resize them or
“unpin” them (remove them) from the Menu.
The whole Start Menu can also be resized by dragging the borders with the mouse to the
desired size.
Tablet Mode is a new feature in Windows 10 that allows the user to switch the system
interface whenever a tablet is detached from a base or dock. When the Tablet Mode activates,
the Start Menu goes full-screen. During Tablet Mode, many other windows, like the File
Explorer or the Settings window, also open at full screen.
How to Activate the Tablet Mode?
Step 1 − Open the Start Menu and select “Settings”.
Let’s take an example of a small three-person office. John, Amy, and Mark are three
employees of this small office. Every computer on this network will have its own database of
usernames and passwords.
A workgroup is “every man for themselves” without central control. Every PC in a
workgroup is a server and a client simultaneously. A PC will act as a client when it seeks to
access a resource in another PC. The PC that needs to provide access to its resources will act
as a server during the authentication and authorization process.
For instance, if Amy wants to use Mark’s computer, her username and password need to be
created on Mark’s computer. And if Mark wants to use Amy’s computer, his username and
password need to be created on her computer. If both Amy and Mark want to use John’s
computer, their usernames and passwords need to be created on John’s computer.
Once you’ve set up your network in your small office, you can follow the steps below to
connect all your devices to a single Windows workgroup:
1. Navigate to the Control Panel > All Control Panel Items > System. You will get to
view basic information about your computer screen.
2. Click on Change Settings under Computer name, domain, and workgroup settings to
arrive at the System properties pop-up.
3. Click on Change to rename this computer.
4. Under the Computer Name/Domain Changes pop-up, you can join the workgroup of
your choice. Ensure that all the devices you want in a particular workgroup are joined
to that workgroup. In this case, the workgroup is named My Workgroup. The
following image shows where you can enter the name of the workgroup you want to
join.
Setting up a Workgroup
Now that you’ve set up a workgroup for your small office let’s talk about how to share files
and folders with different users in a Windows 10 workgroup. Let’s assume that you want to
share the My Games folder under Documents.
1. Right-click My Games.
2. Click Properties.
3. Click the Sharing tab.
4. Click on Share
5. Choose the people you want to share the folder with and select the permission level.
The following image shows the screen where you can grant access to other users in
the workgroup.
6. While granting access to other users, you must create their usernames and passwords
on your own computer. This is the only way these users can be authenticated.
Workgroup challenges for large organizations and the need for Active Directory.
Workgroups are not suitable for larger work environments for two main reasons:
1. They don’t scale well: If the network is small, controlling a workgroup is fairly easy.
However, imagine a scenario in which there are more than 15 computers. Creating
usernames and passwords by visiting each computer would be time-consuming and
tedious. Now imagine a corporation with more than 5,000 computers. It would be next
to impossible to manage user accounts through a workgroup.
2. Passwords do not sync automatically: If a user has changed their password on their
own computer, the change won’t be reflected in the other computers they may try to
access on the network. When prompted to enter their username and password to
access other computers, they’ll need to input the old username and password to gain
access.
Workgroups are great for smaller networks but aren’t efficient for larger ones. For large
networks, it’s vital to keep all the usernames and passwords in sync with each other. To do
this, you need a centralized database that manages all usernames and passwords, called
Active Directory.
Note: A client PC cannot belong to a workgroup and a domain at the same time. If a client
joins a domain, its workgroup membership will be automatically removed. The reverse is also
true.
Workgroup vs domain
Workgroups are great for small office networks with 15 or fewer computers. However, they
aren’t ideal for larger companies with hundreds or thousands of users, as it will become
difficult to access files and folders of one computer with another computer. Simply put, AD
workgroups are fine for small offices, but they are not efficient in scaling to big
organizations.
So, we need to set up a client-server network environment for big environments. In Windows,
this is achieved by setting up domains. The domain set up ensures better security as we can
give varying degrees of permissions for different users or groups of users. Furthermore, we
can deploy company-wide policies for easier administration in a domain than a workgroup.
Dynamic (DHCP)
2. Go to the
IPv4 Settings tab and select under method “Automatic (DHCP)”
Configuration on Windows 10
1. Open the Control Panel from the Windows® icon in the lower left corner of your monitor.
In the Control Panel window, make sure View by is set to Category
2. Click Network and Internet. Then , Network and Sharing Center.
3. Click Change adapter settings in the left pane.
Configuration on Windows 10
Windows will automatically set an LLA IP Address if it fails to obtain an IP Address from
the
DHCP server.
Manual
Configuration on Windows 10
1. Follow the step 1-5 as in the guide for Dynamic DHCP
2 In the properties window, select "use the following IP address" and input a static address
Windows 10
In Windows 10, you can share your printer with many PCs on your network. To share a
printer from the PC that the printer is connected to (the primary PC) with secondary PCs that
the printer is not connected to, you must set up sharing settings for the printer, connect the
printer to the primary PC (either wirelessly or by using a USB cable), and then turn on the
printer. Also, make sure the primary PC is turned on, connected to the printer, and connected
to the network.
Note: When sharing a printer, set up sharing settings on the primary and secondary PCs.
Also, make sure you know the name of the primary PC. For more info, see the Set up Sharing
settings and Find your PC name sections at the end of this topic.
There are two ways to share your printer: Settings or Control Panel.
1. Select the Start button, then Settings > Devices > Printers & scanners.
2. Choose the printer you want to share, then select Manage.
3. Select Printer Properties, then choose the Sharing tab.
4. On the Sharing tab, select Share this printer.
5. If you want, edit the shared name of the printer. You'll use this name to connect to
the printer from a secondary PC.
1. In the search box on the taskbar, type Control Panel and then select Control Panel.
2. Under Hardware and Sound, select View devices and printers.
3. Select and hold (or right-click) the printer you want to share, select Printer properties,
and then choose the Sharing tab.
4. On the Sharing tab, select Share this printer.
5. If you want, edit the shared name of the printer. You'll use this name to connect to
the printer from a secondary PC.
There are two ways to connect a shared printer to another PC: using Settings or Control
Panel.
The settings you use to share devices are often turned on by default. If not, follow the steps in
this section to turn settings on using settings or Control Panel.
Whether it’s a work computer, a personal computer, or a family PC, any given Windows 10
device may have multiple users with multiple levels of responsibility. The wide range of
options for configuring your Windows 10 accounts, privileges, and permissions addresses
this. Part of the purpose is to protect your system and your personal information—you
wouldn’t want a guest to have full administrative control of your Windows computer and its
security settings, etc. You can also set up accounts to protect users themselves. In a previous
article, we showed you how to set up a Child account using Family Safety which can be
used to do things like manage screen time or restrict Windows Store purchases and web
browsing activity.
You’ll create your first Windows 10 account when you first set up and configure a new
Windows 10 PC.
If you want to add another user to your computer, you can do so by opening Start > Settings
> Accounts > Family & Other People. Under Other People, click Add someone else to this
PC.
In the resulting dialog, enter a username, password, confirm the password then create a hint.
Click Next to complete the creation of the account.
Delete Accounts
If at any time you would like to delete an account, select the account, open Start > Settings >
Accounts > Family & other people, then click Remove.
Your account type determines what you can and cannot do in Windows 10. By default, the
first account you set up in Windows 10 is known as a Standard Administrator. This account
can do most tasks, such as installing applications and drivers and adding different types of
users to the computer. When you want to change the privilege of an account, sign in to an
Administrator account and open Family & Other People in Settings. Select the account, then
click Change account type.
Click on the Account type list box, choose your privilege then click OK.
So, we are aware of the two common account privileges Windows 10 offers by default:
Administrator and User. However, you can apply several types of account privileges to an
account.
You need to access the hidden user accounts control panel item to do that.
To do that, press Windows key + R, type: control userpasswords2, then hit Enter.
Please be aware this is a legacy interface, which Microsoft might one day remove in a future
release. But for now, you can still access it.
In this dialog, you will see all the accounts available within the system. To change the
privileges of one of the accounts, select an account, then click Properties.
Select the Group Membership tab, then select the Other radio box. Within the list box, you
will find an array of account privileges. Some of these accounts have pretty much the same
functionality. The most common one you might find helpful is the Power Users privileges,
which is just a notch below Administrators. A Power User can create and modify local user
accounts on the computer and share resources such as a printer. The other accounts are more
useful in organizations with different types of users that are part of a large network and
authenticating on a domain.
Changing Passwords
Updating your password is a healthy security practice every Windows 10 user should do
occasionally. This and other strategies, such as two-factor authentication, can secure your
computer and information. Users can change their passwords after the administrator sets up
their accounts.
Changing passwords can be performed by opening Start > Settings > Accounts > sign-in
options. Under Password, click Change.
Enter the new password, confirm it then create a hint. Click Next.
Click Finish.
If you want to change the password for another user, you will have to use the old Control
Panel User accounts item.
To do that, press Windows key + R, type: control userpasswords2, then hit Enter.
Select the account, then click Reset Password. Enter the new password, confirm it, then
click OK.
There are many perks to signing in with a Microsoft account, including syncing your files
with OneDrive or syncing your favorites with Edge. But suppose you’d prefer logging in
the old way due to privacy concerns, internet connectivity issues, or personal preference. In
that case, you can easily switch back and forth between a local account and a Microsoft
account.
Switch from a Microsoft Account to a Local Account.
Open Start > Settings > A
Microsoft Windows Server 2016 is Microsoft's server operating system (OS). It was
specifically developed to serve as a platform for running networked applications. Windows
Server 2016 was released for general availability on Oct. 12, 2016, and was developed
concurrently with Windows 10. Mainstream support for Windows Server 2016 ended on Jan.
11, 2022.
Windows Server 2016 is part of the Windows NT family of OSes. Microsoft Windows Server
OS is a series of enterprise-class server OSes designed to share services with multiple users,
providing extensive administrative control of data storage, applications, and corporate
networks.
Microsoft Windows Server 2016 includes new features such as identity management and
enhanced security capabilities designed to help organizations access data safely if stored
locally, in the cloud or in a hybrid cloud. Microsoft Windows Server 2016 has had three
successors: Windows Server 2019, Windows Server 2022, and the Windows Server Semi-
Annual Channel. Windows Server 2016 is the successor to Windows Server 2012 R2.
This image shows the history of Windows Server OS releases from 1993 to 2021.
A highly anticipated feature of Windows Server 2016 was the inclusion of two
native containers: Windows Server and Hyper-V containers. Windows Server containers run
directly on the OS but are isolated. Hyper-V containers provide better isolation and run from
a Microsoft virtual machine (VM). Windows Server 2016 also provided built-in support
for Docker.
Other new and updated features in Windows Server 2016 include the following:
• Nano Server is a lightweight installation option designed exclusively for cloud- and
container-based scenarios. Nano Server does not include a graphical user interface or
traditional .NET framework; administrators manage Nano Server instances remotely
using PowerShell and Windows Management Instrumentation. There's also an updated
module for building Nano Server images.
• Network Controller is a new server role that provides a centralized, programmable point
of automation to configure, manage, monitor, and troubleshoot virtual and physical
network devices and services. Network Controller can be used with Microsoft System
Center products, including Virtual Machine Manager, Operations Manager, and
PowerShell.
• Storage Quality of Service (QoS) provides a way to centrally monitor and manage
storage performance for VMs. It automatically improves storage resource fairness
between multiple VMs using the same file server cluster.
• Storage Spaces Direct enables highly available and scalable software-defined storage for
servers in local storage. This simplifies the deployment and management of software-
defined storage systems.
• Rolling upgrades for Hyper-V and scale-out file server clusters enable users to add a
Windows Server 2016 node to a Hyper-V cluster with Windows Server 2012 R2 nodes.
• Hot add and remove of memory, officially known as Runtime Memory Resize, enables
administrators to add or remove virtual memory and virtual network adapters while the
VM is running.
• Just Enough Administration is a PowerShell toolkit that restricts users to only perform
tasks for which they are authorized as part of their role.
• Encryption-supported mode offers more protection for default VMs. But it does not
provide as much protection as Shielded mode.
• Identity and Access features include Active Directory Certificate Services, Active
Directory Domain Services, Active Directory Federation Services, Management and
Automation.
• Health Service helps to improve the monitoring, operations, and maintenance of cluster
resources.
The first technical preview of Windows Server 2016 was released on Oct. 1, 2014. A second
and third preview were released in May and August 2015, respectively. Windows Server
2016 was officially released on Oct. 12, 2016.
However, mainstream support for Windows Server 2016 ended on Jan. 11, 2022. This means
that the OS only receives security updates but no improvements or bug fixes. The extended
support is set to end on Jan. 12, 2027. Currently, Windows Server 2016 will no longer receive
improvements or bug fixes.
• 512 MB of RAM;
Requirements depend on the user's system configuration and the features they choose to
install. Processor performance, for example, depends on the clock frequency of the processor
and the number of processor cores and cache.
Windows Server 2016 offers different editions, two of which are the Standard edition and
Datacenter edition. Both editions share many of the same features, but the Datacenter edition
is tailored to organizations with heavier workloads, larger virtual infrastructures and more IT
requirements. Although the Datacenter edition lacks many of the features associated with the
Standard edition, it also provides some extra features that are not included in the Standard
edition.
• Users can create unlimited VMs, but only one Hyper-V host is available per license.
• There are no limitations as to where a server needs to be hosted. Servers can be either
hosts or guests.
• Shielded Virtual Machines, also available in the Standard edition, help provide secure
boot, trusted platform modules, and disk encryption.
ENGR.NISAR AHMAD
www.ncmt.edu.pk
What is Programming?
Writing a set of instructions for a specific task to be done by the computer is known
as Programming.
Computers don't understand our languages like English, Hindi, French, Spanish, Chinese,
Japanese, etc. Computers only understand 0's and 1's. The vocabulary, which consists
of 0's and 1's, is called Machine Language. It's challenging to write instructions in 0's and 1's.
Therefore, we humans created a style to instruct the computers to complete specific tasks,
i.e., Programming Language. Programming languages, also known as High-Level
Languages, can be understood by humans. Additionally, machine language is also known
as Low-Level Language.
Another language called Assembly Language converts our human-readable code, i.e.,
programming language, to an assembly-level language. Examine the pic for more clarity.
What is a Program?
Terminology
Every language, including Natural Languages, which we use in our daily conversations, has
rules to follow. Let's see them one by one.
1. Alphabets
4. Semantics
Comments are the statements that are ignored by the interpreter or compiler at runtime. If
you have comments in the code, then the compiler ignores those statements. Moreover, every
coding language has syntax, differentiating a comment from actual code.
• A compiler takes your written instructions and validates them according to the
language syntax. If everything is good, it will give you the output.
• The compiler will throw errors if the code is not valid.
• An interpreter is also similar to a compiler. It validates the syntax and gives you the
result if everything is correct.
• For languages like Python, Perl, etc. , use the interpreter.
• It converts the source code into an intermediate form and then executes it.
• Additionally, we must run the program every time to see the result.
• See the illustration.
When both compiler and interpreter execute the programs, what's the difference? Let's
examine the differences between them.
Features of Python
• Beginner Friendly
o Python is very handy for learning syntax. Anyone can quickly learn its syntax
without any difficulty. It's easy to teach. In addition to that, the time required
to learn Python is much less than that of other languages.
o Moreover, Python's syntax looks like that of general English.
• Portability
oYou can run your Python code anywhere, irrespective of the machine or
software you are using.
o Moreover, Python follows the statement "code once run everywhere".
o For example, you have written a program in Windows and can also use that
program to run in Linux.
• Dynamic
o You don't need to declare the type of an object in Python. In other words, it
automatically detects the type of object based on the value that we have given.
o For example, you can directly assign integers, floats, strings, etc., to variables
without bothering about the declaration like C. To clarify, let'
Open-source
• It's an open-source language. You can also contribute to the Python project.
• Standard Library
• Additionally, Python has a large set of standard libraries that help you in different
aspects.
1. Install Python
o Linux
o Windows
o Mac OS X
Install Python
We need to install Python to start coding in it. It's open-source. So, we don't need to pay for
anything. Therefore, let's see how to install it on your PC. We will see the installation guide
for both Linux and Windows.
Check your Python version by typing the Python --version command in the terminal. If you
run the command, it will return the Python version.
Additionally, if your PC doesn't have Python installed, run the following command to install
it.
Note: If we click on the download button, the latest Python version of the .exe file will
automatically download.
Firstly, double-click on the file to start the installation. A dialogue box will open as follows.
After that, leave the default option Install launcher for all users (recommended) to install it
for all the users. Check the Add Python 3.8 to the PATH option to install it globally. After
this, click on Install Now. Permit to install it when it asks.
Additionally, you can see the progress of the installation in the above picture.
Consequently, you have successfully installed the Python on your PC. Run the
Python command in the command line to start Python's interactive mode.
3. Thirdly, choose Windows(.exe) from the drop-down menu in the community section.
6. After this, click the Next button. You will see the following screen.
7. Finally, select the installation folder. I recommend you to leave the default folder for
installation. Click Next. In the next step, you will see installation options.
8. After that, select a 64-bit launcher for the Desktop shortcut. Additionally, add launchers
dir to the PATH for environment variable setup. Click Next.
11. If it asks for the reboot, then restart the PC. And you finished the most boring part of the
coding.
What is IDE?
IDE [Integrated Development Environment] is a software application that generally has a
source code editor, builds automation tools, and a debugger. In other words, it makes the life
of programmers easy.
Python IDE
There are several Python IDEs on the market. Some of the important ones are as below:
• PyCharm
• IDLE
• Sublime Text 3
• Visual Studio Code
• Atom
• Spyder
IDE saves developers much time. Let's see some benefits of using an IDE.
• Firstly, they do faster coding compared to other normal text editors. IDEs
autocomplete the syntax for us.
• Secondly, they help in managing the projects. We bundle everything necessary for the
project.
• Thirdly, they provide debugging tools for correcting the code.
• Finally, IDE (e.g., PyCharm) prompts us to follow the PEP8 - Pytho's style guide.
1. First, open the PyCharm. A screen will appear like the following image.
3. Third, choose the directory and name of your project (e.g., toolsqa). Leave the below part
as it is.
5. Finally, you will get the welcome screen as it is the first time. Select the option Show tips
on startup to get some helpful advice whenever you open the PyCharm.
6. After that, click the Close button to close the Tip of the Day window.
7. Your project screen will look like the below image.
8. Your project folder (toolsqa) doesn't have anything now. The External Libraries folder
will contain Python3.8 (based on the version you are on)
9. Right-click on the project folder (toolsqa) to create a Python file and go to New.
10. A window will appear that asks you to name the Python file.
11. After this, type the name and hit Enter to create the Python File in the project folder
(toolsqa). Now, your project folder will contain a Python File
13. Write the following code into the file and press Ctrl + S to save it. Don't worry
about print(). For now, remember that it takes a value and prints it. We are going to talk
about this in future lectures.
print('Hello, World!')
14. After this, to run the file for the first time, go to the Run menu and click the Run button.
Additionally, you can also use the shortcut Alt+Shift+F10 to run the file.
16. You will see the output at the bottom of the PyCharm.
17. Next time onwards, click the Run button at the top right corner to run the current file.
You can also use shortcut Shift + F10 to run the program.
Several types of errors can occur in Python. Each type indicates a different kind of problem
in the code, and comprehending these error types is crucial in creating effective Python
applications.
The most common types of errors you'll encounter in Python are syntax errors, runtime
errors, logical errors, name errors, type errors, index errors, and attribute errors. Let's go
through each with examples.
1. Syntax Errors
A syntax error occurs in Python when the interpreter is unable to parse the code due to the
code violating Python language rules, such as inappropriate indentation, erroneous keyword
usage, or incorrect operator use. Syntax errors prohibit the code from running, and the
interpreter displays an error message that specifies the problem and where it occurred in the
code. Here's an example of a Python syntax error:
x = 10
if x == 10
print("x is 10")
When the above code is executed in an IDE, we get the following output message that
describes the error and the location in the code where it occurred:
2. Runtime Errors
In Python, a runtime error occurs when the program executes and encounters an unexpected
condition that prevents it from continuing. Runtime errors are also known as exceptions and
can occur for various reasons such as division by zero, attempting to access an index that is
out of range, or calling a function that does not exist.
3. Logical Errors
A logical error occurs in Python when the code runs without any syntax or runtime errors but
produces incorrect results due to flawed logic in the code. Incorrect assumptions, an
incomplete understanding of the problem, or the incorrect use of algorithms or formulas often
cause these types of errors.
Unlike syntax or runtime errors, logical errors can be challenging to detect and fix because
the code runs without producing error messages. The results may seem correct, but the code
might produce incorrect output in certain situations. Here is an example of a logical error in
Python:
def calculate_factorial(n):
result = 1
for i in range(1, n):
result = result * i
return result
print(calculate_factorial(5))
Output:
24
Variables contain mainly two parts: one is a name, and the other one is a value. Moreover,
Values may be of different data types.
variable_name = value
The variable_name is the name of the variable. Moreover, the value is the information or
data to be stored in the variable. Subsequently, you will get to know the different types of
data stored in variables.
We have special rules for naming the variables in Python. We have to follow those rules to
name the variables. Let's see how to call the variables in Python.
• Firstly, Python allows using only alphabets, digits, and underscores (_) for the
naming of variables.
• Secondly, Variable names must start with _ or alphabets. Moreover, the alphabet may
be lowercase or uppercase.
• Thirdly, we cannot use Python keywords as a variable name. Keywords are reserved
words of Python, which has unique functionality.
• Lastly, variable names in Python are case-sensitive, i.e., uppercase letters are
different from lowercase letters. For example, NISCOM is different from niscom.
So, we now know the rules of naming variables in Python. Let's see some valid and invalid
variables. Additionally, we will learn to detect the error of invalid variables in code.
Now you know the naming rules of a variable in Python. Answer whether False is a valid
variable name or not.
If you follow the tutorials from the first, you will know that False is one of the keywords in
Python. Additionally, we can't use keywords as variable names. Hence, False is not a valid
variable name in Python. Let's see other keywords.
Python Keywords
Keywords are the reserved words in Python. Moreover, these keywords have different
meanings for various purposes. See the list of keywords.
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue',
'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is',
'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
We can't use the above keywords to name variables in our code. However, we can use them
by changing the case of any letter in the keyword. For example,
In addition to the above, Python has a method called bool() to convert any object into a
boolean value. Let's examine the process in detail.
bool()
Based on the argument, the function bool() returns either True or False . Moreover, it takes
one or zero arguments. That is to say, if we don't pass anything to the bool(), then it will
return false. Moreover, for any non-zero value bool() returns True. Let's see some examples.
# float
print(bool(7.59))
# strings
print(bool("ToolsQA"))
print(bool('ToolsQA'))
We have different situations where the function bool() returns False. Let's see some quick
examples.
Symbol Operator
** Exponentiation
* Multiplication
/ Division
% Modulo
+ Addition
- Subtraction
Based on which operator you evaluate first, you will either get 37 or 49 as an answer. So let's
understand some rules around it.
Precedence
The correct answer for the expression 2 + 5 * 7 is 37. We got the result by performing
multiplication first, and then the addition operation. The expression evaluates as 2 + 5 * 7 =>
2 + 35 => 37.
It's because Python has already defined the precedence of the operators based on which the
expression evaluation happens. This precedence is the same across all the other languages as
well.
count = 1;
count = count + 1;
If we look at this operation, we have got the count variable on both sides of the expression. In
addition to that, it is a time-consuming and less efficient way of writing code.
Most programming languages have a more efficient way to write this. Python follows the
same path.
count += 1;
# normal operation
count = 0
count = count + 1
print(count)
In the statement count = count + 1, we have the same variable on the operation's left and
right sides. So we can use shortcut variations for the addition operation. Let's see the same
example with the shortcut addition operator.
# shortcut operators
count = 0
count += 1
print(count)
If you see the output of the above program and the previous one, both are the same. There is
no difference. And this is how we reduce the length of the expressions using shortcut
operators.
# shortcut operators
toolsqa = 100
toolsqa //= 2
print(toolsqa)
We can use all the arithmetic operators as shortcut operators. Here are some more examples
a = 20, b = 20 a == b
Equal-To (== ) Decides whether the values are equal or not.
returns True
a = 10, b = 12a != b
Not-Equal-To (!= ) Decides whether the values are unequal or not.
returns True
a = 25, b = 10 a > b
Greater-Than (> ) Decides whether the left value is greater or not.
returns True
a = 10, b = 25 a < b
Less-Than (< ) Decides whether the left value is lesser or not.
returns True
Less-Than-Equal-To Decides whether the left value is lesser or equal a = 34, b = 34 a <= b
(<= ) to the right value or not. returns True
MODULE 4 STRING
Text with single or double quotes at the start and end is a string. Examples of strings
are "NISCOM," '759', etc. Moreover, Python does not have a particular representation of
strings. We can use the examples directly in Python programs. Let's practice some coding.
# string
print("NISCOM")
Consequently, the output of the above code is ToolsQA. Let's see the same example with
single quotes.
# string
print('NISCOM')
For now, let's see what happens when we print empty strings.
# empty strings
print("")
print('')
We got nothing in the output console. That's what we expected.
Another method is to use other quotes that haven't applied to enclose the string. In other
words, whenever you want quotes in the output string, use the quotes inside the string that
haven't been used to enclose the same string. Let's see the example to get clarity.
str()
str() is similar to the functions int and float. Additionally, it helps to convert objects into a
string. And it takes one or zero arguments. In other words, if we don't pass anything to
the str() function, then it returns an empty string. Let's see what happens if we don't pass
anything to the str function.
See an example of converting the integer to a string. We can directly pass the integer to
the str function.
We got the output as 1234. But how do you confirm that it is a string? Let's see some more
examples to ensure that the str function's result is a string.
print(1234 + 1)
Consequently, we will get the number 1235 as output.
print(str(1234) + 1)
Did you get the output? No! But why? First, let's see the error and the reason behind it.
The error Python threw on us is that we can only concatenate str (not "int") to str. In other
words, we can't add an integer to a string. Remember that we can't add a string to an integer
in Python. That is the reason why it shows us an error. Conclusively, we can say that the
result of the str function is a string.
How to get rid of that error? We can solve it by knowing the meaning of concatenate in
Python.
Search and see the general meaning of concatenate. In simple words, concatenate means link
together. That is to say, Python links one string at the end of another string using the
operator +. Let's see how to rectify the above error using it.
print(str(1234) + "1")
After that, guess the output. And check it with the actual output.
Code_11Finally, we didn't get any errors. Moreover, Python links the second string to the end
of the first string. We will talk about it in detail in the later tutorials.
Remember, the + operators act as a concatenator only if both the operands are strings.
Additionally, if anyone of them is not a string, we will get an error, as seen in the previous
tutorials. Let's recap it by executing an example.
# concatenation
name = "ToolsQA" + 2020
print(name)
Got an error, as we expected.
Can we use the concatenation operator directly in the print() function? Yeah! We can. We
have already used it in the previous tutorials. For example, see the below:
What is concatenation? The meaning of the word concatenation tells everything about the
functionality. It links in a chain or series. In other words, the concatenation operator
connects one string at the end of the other.
In Python, lists are used to store multiple data at once. For example,
Lists Elements
Create a List
print(numbers)
# Output: [1, 2, 5]
Run Code
# empty list
my_list = []
In Python, lists are ordered , and each item is associated with a number.
The number is known as a list index.
The index of the first element is 0, the second element is 1 , and so on. For
example,
languages = ["Python", "Swift", "C++"]
List Indexing in
Python
Here, we can see each list item is associated with the index number. We
have also used the index number to access the items.
Note: The list index always starts with 0. Hence, the first element of a list is
present at index 0, not 1.
Python allows negative indexing for its sequences. The index of -1 refers to
the last item, -2 to the second last item and so on.
Let's see an example,
Python Negative
Indexing
Note: If the specified index does not exist in a list, Python throws
the IndexError exception.
Slicing of a List
my_list = ['p','r','o','g','r','a','m','i','z']
Output
Here,
Note: When we slice lists, the start index is inclusive, but the end index is
exclusive.
1. Using append()
The append() method adds an item at the end of the list. For example,
numbers = [21, 34, 54, 12]
Output
In the above example, we have created a list named numbers . Notice the line
numbers.append(32)
even_numbers = [4, 6, 8]
Output
Python lists are mutable. Meaning lists are changeable. And we can
change list items by assigning new values using the = operator. For
example,
languages = ['Python', 'Swift', 'C++']
Here, initially, the value at index 3 is 'C++' . We then changed the value
to 'C' using
languages[2] = 'C'
2. Using remove()
We can also use the remove() method to delete a list item. For example,
languages = ['Python', 'Swift', 'C++', 'C', 'Java', 'Rust', 'R']
List Methods
Python has many useful list methods that make it really easy to work with
lists.
Method Description
extend() add all the items of an iterable to the end of the list
We can use a for loop to iterate over the elements of a list. For example,
languages = ['Python', 'Swift', 'C++']
Output
Python
Swift
C++
We use the in keyword to check if an item exists in the list or not. For
example,
languages = ['Python', 'Swift', 'C++']
Here,
List Length
We use the len() function to find the size of a list. For example,
languages = ['Python', 'Swift', 'C++']
Output
List Comprehension
print(numbers)
is equivalent to
numbers = []
conditional block or leave it as it is. The code inside the conditional block is executed if and
only if the conditional statement returns true. (from expressions inside the construct)
if (something is True)
For example, I have a variable age whose value is 40. Then, with the code given below, the
print statement will be executed only if the age is 40.
age = 40
if(age == 40):
print("The age is 40")
To refresh your memories, recall that Python does not use braces to represent the code blocks
and uses colon instead. All the code intended to be inside the conditional statement should b
indented properly and in alignment. Misalignment of even one space can lead to exceptions
and errors.
Continuing from the previous example, I am now 35 and have an "if " statement that prints
the age. If my age is 40, it will print; otherwise, another print statement will be executed,
telling me that my age is not 40.
age = 35
if(age == 40):
print("The age is 40")
else:
print("Age is not 40")
The above execution would return the following results:
All right! We now know how to execute some code based on certain conditions. In other
words, if the condition is true (execute if block) otherwise, execute else block if the condition
is false. However, there is one more use case in conditional statements. What if we want to
put up one more check once the "if " condition fails and not execute the else statement
directly?
Continuing on the same example, we will try to put up one more check in case the "if
" conditional statement fails. Guess the output for the following code:
age = 35
if(age == 40):
print("The age is 40")
elif(age == 35):
print("Age is 35")
You are right if you guessed the following output:
Since the indentation in Python is similar to the "{ " in other programming languages, we can
skip the indentation if we have to execute only a single statement. We follow the same
practice in other languages, too! So, writing the "if " statement as follows:
if(condition):
print("If statement Ecxecuted")
In addition, you can combine various "if-elif-else " statements, giving rise to a cascading
conditional block, which we will discuss in the next section.
if(condition):
#code
elif(condition):
#code
elif(condition):
#code
else:
#code
Note: In the above statement, I have used two "elif" statements. Practically, you can use as
many as you want, although we always recommend fewer numbers.
Python cascaded statements are a good way to build up your logic in minimum lines keeping
in mind the consistency of the structure maintained. The "if " block works as an "entry
" gate of the complete conditional block in Python. The "if " block will always test first when
we run the condition block. If the condition is satisfied, the code within "if " is executed, and
we exit the conditional block. If the condition is not satisfied, we move ahead to the first "elif
" block and the same process follows until the end.
Therefore, only one of the code block executes, when any of the "if-elif" statements
satisfies, we execute the code and skip the rest of the conditional block.
The else block is the last block that will execute when no other statement satisfies. This is
totally optional and if your code does not require the execution of a statement necessarily,
you don't need to put up an else statement.
The following code snippet prints the range of the age of the user. Try to understand the code
with respect to the cascading conditional statements (conditional statement inside another
conditional statement).
age = 35
if(age > 60):
print("Senior Citizen Benefits Applicable")
elif(age > 21):
if(age > 40):
print("Benefits Renewed Automatically")
else:
print("Your Benefits Have Lapsed, Please Renew")
else:
if(age > 13):
print("Benefits Covered Under Parental Scheme")
else:
print("Benefits Covered Under Government Childcare Scheme")
Run the above code and verify your guessed output with the console output. Always
remember that the indentation of the statements should be proper otherwise Python would
mix up the structure and the output would not be as expected. Also, try to change the variable
values and see what output generates. Feel free to extend the code and share it with us for
other learners.
The intuitive way that comes to mind is to use a series of "if-elif-else” statements and
implement the logic. However, "if-elif-else” is prone to errors since more conditions lead to
more complex nested statements. If you are comfortable, you can achieve the same using
the "if-elif-else " statements.
Another way is to go for the dictionary switcher method. In this, we can create a function
with a dictionary called switcher. Moreover, we can construct the dictionary using the key
and value pairs just like a case statement in the conventional switch method. The explanation
of the same is there using the code below:
def season(i):
switcher={
0:'Winter',
1:'Summer',
2:'Spring',
3:'Autumn',
4:'Monsoon',
5:'Fall',
}
return switcher.get(i,"Invalid Season")
print(season(2))
Just like case (i), we can put the function name in place of the case. With the same intentions,
we will get the following output:
And hence, you can use the switch statement with some minor tweaks. This was just to widen
your knowledge spectrum in Python, which is not a part of the PCEP certification course.
The Pass statement in Python resolves the problem of an empty code block or a stub code.
In programming, we often leave some functionality blocks empty without any
implementation. Because, at that point, we are not sure what would come in those blocks.
Since other programming languages use "{ " or such delimiters to determine the start and end
of a code block under conditional statements, Python does not have this construct.
With predefined delimiters, we can just leave the code part and we should understand it
implicitly. Doing the same results in an error in Python. For example, in the below code I
have left the if conditional block without any implementation:
age = 40
if(age == 40):
This error means that Python needs something inside that is indented if it is a conditional
statement and cannot be left empty. To resolve this issue, we use the "pass " keyword. Using
the "pass " keyword is equivalent to leaving the code blank. Additionally, it symbolizes that
from the point of "pass " till the end of the indented block, we don't want any executions.
Let's put "pass " in our code as follows:
age = 40
if(age == 40):
pass
print("If Statement Executed")
Execute the above code and verify whether the error is resolved.
The "for" loop will run until all the items in the sequence (or any other iterable object) are
not traversed completely. However, there is an exception of the "break" statement which can
terminate the loop mid-way. But naturally, it will traverse the sequence completely.
//
The "var" in the structure is the variable name that will take the current item's value from the
sequence. The "sequence" is the variable denoting the sequence name. Don't worry if things
are not clear now; they will be when we practically implement the "for" loop in Python.
It is important to note that the Python "for" loop is a bit different than the "for" loop of
other programming languages. In other programming languages, a "for" loop initiates a
variable with a value (although this is optional but standard ), performs condition checks,
and then performs a specified operation on every iteration of the loop. The operation is more
commonly used as "var++" denoting an increment in var value by 1.
In Python though, the "for" loop works more like an iterator that iterates over a given
sequence or iterable object and the variable takes value from that sequence. In the next
section, we shall implement the "for" loop to help clear the picture.
Now that we have our sequence ready, we can iterate over it. No prior declaration is required
for the variable we use inside the "for" loop. The following Python "for" loop program
iterates over the list and prints the list elements as output:
I hope it was easy enough! We will take one more example, a little bit different, to
understand the basics of "for" loop more deeply.
The syntax of the python "for" loop with range method is as follows:
....
The following points will come in handy while working with the range method:
• A negative step means a decrement in range. Therefore, step as -2 will decrement the
value by 2.
• If the minimum value is 0, you can omit the min value part and write the maximum
value directly as the default min value is 1.
• If the step is 1, there is no need to write the step value as the default step value is 1.
for i in range(5):
print(i)
With a single value, the range function takes it as a "max" value considering 0 as the default
minimum and 1 as the default step value. The "for" loop would execute as follows:
The output is in accordance with our assumptions, and we consider 0 to be the minimum
value, with 1 as the default step.
The following for loop in Python uses a range function with two parameters:
for i in range(5,10):
print(i)
The output of the above code is as follows:
You must have observed how Python skipped the "max" value inside the range function.
Therefore, remember that python "for" loop with the range function executes from min to
max - 1 value.
I hope it comes in handy while practicing for the "for" loop in Python. As a next step, we will
try to run one "for" loop inside another. This is also termed "nested looping".
for i in range(1,10):
for j in range(1, 10):
//code
Can you determine the output after implementing the above code?
In the above code, the outside "for" loop runs from 1 to 9, while the inside loop will run 9
times for each iteration of the outer loop. So, for example:
Iteration 1:
i = 1, j = 1
i = 1, j = 2
i = 1, j = 3
...
i = 9, j = 9
for i in range(1,10):
for j in range(1, 10):
print("i = " + str(i) + " j = " + str(j))
Note: The above screenshot is the partial output as the printed list is very long.
Also, the nested loops do not necessarily be two loops. You can implement any number of
nested loops one inside another but as a programmer, I must suggest that nested loops
should be the last option in programming as they increase the time complexity of the program
by the power.
Alright, this was all about the "for" loop in Python. In some programming languages, you
might find another sister loop of the "for" loop known as "for each" loop. We do not have the
for-each loop in Python, but all its traversal functionalities are covered only through the "for"
loop. Therefore, it is easier to loop things in Python.
Another important loop in Python from programming as well as PCEP point of view is the
"while" loop. In the next section, we shall review the "while" loop and see how it differs from
the "for" loop in Python.
In the last post about Python "for" loops, we got introduced to Python's concept and how
does Python handle loop. With different variations and methods introduced in loops, we are
all set to move ahead to the next and probably the only other important loop in
Python: python while loop. Since this is also a loop, the work needs no introduction in this
post. If you are unaware, I highly recommend going through the python "for" loops and brief
yourselves with the basics.
while(condition):
//Code Block
The conditions can be as simple as (i < 5) or a combination of them with the boolean
operators' help in python. We shall see them steadily into the post.
i=1
Now I want "Good Morning" to be printed 5 times. Therefore, the condition block will look
as follows:
i <= 5
The indented code will be the code I would like to execute when the condition returns True.
print("Good Morning")
i=i+1
Combining my code, it will look as follows:
i=1
while(i <= 5):
print("Good Morning")
i=i+1
When we compile and run the code, the following iterations occur during the loop execution:
....
Can you guess what would happen if I skip the line i = i + 1? Run it and find out!
If the code block inside the while loop is a single statement, the programmer can also write
the while loop. Moreover, the statement in a single line as follows:
I hope it comes in handy while practicing for the “while” loop in python.
Leaving the standard textbook facts aside, can you try to build a do-while loop in python by
yourself? The "do-while" loop always executes the first iteration and then checks the
condition to decide whether another iteration would run. To understand it using another loop,
let's dissect this statement and construct a "do-while" loop ourselves.
This statement tells us that we do not need to check the condition while entering the code
block. Does that ring any bells? Yes!!, we need a "while true" statement since it is always
true. So we start with the following statement:
while (True):
Statement 2: After that, check the condition to decide whether another iteration would run.
Since we need to check the condition after the code block has executed once, we can put a
simple if statement with a break as follows:
while(True):
//Code Blocks
if(condition):
break
The above code works exactly similar to the following do-while loop:
do {
//code block
} while(condition);
It brings us to the end of this post. I hope we addressed all your queries in this post. If you
have any questions, you can raise them in the FAQ section or email me
at [email protected]. I would be happy to help you out!
Python runs on two main loops discussed in the previous posts; the "for" loop and the
"while" loop. These loops check the conditions and run multiple iterations until our sequence
consumes or the condition satisfies. With the knowledge acquired in the previous posts, we
can control the loop from its beginning: the condition and the sequence. This post will help us
enforce control in the Python loops from within the loop code body. By the end of this post,
we will write a code that can break a loop between or skip some code-based. The concepts
used to achieve these actions are the loop control statements: the python break statement,
control statement and pass statement. This article will revolve around the same loop control
What is a function?
A function is a block of code that can perform a specific action. In addition to this, these
block of code doesn't execute until you call or invoke the function. There are two types of
Functions in Python
We will discuss functions in detail in later articles. For now, you must have figured out that
print is a Built-in function!
Let's see it practically. Open the IDE and run the following code:
Single Argument
We had already seen a single argument when we used print function to print "Hello World".
It displays or outputs the data that you pass to the print() function. Moreover, the syntax is
print(data). If we pass a single argument with quotes, it prints that value, as we saw in
the hello_world program.
As we already saw the values are literals. Moreover, Python divided the literals into four
different types of data. Data types are the building blocks for any programming language.
Python Data types are integers, floats, strings, and booleans. Additionally, they play a vital
role in programming. Therefore, one should possess a strong knowledge of them. In this
tutorial, we will learn about the integers and floats.
Some examples of integers are 759, -759, 123, 4, -5, etc. In addition to this, integers don't
make up a fraction of the population. Let's see how to represent integers in Python.
We can use the integers directly as we use it generally. In other words, there is no special
notation for the integers in Python. Subsequently, let's try running the following example
code.
# integers
print(759)
print(2020)
The numbers that we passed to print statements are integer literals.
You will get the same output as you see in the program.
What if we want to store large numbers like 123,456,789? We can't write as it is. That is to
say, Python doesn't allow us to put commas between the digits of a number. Let's see what
happens if we write them in the print statement?
# integers
print(123,456,789)
I think you know the output for the above code. Consequently, run the code and see whether
your output matches the real output.
We didn't get any errors. In other words, the print statement takes them as three different
numbers and prints them to the console. But that's not what we want. We want the entire
number as 123456789. Let's explore other ways to write long integers.
Can we write the number as 123 456 789? No, it's not correct, according to Python. So, what
do we get as the output for 123 456 789? Let's check it with the following code.
# integers
print(123 456 789)
We can write the 7.0 as 7. and 0.7 as .7. In other words, we can delete the zero if it is the only
digit in the integer or fractional part of the floating-point number.
# floating-point numbers
print(7.59)
As shown above, we are printing the floating-point number.
Try to print different floating-point numbers to see the behavior of the floats in Python.
float() function
The float() function works similar to the int() function. That is to say, it takes an object as an
argument and returns the value as a float-point value. Run all the int() section examples
using float() function. See the code examples for the conversion in the code below.
# converting to float
print(float("123.0"))
print(float(759))
print(float(7.59))
If we have given a string with characters other than digits to the float() function, it will throw
an error similar to the int() function.
The input function indicates the user to enter the data on the console. Moreover, the program
executes further only when the user has entered the data. This data can then be stored in a
variable and can use it in the program wherever we need it.
Note - Input function always takes the input data as String. So if you are asking the user to
enter age, and he enters age as 25, this will be considered a string. Additionally, you need to
convert it to int before you take any action on it.
If you run the above program, you will see a blinking cursor in the output console, as shown
in the below snap. It is waiting for the data. Moreover, the program won't execute the further
steps until we give the input.
After entering any text hit Enter, consequently, you will get what you entered as output.
The data that we have given is stored in the variable name. And we have printed the variable
in the last line of the code. That's the output we have seen in the above image and your IDE.
For example, your program needs the name of the user to print a welcome message. You can
write the input statement as input("Enter your name:- "). It displays the message to the
user. Subsequently, try the following code in IDE.
You can see that we have stored the user input in a variable user_name, and while printing it,
we have added "Hi" to it.
What happens when you pass multiple arguments to the input() function? Will it show
everything like print() function?
What do you expect the output to be? Run the code and enter a number. See what you get.
We got the error. Why? The data that we got from the console is a string. And we try to add a
string to a number. So, we got the error.
What if we want to take a number as input? Is it possible? Let's jump into the next section to
find the answers.
Type Casting
Converting one type of data to another is known as typecasting. We are already familiar with
such kind of conversions.
What if we want to take an integer, or float as input. Is it possible in Python? The answer
is NO. However, we can use typecasting (type conversion) and built-in data type functions.
Let's try to convert the python string to python integer. You still remember the int function,
don't you?
We will get an error if we try to convert a string that contains alphabets or other special
characters. Run the above code and give the 2020ToolsQA as input.
We are trying to convert a string that is not a number. So, Python throws an error.
Similar to converting strings to integers, we can also convert them to floats. You can
use int or float functions for the conversion based on your needs.
We have seen how to perform arithmetic operations on integer and floats. We can
use + and * operators on a string as well. However, it behaves differently. Let's have a quick
look at various types of Python String Operator :
string + string
Let's get into the coding.
If you look at the output, the addition of the string "QA" happened at the end of the string
"Tools." Yeah! We got what we expected.
We know that both expressions 2 + 3 and 3 + 2 produce the same result when we do the
arithmetic operation. What about "Tools" + "QA" and "QA" + "Tools"? Did they give the
same output? No! We don't get the same output. Let's see why.
• Firstly, Concatenation operators join the second operand (string) at the end of the
first operand (string).
• Therefore, the expression "Tools" + "QA" give "ToolsQA" whereas the expression
"QA" + "Tools" gives "QATools".
• And the results are not the same.
• Moreover, the arithmetic addition operator is commutative while string concatenation
is not.
Note:- If we pass an expression to the print() function, then it gives the output after
evaluating that expression.
The following program helps avail the child benefit scheme to government employees having
a child younger than 20 years of age:
Turtle is a pre-installed library in Python that is similar to the virtual canvas that we can draw
pictures and attractive shapes. It provides the onscreen pen that we can use for drawing.
The turtle Library is primarily designed to introduce children to the programming world.
With the help of Turtle's library, new programmers can get an idea of how we can do
programming with Python in a fun and interactive way.
It benefits the children and the experienced programmer because it allows designing unique
shapes, attractive pictures, and various games. We can also design the mini-games and
animation. The upcoming section will teach us about the various turtle library functionalities.
1. import turtle
Programming with turtle
First, we need to learn to move the turtle all directions as we want. We can customize the pen
like turtle and its environment. Let's learn the couple of commands to perform a few specific
tasks.
o Forward
o Backward
o Left
o Right
Turtle motion
The turtle can move forward and backward in the direction that it's facing. Let's see the
following functions.
Example - 3:
1. import turtle
2. # Creating turtle screen
3. t = turtle.Turtle()
4. # To stop the screen to display
5.
6. t.forward(100)
7. turtle.mainloop()
Output:
Example - 2:
1. import turtle
2. # Creating turtle screen
3. t = turtle.Turtle()
4. # Move turtle in opposite direction
5. t.backward(100)
6. # To stop the screen to display
7. turtle.mainloop()
Output:
o right(angle) or turtle.rt(angle) - This method moves the turtle right by angle units.
Example - 3:
1. import turtle
2. # Creating turtle screen
3. t = turtle.Turtle()
4.
5. t.heading()
6. # Move turtle in the opposite direction
7. t.right(25)
8.
9. t.heading()
10. # To stop the screen to display
11. turtle.main loop()
Output:
o left(angle) or turtle.lt(angle) - This method turn the turtle left by angle units. Let's
understand the following example.
Example -
1. import turtle
2. # Creating turtle screen
3. t = turtle.Turtle()
4.
5. t.heading()
6. # Move turtle in left
7. t.left(100)
8.
9. t.heading()
10. # To stop the screen to display
11. turtle.mainloop()
Output:
The screen is initially divided into four quadrants. The turtle is positioned at the beginning of
the program is (0,0) known as the Home.
Example -
1. import turtle
2. # Creating turtle screen
3. t = turtle.Turtle()
4. # Move turtle with coordinates
5. t.goto(100, 80)
6. # To stop the screen to display
7. turtle.mainloop()
Output:
Forward() and Left() are two functions that we can utilise to draw squares and rectangles.
The fundamental characteristics of each shape must be understood before we can draw it.
Square :
Let's begin by using a square. An equal number of sides make up a square. And there is a 90°
angle between the two adjacent sides. Parallel sides are situated next to one another.
We now know the square's fundamental characteristics i.e. all sides are equal. Python
Turtle needs a square drawn now. Assume that a square's side is 200 units long.
1. import turtle
2. ttl = turtle.Turtle()
We imported? The turtle module here?at this time. After then, a new drawing board was
made and given to an object named?ttl.
1. ttl.forward(150)
2. ttl.left(90)
The turtle has advanced by 150 units in the forward direction as a square's side is 150 units
long. As the angle between neighboring sides is 90°, we then turned the turtle
90°. The square's one side is now complete.
1. ttl.forward(150)
2. ttl.left(90)
3. ttl.forward(150)
4. ttl.left(90)
5. ttl.forward(150)
6. ttl.left(90)
Here we repeated the last step three times to construct the remaining three sides of the
square in a similar way as we did for the first side. To draw the remaining three sides, the
same statements were reiterated three more times.
Complete Code :
6. ttl = turtle.Turtle()
7. ttl.forward(150) # moving the turtle Forward by 150 units
8. ttl.left(90) #Turning the turtle by 90 degrees
9. ttl.forward(150)
10. ttl.left(90)
11. ttl.forward(150)
12. ttl.left(90)
13. ttl.forward(150)
14. ttl.left(90)
Output :
As we can see, we repeated the same statements (forward(150) and left(90)) four times in
the code above. So, rather than writing them repeatedly, we may use a loop that runs four
times.
Complete Code :
Output :
The output of the code mentioned above will be same as that of the previous code.
Explanation :
In this program, instead of using the forward(150) and left(90) function four times, we used
it only once but executed it four times by the help of a for loop to get the same desired output
as that in the previous program.
Rectangle :
We are very well aware of the fact that the rectangle's diagonals are equal. Moreover,
the opposite sides of a rectangle are of equal lengths. A rectangle's neighbouring sides
meet at a 90° angle. We shall draw the rectangle bearing in mind these characteristics. Let's
say the rectangle has a length of 140 units and a width of 70 units. Using the code below
we will get a rectangle in turtle.
1. import turtle
2. ttl = turtle.Turtle()
We imported? The turtle module here? At this time. After then, a new drawing board was
made and given to an object with the name?ttl.
1. ttl.forward(140)
2. ttl.left(90)
3. ttl.forward(70)
4. ttl.left(90)
The turtle has advanced 140 units in our direction because a rectangle's length is 140 units.
As the angle between neighbouring sides is 90°, we then turned the turtle 90°. The
rectangle's one side is now complete. The turtle was then turned 90 degrees and advanced
70 units. The rectangle's second side is now complete.
1. ttl.forward(140)
2. ttl.left(90)
3. ttl.forward(70)
4. ttl.left(90)
To draw the final two sides, the same arguments are repeated once again in both directions.
Ultimately, completing the code to create a rectangle in Turtle Python.
Complete code :
Output :
Using a for loop for drawing is pretty much similar to how we used it for drawing a square.
In a for loop, we'll put forward(140), left(90), forward(70), and left(90) and execute it
twice.
Code :
Output :
Explanation :
In this program, instead of using the forward(140), left(90), forward(70) and left(90) ?
function two times, we used it only once but executed it two times by the help of a for
loop to get the same desired output as that in the previous program.
As the heading suggests, we will be drawing a square and a rectangle in one single program
altogether with the help of various functions of the turtle python library. The code for the
following is given below :
Code :
1. # Python programme for drawing a square and a rectangle together in # Turtle - Python
2. import turtle
3. ttl = turtle.Turtle()
4.
5. #SQUARE
6.
7. for j in range(4):
8. ttl.forward(60)
9. ttl.left(90)
10. ttl.up()
11. ttl.goto(80,0)
12. ttl.down()
13.
14. #RECTANGLE
15.
16. ttl.forward(120)
17. ttl.left(90)
18. ttl.forward(80)
19. ttl.left(90)
20. ttl.forward(120)
21. ttl.left(90)
22. ttl.forward(80)
23. ttl.left(90)
Output :
Explanation :
We first imported the turtle library to our program in the program above. Then we used a for
loop to draw a square first. The loop consisted of the forward(60) and left(90)
methods and executed four times to complete a square. Then we used the up() method to
lift up the turtle pen and moved the pen to the new coordinates using the method
goto(80,0). Then we used the down() method to use the turtle pen again. Next, we drew
a rectangle, using the methods forward(120) and left(90) to draw the first side of
rectangle and the methods forward(80) and left(90) to draw the second side of the
rectangle. We then repeated the last two steps to draw the remaining two sides of the
rectangle.
This lesson will teach us how to use a turtle in Python turtle library to draw a polygon.
We should know a little bit about polygons before continuing. A polygon is a type of
geometric figure that has two dimensions. It has a definite number of sides which are
joined together to form a polygonal shape.
Because the triangle is a plane figure, we named it a polygon. Similar to the triangle,
the circle does have a plane figure, but we don't refer to it as a polygon since it is curved
and lacks sides.
When everything is ready, we move on to the idea we'll use to use Turtle to create a polygon
of any shape. We must first determine a polygon's outer angle. If we are aware of
the polygon's number of sides, finding this is rather simple.
The exterior angle of a square is equal to 360/4 if the number of sides is 4 (i.e., a square).
Therefore, a square's outer angle is 90 degrees.
Moreover, all we have to do in this situation is ask a user for the total number of sides. To
determine a polygon's external angle, divide the total sides by 360 degrees. To draw the
necessary form, utilize the for loop, forward(), and right() functions from the Turtle
module. So lets get started.
This piece of python code is used in order to import the turtle library into our python
program.
Here, the user will have to input the "side" and "lngth". Where, side is the parameter for
the polygon's number of sides and lngth is the measure of each side of Polygon. These
values are necessary for drawing the Polygon.
1. for j in range(side):
2. tr.forward(lngth)
3. tr.right(360/side)
Here, we used a for loop, for drawing the Polygon based on the values provided by the user.
The for loop causes a certain set of instructions to run "side" times.
tr.forward(lngth) moves the turtle "lngth" pixels forward and draws them in the direction it
is facing. It then turns in position by 360/side degrees by calling tr.right(360/side). For
instance, it would rotate 90 degrees for a square. Hence, results in the Polygon being drawn.
Complete Code :
Output:
Most of the Matplotlib utilities lies under the pyplot submodule, and are usually imported
under the plt alias:
plt.plot(xpoints, ypoints)
plt.show()
Result:
Try it Yourself »
Python provides various options for developing graphical user interfaces (GUIs). Most
important are listed below.
• Tkinter − Tkinter is the Python interface to the Tk GUI toolkit shipped with Python.
We would look this option in this chapter.
• wxPython − This is an open-source Python interface for
wxWindows http://wxpython.org.
• JPython − JPython is a Python port for Java which gives Python scripts seamless
access to Java class libraries on the local machine http://www.jython.org.
There are many other interfaces available, which you can find them on the net.
Tkinter Programming
Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides
a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented
interface to the Tk GUI toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the
following steps −
• Import the Tkinter module.
• Create the GUI application main window.
• Add one or more of the above-mentioned widgets to the GUI application.
• Enter the main event loop to take action against each event triggered by the user.
Example
#!/usr/bin/python
import Tkinter
top = Tkinter.Tk()
# Code to add widgets will go here...
top.mainloop()
Kotlin libraries
provide interfaces that use language features like null safety, default and named arguments,
and DSL (Domain Specific Language).
Pygame
is a Python wrapper for the SDL library, which stands for Simple DirectMedia Layer. SDL
provides cross-platform access to your system's underlying multimedia hardware
components, such as sound, video, mouse, keyboard, and joystick. pygame started life as a
replacement for the stalled PySDL project.
www.ncmt.edu.pk
Prepared by
Engr.Nisar Ahmad
KP-BT&CE Peshawar.