Copa Notes
Copa Notes
Dr.V.Nagaradjane
Email: [email protected]
COPA 2 Dr.V.Nagaradjane
Dedicated to the fire of knowl-
edge which destroys the filth of ig-
norance.
COPA i Dr.V.Nagaradjane
Preface
This book covers the syllabus prescribed by the Directorate General
of Training (DGT) for the trade of Computer Operator and Program-
ming Assistant (COPA) vide its July 2022 revision. DGT is the apex
body for industrial training in India and functions under the Ministry
of Skill Development and Entrepreneurship (MSDE).
This syllabus has significant new additions to its content, in the
form of Python programming language and introductory level Java,
either of whih can be chosen as optional subject.
Python is an easy to use scripting language, which can be used
for developing desktop applications and web pages with server side
scripting. Main advantage of Python is that there is a huge wealth of
libraries available for many complex programming tasks. The knowl-
edge of Python introduced in this syllabus will help the students to
acquire more specialization in the language as and when required.
The optional portion of Java programming language is a strong
point of the syllabus. The portions provided in the syllabus cover
basic concepts of Java and help to program using core Java. The
concepts of Object Oriented Programming System introduced in this
book will help the students to learn any modern programming lan-
guage in the future. Students will it easy to learnin advanced level
Java programming with the help of the foundation provided herein.
The flow of the book follows the flow of the syllabus starting from
harware level and moving to productivity features like MS Office and
Open Office. HTML and Javascript were available in the syllabus for
a long time and continue to remain as its component. Javascript is
helpful for client side scripting. Nowadays, HTML/ Javascript have
become the tools for developing apps for Android and iOS devices.
May the students find this book useful for their preparation to
appear in their exams. In case of any suggestions, kindly write to:
[email protected].
COPA ii Dr.V.Nagaradjane
Contents
1 Basics of computer 1
1.1 Safe working practices . . . . . . . . . . . . . . . . 1
1.2 Safety Rules . . . . . . . . . . . . . . . . . . . . . 2
1.3 Job opportunities . . . . . . . . . . . . . . . . . . . 2
1.4 Safety symbols . . . . . . . . . . . . . . . . . . . . 4
1.5 Types of fire and extiguishers . . . . . . . . . . . . 4
1.6 Types of fire extinguisher . . . . . . . . . . . . . . 5
1.7 Components of computer . . . . . . . . . . . . . . 5
1.8 Concept of hardware and software . . . . . . . . . . 6
1.9 Computer hardware . . . . . . . . . . . . . . . . . 6
1.9.1 Central Processing Unit . . . . . . . . . . . 7
1.9.2 Input unit . . . . . . . . . . . . . . . . . . 18
1.9.3 Output unit . . . . . . . . . . . . . . . . . 19
1.10 Common terms related to computer hardware . . . . 22
1.11 Introduction to Windows Operating System . . . . . 26
1.12 Introduction to operating system . . . . . . . . . . 26
1.12.1 Popular Operating Systems in use . . . . . . 27
1.12.2 Main Features of Windows O.S. . . . . . . . 32
1.12.3 Shortcut keys in Windows . . . . . . . . . . 34
1.13 Booting process of computer . . . . . . . . . . . . 36
1.14 BIOS settings and their modification . . . . . . . . 37
1.15 Basic Hardware and software issues and their solutions 41
1.16 Usage of application software and antivirus . . . . . 42
1.17 Introduction to DOS . . . . . . . . . . . . . . . . . 43
1.17.1 Internal DOS commands . . . . . . . . . . . 45
1.17.2 External DOS commands . . . . . . . . . . 46
1.17.3 Output rediction in MS DOS . . . . . . . . 48
1.17.4 Special characters in MS DOS . . . . . . . . 48
iii
1.18 Open Source Software . . . . . . . . . . . . . . . . 48
1.19 Features of Linux OS . . . . . . . . . . . . . . . . 49
1.20 Basic Linux commands . . . . . . . . . . . . . . . . 50
1.20.1 Linux Shells . . . . . . . . . . . . . . . . . 50
1.20.2 Basic Linux shell commands . . . . . . . . . 55
1.20.3 Special characters in Linux shell . . . . . . . 58
2 Word Processing 59
2.1 Introduction to the various applications in office . . 59
2.2 Features of MS Word . . . . . . . . . . . . . . . . 59
2.3 Office button in MS Word . . . . . . . . . . . . . . 61
2.4 Toolbars in MS Word . . . . . . . . . . . . . . . . 62
2.4.1 Home menu in MS Word . . . . . . . . . . 63
2.4.2 Insert menu in MS Word . . . . . . . . . . . 64
2.4.3 Page Layout menu in MS Word . . . . . . . 65
2.4.4 References menu in MS Word . . . . . . . . 66
2.4.5 Mailings menu in MS Word . . . . . . . . . 68
2.4.6 Review menu in MS Word . . . . . . . . . . 69
2.4.7 View menu in MS Word . . . . . . . . . . . 70
2.5 Creating, saving and formatting documents using M.S.
Word . . . . . . . . . . . . . . . . . . . . . . . . . 71
2.6 Inserting objects in MS Word . . . . . . . . . . . . 73
2.7 Inserting macros in MS Word . . . . . . . . . . . . 74
2.8 Performing mail merge in MS Word . . . . . . . . . 75
2.9 Creating and using templates in MS Word . . . . . 76
2.10 Page setup and printing documents using Word . . . 76
3 MS Excel 79
3.1 Introduction to Excel features and Data Types . . . 79
3.1.1 Introduction to features of Excel . . . . . . 79
3.2 Data types in Excel . . . . . . . . . . . . . . . . . 81
3.3 Cell referencing . . . . . . . . . . . . . . . . . . . . 81
3.4 Use of functions of various categories . . . . . . . . 83
3.4.1 Date functions . . . . . . . . . . . . . . . . 84
3.4.2 Engineering functions . . . . . . . . . . . . 87
3.4.3 Cell functions . . . . . . . . . . . . . . . . 88
3.4.4 Cell functions . . . . . . . . . . . . . . . . 89
3.4.5 Logical functions . . . . . . . . . . . . . . . 89
COPA iv Dr.V.Nagaradjane
3.4.6 Math functions . . . . . . . . . . . . . . . . 90
3.4.7 Statistical functions . . . . . . . . . . . . . 95
3.4.8 Text functions . . . . . . . . . . . . . . . . 97
3.5 Sorting in MS Excel . . . . . . . . . . . . . . . . . 98
3.6 Filtering of data in MS Excel . . . . . . . . . . . . 99
3.7 Validation of data in MS Excel . . . . . . . . . . . 99
3.8 Analyzing data using charts in MS Excel . . . . . . 100
3.9 Data tables in MS Excel . . . . . . . . . . . . . . . 100
3.10 Pivot table in MS Excel . . . . . . . . . . . . . . . 101
3.11 Goal seek in MS Excel . . . . . . . . . . . . . . . . 101
3.12 Scenarios in MS Excel . . . . . . . . . . . . . . . . 102
COPA v Dr.V.Nagaradjane
5.6 Key terms related to RDBMS . . . . . . . . . . . . 124
5.7 Data Base Administrator (DBA) . . . . . . . . . . . 125
5.8 Data Base user . . . . . . . . . . . . . . . . . . . . 126
5.9 Schema . . . . . . . . . . . . . . . . . . . . . . . . 127
5.10 Rules for designing good tables . . . . . . . . . . . 127
5.11 Normalization of tables . . . . . . . . . . . . . . . 128
5.12 Integrity rules and constraints in a table . . . . . . . 129
5.13 Relationships in tables . . . . . . . . . . . . . . . . 129
5.14 Data types in MySQL . . . . . . . . . . . . . . . . 129
5.14.1 String datatypes . . . . . . . . . . . . . . . 129
5.14.2 Numeric datatypes . . . . . . . . . . . . . . 131
5.14.3 Date and Time datatypes . . . . . . . . . . 131
5.15 Queries and their uses . . . . . . . . . . . . . . . . 132
5.16 Enforcing Primary key and foreign key . . . . . . . . 134
5.17 Adding Indices . . . . . . . . . . . . . . . . . . . . 135
5.18 Concepts of Transactions . . . . . . . . . . . . . . 135
5.19 ACID Property of Transaction . . . . . . . . . . . . 136
5.20 Constraints . . . . . . . . . . . . . . . . . . . . . . 136
5.21 Joining of tables . . . . . . . . . . . . . . . . . . . 137
5.22 Sub Queries . . . . . . . . . . . . . . . . . . . . . 138
5.23 Aggregate functions in MySQL . . . . . . . . . . . 139
COPA vi Dr.V.Nagaradjane
6.9 Internet . . . . . . . . . . . . . . . . . . . . . . . . 154
6.10 Introduction to WWW . . . . . . . . . . . . . . . . 155
6.11 Web browser . . . . . . . . . . . . . . . . . . . . . 155
6.12 Internet server and search engine . . . . . . . . . . 156
6.13 Domain Name System (DNS) . . . . . . . . . . . . 156
6.14 Email . . . . . . . . . . . . . . . . . . . . . . . . . 157
6.15 Video chat tool . . . . . . . . . . . . . . . . . . . . 158
6.16 Voice Over IP (VOIP) . . . . . . . . . . . . . . . . 158
6.17 Social media networking . . . . . . . . . . . . . . . 159
8 Javascript 179
8.1 Algorithms . . . . . . . . . . . . . . . . . . . . . . 179
8.2 Flowcharts . . . . . . . . . . . . . . . . . . . . . . 180
10 E-Commerce 227
10.1 Definition of E-Commerce . . . . . . . . . . . . . . 227
10.1.1 Types of e-commerce . . . . . . . . . . . . 227
10.2 Scope of e-commerce platform . . . . . . . . . . . 228
10.3 Benefits of e-commerce . . . . . . . . . . . . . . . 228
10.4 Disadvantages of e-commerce . . . . . . . . . . . . 229
10.5 De-Commerce vs. traditional commerce . . . . . . . 229
10.6 Capabilities for e-commerce . . . . . . . . . . . . . 229
10.7 Technology issues . . . . . . . . . . . . . . . . . . 229
10.8 Types of E-Commerce web sites . . . . . . . . . . . 231
10.9 Building business on the net . . . . . . . . . . . . . 231
10.10Online catelogue . . . . . . . . . . . . . . . . . . . 232
10.11Shopping cart . . . . . . . . . . . . . . . . . . . . 232
10.12Checkout pages . . . . . . . . . . . . . . . . . . . 232
10.13Payment for e-commerce transaction . . . . . . . . 232
10.14Security issues for online payment . . . . . . . . . . 233
10.15Payment gateway . . . . . . . . . . . . . . . . . . 234
COPA ix Dr.V.Nagaradjane
11.5 Risk management . . . . . . . . . . . . . . . . . . 237
11.6 Introduction to Directory Services . . . . . . . . . . 237
11.7 Access control . . . . . . . . . . . . . . . . . . . . 238
11.8 Software development security . . . . . . . . . . . . 238
11.9 Privacy protection . . . . . . . . . . . . . . . . . . 239
11.10Information security audit . . . . . . . . . . . . . . 239
11.11Introduction to I.T. Act . . . . . . . . . . . . . . . 240
11.12Penalties for cybercrimes . . . . . . . . . . . . . . . 240
COPA x Dr.V.Nagaradjane
13.15Strings in Python . . . . . . . . . . . . . . . . . . 260
13.16Lists in Python . . . . . . . . . . . . . . . . . . . . 261
13.17Tuples in Python . . . . . . . . . . . . . . . . . . . 261
13.18Dictionaries in Python . . . . . . . . . . . . . . . . 262
13.19Arrays in Python . . . . . . . . . . . . . . . . . . . 262
13.20Iterators in Python . . . . . . . . . . . . . . . . . . 263
13.21Datetime module in Python . . . . . . . . . . . . . 263
13.22Math module in Python . . . . . . . . . . . . . . . 263
13.23Input and Output in Python . . . . . . . . . . . . . 264
COPA xi Dr.V.Nagaradjane
14.11.2 Do - while loop . . . . . . . . . . . . . . . 285
14.11.3 For loop . . . . . . . . . . . . . . . . . . . 286
14.12Number and Character class . . . . . . . . . . . . . 287
14.13String class . . . . . . . . . . . . . . . . . . . . . . 288
14.14Arrays in Java . . . . . . . . . . . . . . . . . . . . 288
14.15Working with objects, methods and properties . . . 290
14.15.1 Class, constructor, properties and methods . 291
14.16Inheritance . . . . . . . . . . . . . . . . . . . . . . 293
14.16.1 Book class . . . . . . . . . . . . . . . . . . 293
14.17Abstract class in Java . . . . . . . . . . . . . . . . 294
14.17.1 FinishedBook - abstract class . . . . . . . . 295
14.17.2 BoundBook extends FinishedBook class . . . 295
14.18Interfaces in Java . . . . . . . . . . . . . . . . . . 296
14.18.1 Student Interface . . . . . . . . . . . . . . 297
14.19Polymorphism in Java . . . . . . . . . . . . . . . . 299
14.19.1 Polymorphism - Rectangle and Oval classes . 299
14.20Packages in Java . . . . . . . . . . . . . . . . . . . 300
14.20.1 Package org.copa . . . . . . . . . . . . . . 301
14.20.2 Accessing the package org.copa . . . . . . . 302
xiii
13.6 List Membership operators in Python . . . . . . . . 257
13.7 Bitwise operators in Python . . . . . . . . . . . . . 257
xv
1.29 BIOS - Security settings . . . . . . . . . . . . . . . 40
1.30 Message for booting from CD . . . . . . . . . . . . 41
1.31 Application list in GNOME . . . . . . . . . . . . . 50
1.32 Firefox browser . . . . . . . . . . . . . . . . . . . . 51
1.33 Settings app . . . . . . . . . . . . . . . . . . . . . 51
1.34 LibreOffice Writer . . . . . . . . . . . . . . . . . . 52
1.35 LibreOffice Calc . . . . . . . . . . . . . . . . . . . 52
1.36 GNU Image Manipulation Program (GIMP) . . . . . 53
1.37 Files app . . . . . . . . . . . . . . . . . . . . . . . 53
Basics of computer
Syllabus
Safe working practices, Scope of the COPA trade, Safety rules
and safety signs, Types and working of fire extinguishers, In-
troduction to Computer components
1
Figure 1.1: Safe working practices[1]
COPA 2 Dr.V.Nagaradjane
Figure 1.2: Rules to be followed in computer lab[2]
COPA 3 Dr.V.Nagaradjane
Figure 1.3: Safety symbols)[?]
COPA 4 Dr.V.Nagaradjane
Figure 1.4: Fire extinguishers)[18]
• Type F fire: Type F fire is caused by edible oils and fat. Wet
chemical extinguishers are suitable for type F fire.
COPA 5 Dr.V.Nagaradjane
Figure 1.5: Components of computer[4]
COPA 6 Dr.V.Nagaradjane
Table 1.1: Hardware & software
Sl. No. Hardware Software
1 Physically accessible Physically inaccessible
Cannot be touched,
Can be touched, when
2 whether power on or power
power is off
off
Causes other components
to consume power to make
3 Consumes lot of power
them work. It does not con-
sume any power.
Does not occupy visible
4 Occupies space
space
Its existence is inferred
5 Directly verifiable through the working of
hardware
following 3 units:
1. Microprocessor.
COPA 7 Dr.V.Nagaradjane
2. Main Memory or Primary Storage or Random Access Mem-
ory.
3. Mother board.
4. Secondary Storage or Auxiliary Storage (Hard disk, optical
(CD/DVD) drive, floppy drive (obsolete).)
5. Switch Mode Power Supply (SMPS).
6. Connectors for storage and power controls.
7. Ports for connecting other devices.
Microprocessor
• Microprocessor is the chip that performs arithmetic and logical
operations based on given input data and instructions and sends
out the results of such processing operation.
COPA 8 Dr.V.Nagaradjane
(a) 8086 Processor[49] (b) 486 Processor[50]
• Main memory does not retain any data. It looses data when a
program exits or when the computer is rebooted. Hence, it is
called Volatile storage - the storage that evaporates.
COPA 9 Dr.V.Nagaradjane
(a) Pentium 4 (b) Core 2 Duo (c) Core i3
Processor[51] Processor[52] Processor[53]
COPA 10 Dr.V.Nagaradjane
3. FPM DRAM: Fast Page Mode Dynamic Random Access
Memory
4. EDO DRAM: Extended Data Out Dynamic Random Ac-
cess Memory
5. SDRAM: Synchronous Dynamic Random Access Mem-
ory
6. DDR SDRAM: Double Data Rate Synchronous Dynamic
Random Access Memory
7. RDRAM: Rambus Random Access Memory
8. VRAM: Video Random Access Memory
9. MPDRAM: Multi-Port Dynamic Random Access Mem-
ory
10. SGRAM: Synchronous Graphics Random Access Mem-
ory
Mother board
• The board containing the electronic components needed for
supporting the micro-processor (µP ), RAM and other compo-
nents is called the mother board.
COPA 11 Dr.V.Nagaradjane
Figure 1.9: Motherboard[59]
• Hard disk, CD/ DVD drive, floppy drive, etc. are some of the
secondary storage units.
COPA 12 Dr.V.Nagaradjane
• Compact Disk (CD) or Digital Versatile Disk (DVD) drive uses
LASER beam of low strength for reading and high strength for
writing data.
COPA 13 Dr.V.Nagaradjane
Table 1.2: Memory sizes
Sl. No. Storage name Storage size Remarks
1 Bit 1 bit 0 or 1
2 Nibble 4 bits
3 Byte 8 bits
4 kilo Byte (kB) 1024 bytes 210 bytes
5 Mega Byte (MB) 1024 kilo bytes 220 bytes
6 Giga Byte (GB) 1024 mega bytes 230 bytes
7 Tera Byte (TB) 1024 Giga bytes 240 bytes
8 Peta Byte (PB) 1024 Tera bytes 250 bytes
9 Exa Byte (EB) 1024 Peta bytes 260 bytes
COPA 14 Dr.V.Nagaradjane
(a) Hard drive[60] (b) CD/DVD (c) Floppy (d) Pen drive[63]
drive[61] drive[62]
(e) Solid State (f) Solid State (g) SD, Mini SD and Micro-SD
Drive (SSD) Drive (SSD) cards[64]
SATA[16] NVMe M.2[16]
• Pen Drive: Pen Drive (Fig.??) has USB interface and stores
data in solid state memory locations. Typical pen drive has
16GB to 512GB of storage.
COPA 15 Dr.V.Nagaradjane
Figure 1.11: Switch Mode Power Supply (SMPS)
CPU ports
• Ports are located at the rear panel of CPU.
COPA 16 Dr.V.Nagaradjane
Figure 1.12: Ports in CPU
• Some of the most common ports are: (i) PS/2 (Personal Sys-
tem 2) ports for keyboard and mouse; (ii) RS-232 (Recom-
mended Standard 232)/ Serial port for mouse, modem and
other serial devices; (iii) VGA (Video Graphics Array) port for
connecting monitor or projector; (iv) Ethernet / RJ-45 (Regis-
tered Jack 45) for broadband connection; (v) USB (Universal
Serial Bus) port for connecting printer, fax, pen drive, external
hard disk, external DVD writer, web camera, etc.; (vi) LPT
(Line Printer Terminal) port for connecting old style dot ma-
trix/ line printers; (vii) 3.5mm audio jack for speaker output/
mic input; (viii) Game port - port for connecting joystick.
COPA 17 Dr.V.Nagaradjane
Figure 1.13: Keyboard [31]
COPA 18 Dr.V.Nagaradjane
(a) Scanner[33] (b) Tablet[34] (c) Light pen[35]
5) Light pen - The device has a light sensitive tip which converts
traces the features of display on CRT monitor and converts it
to a new digital image.
COPA 19 Dr.V.Nagaradjane
(a) CRT[36] (b) LCD[38]
COPA 20 Dr.V.Nagaradjane
W
COPA 21 Dr.V.Nagaradjane
paper. Dot matrix printer, line printer, chain printer, golf
ball printer, daisy wheel printer, etc. are examples of
impact printers.
2. Non-impact type printers: Non-impact type printers
do not physically hit the shapes and characters on the
paper. Some of the most common types of non-impact
printer are:
(i) Inkjet printer: Inkjet printer uses ink cartridges and
print head. The head spits ink in desired pattern to
produced characters and shapes.
(ii) LASER printer: Laser printer uses heat generated
by LASER beam to create shapes/ characters and
make the toner powder to stick to the paper
(iii) Thermal printer: Thermal printer creates desired
shapes and characters using heating filament on a
special paper coated with BisPhenol A (BPA). It is
used in ATM machines, ticketing machines, point of
sale terminals, etc.
(iv) Plotter: Plotter is a large printer (usually non-impact
type) used to produce large size drawings on paper.
COPA 22 Dr.V.Nagaradjane
(a) DOT matrix printer[40] (b) Line printer[41]
COPA 23 Dr.V.Nagaradjane
(a) Inkjet printer[45] (b) LASER printer[46]
COPA 24 Dr.V.Nagaradjane
7) RJ-45: Registered Jack 45. Other names: Ethernet port or
LAN Port. LAN stands for Local Area Network. Used for
broadband connection.
COPA 25 Dr.V.Nagaradjane
1.11 Introduction to Windows Operating
System
• Computer software decides how the hardware works.
• Software is the reason why computers can produce output
based on given input.
• Software can be divided into 2 essential categories:
1. System software: The software needed for by the com-
puter to support other software and hardware components
is called the system software. The Basic Input Output
System (BIOS), the Operating System (Windows, Unix,
Linux, Mac OS, etc.) and device drivers are the major
system software. System software does not directly carry
out any productive work (like document editing). It helps
other software packages to work and produce desired out-
put through available hardware.
2. Application software: Application software helps in pro-
ductive working of computer like creating documents,
spreadsheets, playing music/video, managing databases,
etc.. It does not worry about booting the computer or
controlling the hardware (these works are relegated to
the system software).
COPA 26 Dr.V.Nagaradjane
4) Operating system allots, manages and frees memory needed
for other processes.
Microsoft Windows
• Microsoft Disk Operating System (MSDOS) released in 1981.
Development of MS DOS was stopped in the year 2000.
• MS DOS based Windows 1.0 was released by Microsoft in 1985.
After Windows 3.1, subsequent releases were named Windows
95, Windows 98, Windows Me. The MSDOS based Windows
were discontinued.
COPA 27 Dr.V.Nagaradjane
Figure 1.19: Windows 11 [5]
Mac OS
• Apple computers released the first version of GUI based Mac
OS in the year 1984.
Linux
• Linux was developed by Linus Torvalds in the year 1991.
COPA 28 Dr.V.Nagaradjane
(a) Windows 10[?] (b) Win-
dows 10
Mobile[69]
COPA 29 Dr.V.Nagaradjane
(a) GNOME on Linux[67]
COPA 30 Dr.V.Nagaradjane
Figure 1.24: Common Desktop Environment (CDE) on UNIX
UNIX
• UNIX was one of the first operating systems to support multi-
tasking and multiple user logins.
• UNIX still remains the gold standard for any operating system.
COPA 31 Dr.V.Nagaradjane
• Windows 3.1, Windows 95, Windows 98, Windows Me, Win-
dows NT, Windows 2000, Windows 2003, Windows XP and
Windows 7 and Windows 8 are some of the obsolete versions
of Windows operating system.
5) Quick launch icons are provided near the start button. They
offer shortcuts to frequently used programs.
COPA 32 Dr.V.Nagaradjane
icon. The system tray is a quintessential control panel for
background programs.
7) Clicking any icon in the desktop area or quick launch bar opens
the corresponding application.
• To rename a file, right click on the file (or select the file and
press F2). The name file becomes editable.
• To copy a file, right click and choose copy (or press Ctrl +
C). Press Ctrl + V at the new destination where a copy of the
original file is needed.
• To cut a file (make a copy file and remove the original file),
right click and choose cut (or press Ctrl + X). Press Ctrl +
V at the new destination where a copy of the original file is
needed. After copying, the original file will be deleted.
COPA 33 Dr.V.Nagaradjane
• To open a document, spreadsheet, music file, video file or any
other file having a known support application (like MS Word,
Excel, Windows Media Play/VLC), simply open the file by dou-
ble clicking (or single click if enabled).
• Large files can be compressed into smaller size with the help
of zipping. WinRAR provides support for splitting a file into
chunks (which can be combined at a new location) of specified
size (to fit a CD/DVD).
• F2 - Rename.
COPA 34 Dr.V.Nagaradjane
• Windows + D - Show desktop.
COPA 35 Dr.V.Nagaradjane
• Ctrl + C - Copy a file.
• When the computer boots, the BIOS (Basic Input Output Sys-
tem) activates a series of hardware checkes called Power On
Self Test (POST).
• The BIOS reads essential settings like date, time and boot
device order, as customized by the user, from the CMOS.
• The boot loaded initially loads from a chip and is called Pri-
mary Boot Loader. The primary boot loader then calls a more
elaborate boot loader program called Secondary Boot Loader.
COPA 36 Dr.V.Nagaradjane
• The secondary boot loader is normally stored in Master Boot
Record (MBR). GNU GRUB, BOOTMGR, NTLDR, UEFI (Uni-
fied Extensible Firmware Interface) or ESP (EFI system parti-
tion).)
• The secondary boot loader, loads the operating system. When
the operating system finishes loading, booting is complete and
the computer is ready for usage.
• The computer beeps when the POST routines are successfully
completed. It beeps and error message if there is some failure
of POST.
COPA 37 Dr.V.Nagaradjane
Figure 1.25: Message to access BIOS settings
COPA 38 Dr.V.Nagaradjane
Figure 1.26: BIOS - Main settings
COPA 39 Dr.V.Nagaradjane
Figure 1.28: BIOS - Boot settings
COPA 40 Dr.V.Nagaradjane
Figure 1.30: Message for booting from CD
COPA 41 Dr.V.Nagaradjane
6) Insert boot media error: Open BIOS settings. Arrange boot
devices in right order. Reboot. If problem persists, see whether
the required media is listed in the BIOS. Boot from alternate
media (like CD, DVD or pen drive) to check whether the PC
can boot at all.
7) Boot halted due to wrong settings: Press Del or F2 or
enlisted key to access BIOS. Set correct date and time.
8) PC does not switch on: Check power cables. Check SMPS.
9) BIOS settings are lost after each poweroff: Replace CMOS
battery (CR2032).
10) Printers do not work: Open control panel. Go to services.
Click on Print Spooler service. If it is not running (most prob-
able), start the service.
11) PC Reboots while working: Try another RAM. If problem
persists, try another SMPS. Check all IDE/ SATA cables. Rein-
sert all power cables.
12) Internet connection is slow: See whether Windows is auto-
matically downloading updates. Pause the updates and check
connection speed (Automatic updates may be disabled using
control panel).
13) Cannot install new program: Right click on setup file and
choose Run as administrator. If it does not solve the problem,
choose compatible installer (32 bit or 64 bit) for the operating
system.
14) Paper jam error: Switch off printer. Remove top cover. Re-
move jammed paper. Power on the printer and check whether
it works.
COPA 42 Dr.V.Nagaradjane
• Microsoft Office is one of the most popular appication software
packages.
• Some free antivirus packages like Avast, Avira, AVG (free ver-
sion), Malwarebytes, etc. are also available.
COPA 43 Dr.V.Nagaradjane
• MS DOS applications had either .COM extension or .EXE ex-
tension.
COPA 44 Dr.V.Nagaradjane
1.17.1 Internal DOS commands
COPA 45 Dr.V.Nagaradjane
1.17.2 External DOS commands
COPA 46 Dr.V.Nagaradjane
Create backup file named MIR-
ROR.FIL at root directory to re-
23 MIRROR
store lost information, if any, at a
later date.
Show given information in small
chunks for easy reading. Press-
ing a key moves forward. Press-
24 MORE
ing < space > shows next page,
< enter > shows next line, =
shows line number, Q quits.
Create a new file having contents
25 MOVE of the old file, but delete the old
file.
26 PRINT Send given file to the printer.
Check and correct errors in the file
27 SCANDISK system of given drive. Works sim-
ilar to CHKDSK command.
Sort given input lines in alphabetic
28 SORT order. /R option sorts in reverse
order (Z to A or 9 to 0).
Make given disk bootable. It
29 SYS
should be issued from C: drive.
Display files and directories in tree
30 TREE
structure.
31 UNDELETE Restore recently deleted file.
Extended copy mode for copy-
32 XCOPY ing directories, subdirectories and
files.
COPA 47 Dr.V.Nagaradjane
1.17.3 Output rediction in MS DOS
Write the output of the left
side program to the file pro-
vided on the right side. If
1 > the file does not exist, it
is created. If the file al-
ready exists, its contents
are deleted.
Write the ouput of the pro-
gram on the left side to the
file indicated on the right.
2 >> If the file does not exist, it
is created. If it exists, new
content is appended to the
end of file.
Pipe symbol. Pass the out-
put of the program on the
3 |
left to that on the right of
the pipe.
COPA 48 Dr.V.Nagaradjane
(a) Richard Stallman (b) Linus Torvalds
COPA 49 Dr.V.Nagaradjane
Figure 1.31: Application list in GNOME
• File app, disks app and startup disk creator are suitable man-
aging files.
• Linux commands may also be typed inside a text file and used
as a new command. Such text file is called shell script.
COPA 50 Dr.V.Nagaradjane
Figure 1.32: Firefox browser
COPA 51 Dr.V.Nagaradjane
Figure 1.34: LibreOffice Writer
COPA 52 Dr.V.Nagaradjane
Figure 1.36: GNU Image Manipulation Program (GIMP)
COPA 53 Dr.V.Nagaradjane
• Several shells are available for interaction with the Linux kernel.
Some of the most common shells are: (i)sh - Bourne Again
Shell or bash, #/bin/sh at the beginning of shell script denotes
bash script. (ii)csh - C shell. It supports conditions and loops
features similar to C programming language. (iii)ksh - Korn
Shell. Korn shell was released as an improvement to the Bourne
shell by AT&T Bell Labs.
COPA 54 Dr.V.Nagaradjane
1.20.2 Basic Linux shell commands
COPA 55 Dr.V.Nagaradjane
26 rm Remove a file.
27 cat display contents of a file on screen.
28 cat - > Store keyboard input to a new file.
Append keyboard input to given
29 cat - >>
file.
Display and set current date and
30 date
time.
Display time taken for processing
31 time
a program.
32 ed Single line editor.
33 cc Run C-language compiler.
34 vi Open VI text editor.
35 emacs Open emacs text editor.
36 gedit Open gedit text editor.
37 useradd Create new user.
38 userdel Deletes given user name.
39 passwd Changes password.
40 su Increase previleges to super user.
41 sudo Run given command as super user.
42 cal Display calendar.
43 calc/ bc Calculator.
44 cron Run given programs as per schedule.
45 awk Interpreted language and a filter.
46 sed Stream editor and filter.
47 which Find full path of given command.
48 file Display file type of the argument.
COPA 56 Dr.V.Nagaradjane
Substotute given character in
49 tr
place of unwanted one.
50 chown Change ownership of file.
Change file access mode for owner,
51 chmod group and world. 1-read, 2 - write,.
4 - execute.
52 groupadd Create a new group.
53 groupdel Delete a group.
54 grep Catch lines with given text.
Test file for read, write or execute
55 test
permissions.
If condition is true, then part is ex-
56 if ecuted. else and elif are supported.
fi is the end of if.
57 while Run the loop if given condition is true.
58 for Run given loop with stated arguments.
59 tree Display tree structure of files system.
60 c++ Run C + + language compiler.
Place the variable, value pair in the
61 export
shell environment.
62 clear Clear contents of the screen.
63 ps Display list of running processes.
Kill/ terminate process with given
64 kill
process ID.
COPA 57 Dr.V.Nagaradjane
1.20.3 Special characters in Linux shell
1 # What follows ’#’ character is comment.
2 * The wild card. Matches any number of letters.
3 ? Match any single character.
Send output to a new file. Delete
4 >
contents if file already exists.
5 >> Append the output of program to given file.
Send output of the left side pro-
6 | gram to the input of the right side
program.
7 $? Exit code of previous process. 0 denotes success.
8 & Run process to the left of & in the background.
9 - Denotes standard input (keyboard).
10 ˜ Home directory.
11 [[ ]] Test condition.
12 ! Negation of condition.
Run right side program only if the
13 &&
left side program succeeds.
Run right side program only if the
14 ||
left side program fails.
COPA 58 Dr.V.Nagaradjane
Chapter 2
Word Processing
Syllabus
Introduction to the various applications in office. Introduction
to Word features, office button, toolbars. Creating, saving and
formatting and printing documents using Word. Working with
inserting objects, macro, mail merge, templates and other tools
in Word. Page setup and printing documents using Word.
59
Table 2.1: Tools in MS Office
Sl. Name Description
No. of tool /purpose
Helps preparation of docu-
1 Word
ments.
Preparation of spread-
2 Excel
sheets.
Preparation of presenta-
3 Powerpoint
tions.
Creation and maintenance
4 Access
of databases.
Tool for creating page
based publications. Useful
5 Publisher
for creation of reports, ban-
ners, ID cards, etc.
The program for creating
6 Onenote
and sharing notes.
Email client. It fetches
7 Outlook emails from several servers.
It can also send emails.
• MS Word can take list from Excel or Access and create mail
merged document addressed to several persons individually.
COPA 60 Dr.V.Nagaradjane
2.3 Office button in MS Word
• The circular button located at top left corner of MS Word
window is the office button. In recent versions, office button
has been renamed to File ((Alt + F)).
COPA 61 Dr.V.Nagaradjane
Figure 2.1: Office menu in MS Word
1. Home (Alt + H)
2. Insert (Alt + N)
3. Page Layout (Alt + P)
4. References (Alt + S)
5. Mailing (Alt + M)
6. Review (Alt + R)
7. View (Alt + W)
COPA 62 Dr.V.Nagaradjane
Figure 2.2: Home menu in MS Word
COPA 63 Dr.V.Nagaradjane
Figure 2.3: Insert menu in MS Word
COPA 64 Dr.V.Nagaradjane
• Insert menu (Alt + N) contains items insertion of items like
pages, tables and images, as detailed below (Fig.2.4.2):
COPA 65 Dr.V.Nagaradjane
Figure 2.4: Page Layout menu in MS Word
COPA 66 Dr.V.Nagaradjane
Figure 2.5: References menu in MS Word
Word.
COPA 67 Dr.V.Nagaradjane
Figure 2.6: Mailings menu in MS Word
COPA 68 Dr.V.Nagaradjane
Figure 2.7: Review menu in MS Word
COPA 69 Dr.V.Nagaradjane
• Review (Alt + R) menu (Fig.2.4.6) helps to check spelling,
grammer and document statistics. It contains the following
options:
COPA 70 Dr.V.Nagaradjane
Figure 2.8: View menu in MS Word
COPA 71 Dr.V.Nagaradjane
• After opening a document, it is necessary to set paper size,
paper orientation (landscape or portrait) and margins on all
four sides, before entering text. These settings can be accessed
from Page Layout − > Page Setup (Alt + P + SP) menu.
• Line spacing should be set through Page Layout − > Paragraph
(Alt + P + PG) menu.
COPA 72 Dr.V.Nagaradjane
2.6 Inserting objects in MS Word
• The most common objects used in MS Word are: (i)table,
(ii)picture, (iii)geometric shapes, (iv)clip arts, (v)equations,
(vi)lists.
• Geometric shapes like line, circle, rectangle, text box, clip art,
word art, flow chart symbols, etc. can be inserted from Insert
menu.
• To insert predefined art works, choose Insert − > Clip Art (Alt
+ N + F) menu. This permits several simple artworks to be
inserted in a document.
• Word art provides attractive size and shape for text headings.
To insert word art, click Insert − > Word Art (Alt + N +
RC) menu.
COPA 73 Dr.V.Nagaradjane
the list. Although MS Word automatically inserts successive
numbers for list, specific values may be set by right clicking the
unwanted number and choosing Numbering − > Set Number-
ing Value and typing required number in the number field.
COPA 74 Dr.V.Nagaradjane
• Now, you can press the macro button placed at the title bar or
type required keystroke to invoke the macro and get your work
done.
COPA 75 Dr.V.Nagaradjane
• The mail merge results may be printed using Mailings − >
Print Documents (Alt + F + P). Record range may be chosen
for finishing the mail merge to printer.
COPA 76 Dr.V.Nagaradjane
• Page setup brings a dialog containing 3 panels, viz., Margins,
Paper & Layout.
COPA 77 Dr.V.Nagaradjane
COPA 78 Dr.V.Nagaradjane
Chapter 3
MS Excel
Syllabus
Introduction to Excel features and Data Types. Cell referenc-
ing. Use of functions of various categories, linking Sheets. In-
troduction to various functions in all categories of Excel. Con-
cepts of Sorting, Filtering and Validating Data. Analyzing data
using charts, data tables, pivot tables, goal seek and scenarios.
Introduction to Reporting.
79
• Excel has a large collection of functions (entered in a cell after
typing = sign), which are helpful in data analysis and compu-
tations.
• Excel can draw charts (like pie, bar, column, scatter, etc.) to
help visualize data entered in cells.
COPA 80 Dr.V.Nagaradjane
3.2 Data types in Excel
• Following types of data are available in MS Excel:
11) Special - Special type is useful for tracking list and database
values.
COPA 81 Dr.V.Nagaradjane
1. Relative referencing - dynamic row & column change mode
2. Semi-relative referencing - fynamic row & static column
mode or static row and dynamic column mode
3. Absolute referencing - static row & static column mode
• Relative referencing: In this mode, copying the formula to a
new cell (e.g., add 4 to columns & 3 to rows) causes the cell
reference to change relative to the new column (by adding the
same 4 to columns & 3 to rows to the reference made in the
formula).
• Semi-relative referencing: In this mode, either the row or col-
umn references are static, denoted by a $ symbol preceding the
row number or column name.
• Absolute referencing: In this mode, both column name and row
number are static and are preceded by a $ symbol. When the
formula is copied from one cell to another, the cell references
do not change.
a) Relative referencing: The formula = D3 + E3 is entered in
cell F3. On copying the formula to cell K4, the copied formula
becomes = I4 + J4, which references cells in relation to the
cell containing the formula.
b) Semi-relative referencing: The formula = $D3 + $E3 is en-
tered in cell F3. On copying the formula to cell K4, the copied
formula becomes = $D4 + $E4, which references rows in rela-
tion to the cell containing the formula, but freezes any changes
to the column name.
c) Semi-Relative referencing: The formula = D$3 + E$3 is en-
tered in cell F3. On copying the formula to cell K4, the copied
formula becomes = I3+J3, which references columns in rela-
tion to the cell containing the formula, but freezes any changes
to the row number.
d) Absolute referencing: The formula = $D$3 + $E$3 is entered
in cell F3. On copying the formula to cell K4, the copied
formula becomes = $D$3 + $E$3. Absolute system freezes all
cell references.
COPA 82 Dr.V.Nagaradjane
3.4 Use of functions of various categories
• Cube functions: These functions look up and analyze data
from a multi-dimensional database stored in a spreadsheet.
COPA 83 Dr.V.Nagaradjane
3.4.1 Date functions
COPA 84 Dr.V.Nagaradjane
Returns the date last day of month
given a start date and number of
8 EOMONTH months. Takes date as first argu-
ment, number of months as the
second argument.
Converts a serial number to an
9 HOUR
hour.
Returns the number of the ISO
10 ISOWEEKNUM week number of the year for a
given date.
Converts a serial number to a
11 MINUTE
minute.
Converts a serial number to a
12 MONTH
month
Returns the number of whole
13 NETWORKDAYS
workdays between two dates.
Returns the number of whole
workdays between two dates using
14 NETWORKDAYS.INTL
parameters to indicate which and
how many days are weekend days.
Returns the serial number of the
15 NOW
current date and time.
Converts a serial number to a sec-
16 SECOND
ond.
Returns the serial number of a par-
17 TIME
ticular time.
COPA 85 Dr.V.Nagaradjane
Converts a time in the form of text
18 TIMEVALUE
to a serial number.
Returns the serial number of to-
19 TODAY
day’s date.
Converts a serial number to a day
20 WEEKDAY
of the week.
Converts a serial number to a
21 WEEKNUM number representing where the
week falls numerically with a year.
Returns the serial number of the
22 WORKDAY date before or after a specified
number of workdays.
Returns the serial number of the
date before or after a specified
WORKDAY.
23 number of workdays using param-
INTL
eters to indicate which and how
many days are weekend days.
24 YEAR Converts a serial number to a year.
Returns the year fraction repre-
25 YEARFRAC senting the number of whole days
between start date and end date.
COPA 86 Dr.V.Nagaradjane
3.4.2 Engineering functions
COPA 87 Dr.V.Nagaradjane
Converts hexadecimal number to
15 HEX2DEC
decimal number.
Converts hexadecimal number to
16 HEX2OCT
octal number.
Creates a complex number from
17 COMPLEX
real and imaginary parts.
Displays the absolute value of
18 IMABS
complex function.
Returns imaginary part of complex
19 IMAGINARY
number.
Returns real part of complex num-
20 IMREAL
ber.
Returns conjugate of a complex
21 IMREAL
number.
Converts octal number to binary
22 OCT2BIN
number.
Converts octal number to decimal
23 OCT2DEC
number.
Converts octal number to hex-
24 OCT2HEX
adecimal number.
COPA 88 Dr.V.Nagaradjane
3.4.4 Cell functions
COPA 89 Dr.V.Nagaradjane
3.4.6 Math functions
COPA 90 Dr.V.Nagaradjane
Converts Roman numberal to Ara-
8 ARABIC
bic numeral.
9 ASINH Returns inverse of hyperbolic sin.
Returns inverse of hyperbolic tan-
10 ATANH
gent.
Returns an integer just above the
11 CEILING given fractional number. e.g.
=CEIL(2.1) returns 3.
Returns an integer just below the
12 FLOOR given fractional number. e.g.
=FLOOR(2.99) returns 2.
Rounds a number to given number
of digits. e.g. =ROUND(2.99,1)
returns 3.0, =ROUND(2.629,2)
13 ROUND
returns 2.63, =ROUND(2.5,0) re-
turns 3.0, =ROUND(23154.25,-2)
returns 23200.
Rounds a number to given number
of digits. But it simply truncates
the trailing digits, without con-
sidering whether the truncated
digit is below 5 or not. e.g.
14 ROUNDDOWN =ROUNDDOWN(2.99,1) returns
2.9, =ROUNDDOWN(2.629,2)
returns 2.62, =ROUND-
DOWN(2.5,0) returns 2.0,
=ROUNDDOWN(23154.25,-2)
returns 23100..
COPA 91 Dr.V.Nagaradjane
Rounds a number to given num-
ber of digits. But it simply adds
one to the last digit, without
considering whether the truncated
digit is below 5 or not. e.g.
15 ROUNDUP
=ROUNDUP(2.99,1) returns 3.0,
=ROUNDUP(2.622,2) returns
2.63, =ROUNDUP(2.1,0) returns
3.0, =ROUNDUP(23124.25,-2)
returns 23200.
Returns number of possible com-
16 COMBIN binations for given number of ob-
jects n Cr .
Returns degree value of angle for
17 DEGREES
given angular value in radian.
Returns the nearest even number
18 EVEN
just above the given number.
Returns the nearest odd number
19 ODD
just above the given number.
Returns exponential value of a
20 EXP
given number.
COPA 92 Dr.V.Nagaradjane
21 FACT Returns factorial of given number.
22 FACTDOUBLE Returns factorial of given number.
Returns greatest common divisor
23 GCD
of the number.
Returns integer value just below
24 INT
the given real number.
Returns least common multiple of
25 LCM
given numbers.
Returns natural logarithm of given
26 LN
number.
Returns common logarithm of
27 LOG
given number.
Returns logarithm of given number
28 LOG10
to the base 10.
Returns determinant of given ma-
29 MDETERM
trix.
30 MINVERSE Returns inverse of given matrix.
Multipication result of given ma-
31 MMUL
trices.
Returns modulo reminder of divi-
32 MOD
sion.
Returns nearest value rounded to
33 MROUND
the given multiple.
34 PI Returns the value of PI (3.1415...).
Returns the the given power of a
35 POWER
number.
COPA 93 Dr.V.Nagaradjane
36 QUOTIENT Returns quotient of division.
Returns radians for given degree
37 RADIANS
angle.
38 RAND Returns a random number.
Returns a random number be-
39 RANDBETWEEN
tween given input numbers.
Returns Roman numeral for given
40 ROMAN
Arabic number.
41 SIGN Returns sign ± + or -.
Returns square root of the given
42 SQRT number (only positive numbers are
permitted in argument).
Returns subtotal of given num-
43 SUBTOTAL
bers.
44 SUM Returns sum of given numbers.
Returns sum of given numbers if
45 SUMIF
given condition is fulfilled.
Returns sum of squares of given
46 SUMSQ
numbers.
Truncates given number to integer
47 TRUNC
value.
COPA 94 Dr.V.Nagaradjane
3.4.7 Statistical functions
COPA 95 Dr.V.Nagaradjane
Returns sum of squares of devia-
11 DEVSQ
tions.
Returns the most probable next
12 FORECAST value in a set of dependent and in-
dependent variables.
Returns geometric mean of given
13 GEOMEAN
values.
Returns exponential forecast for a
14 GROWTH new X value based on given Y and
X values.
Returns rank based large value in
15 LARGE
a data set.
16 MAX Returns highest numeric value.
Returns highest value from the
17 MAXA given numbers, text or logical val-
ues.
Returns the median (the data that
18 MEDIAN occurs at the middle) of given set
of data.
Returns the least value of given
19 MIN
numbers.
COPA 96 Dr.V.Nagaradjane
3.4.8 Text functions
COPA 97 Dr.V.Nagaradjane
Takes target string, search string
and replacement string as argu-
17 SUBSTITUTE ments. Replaces second string
with the third string in the first
string.
Returns text value. Does not re-
18 T turn anything for number and log-
ical values.
Formats the number given in the
19 TEXT first argument according to format
specified in the second argument.
Removes spaces from the begin-
20 TRIM
ning and end of given string.
21 VALUE Converts text to number.
• Avoid the most common mistakes of selecting the just the sin-
gle column containing the values to be sorted and omitting
some columns which you might consider unnecessary of inclu-
sion. Such an error may result in separation of data from its
proper row members.
• Click Data − > Sort. In the dialog that opens, keep or remove
the tick mark against the field ”My data contains headers”.
COPA 98 Dr.V.Nagaradjane
3.6 Filtering of data in MS Excel
• For filtering data, the first row should contain headers.
• Choose Data − > Data Validation from the menu. Select Data
Validation.
• Select the data criterion (between, not between, equal to, not
equal to, greater than, less than, greater than or equal to, less
than or equal to).
COPA 99 Dr.V.Nagaradjane
• Press OK to apply the condition.
• To display a chart like column, line, pie or bar, type X-Axis title
in the one column and Y-Axis title in the next column.
• Choose Insert menu. Click the type of chart like column, line,
pie, bar or scatter.
• If you wish to create a column based data table, fill the input
values on the left. Calculate the result for the first row.
• Select the entire table, choose Data − > What If Analysis − >
Data Table.
• Choose first column in the input box (leave the row value
blank).
• In the second cell, enter the address of the cell containing wrong
input, which needs to be adjusted to produce the desired new
result.
• Press seek button and see the suggested new input value.
• You can choose any of the scenario at a later time to see the
results.
Syllabus
Image editing, Introduction to the properties and editing of
images. Introduction to Open Office. Introduction to Power-
Point and its advantages. Creating Slide Shows. Fine tuning
the presentation and good presentation techniques.
103
images are SVG (Scalable Vector Graphics), CGM (Com-
puter Graphics
Metafile), etc.
(iii) Insert:
(iv) Design:
(v) Transitions
(vi) Animations
• Choose Headers and Footers from Insert − > Text − > Header
& Footer (Alt + N + H). Set appropriate values for header and
footer.
• Audio may be recorded for each slide using Slide Show − >
Setup − > Record Narration (Alt + S + N). This audio plays
when the slide is presented. Recording may be verified using
Slide Show − > Setup − > Play Narration (Alt + S + P).
• Search may be carried out using Home − > Editing − > Find
(Ctrl + F/ Alt + H + FD).
Database Management
System (DBMS)
Syllabus
Concept of DBMS, RDBMS, Data Models, Concept of DBA,
Database Users, Database Schema, Designing Database using
Normalization Rules, Various data types Data integrity, DDL,
DML and DCL statements, Enforcing Primary key and foreign
key, Adding Indices, Concepts of Transactions, ACID Property
of Transaction, Constraints, Joining of tables, Sub Queries,
Functions used in query like sum, average, max, min, count
etc.
117
• Data related to financial transactions is used for accounting.
5.1.2 Information
• Details collected about an particular object is called informa-
tion.
5.1.3 Database
• The system for storage and retrieval of data in digital format
is called database.
• Database makes the storage and retrieval of data easy for the
client.
• Each table has columns (which are given names) and rows,
which represented information.
• RDBMS allows inner join, outer join and sub-query when se-
lecting data.
9 Primary key: The main column used for indexing and search-
ing data is called primary key. Primary key does not support
duplicate values.
• Some users can create databases and tables (just like admin),
some can alter tables, some can only insert data or select data,
some can only view data.
• To create a new user name ’krish’, the DBA would run the
following mysql query:
CREATE USER ’krish’@’localhost’ IDENTIFIED BY ’password’;
• Finally, a user may be removed from the list of users using drop
command. The following query removes our user account:
DROP USER ’krish’@’localhost’;
5.9 Schema
• Schema describes the structure of a database table.
2. Each query like insert, delete, drop, alter, grant, revoke creates
certain transactions.
5.20 Constraints
• Constraints are restrictions placed on the values a column may
or may not permit.
• Since ID value in address for Ram is not known, one may exe-
cute a subquery (select id from address where name=’Ram’;)
to find the same.
• Results of the subquery for names of Ram and Krish are shown
in fig.5.8.
• A table named result with id, name, subject and mark columns
is created using the following query:
create table result (id bigint auto increment primary key, name
varchar(20), subject ENUM( ’Tamil’, ’English’, ’Maths’, ’Sci-
ence’, ’Social’), mark int);
• Following values may be inserted into the result table:
emph insert into result values(0,’Ram’,’Tamil’,94);
insert into result values(0,’Ram’,’English’,92);
insert into result values(0,’Ram’,’Maths’,100);
insert into result values(0,’Ram’,’Science’,98);
insert into result values(0,’Ram’,’Social’,91);
insert into result values(0,’Krish’,’Social’,76);
(a) Count
(b) Sum
Communicating in the
connected world
Syllabus
Local Networks, Communicating on a Local Network, Prin-
ciples of Communications, How do Ethernet Networks Work?,
How are Networks Built?, Routing Across Networks, How end-
user devices and local networks interact with the global In-
ternet. Concept of network communication. Local Networks
Explain the roles of devices in a network. What Does a Home
Network Look Like? How Does Wi-Fi Work? Introduction to
LAN Devices, Internetworking Devices, Introduction to www,
Concept of Internet, Web Browsers, internet servers and search
engines. Concepts of Domain naming Systems and E mail com-
munication. Introduction to video chatting tools and Social
Networking concepts.
143
Figure 6.1: Address bit configuration: Class A network [73]
• Both the client and the server have a unique IP address (to
locate the computer on the network) and Port number (to
identify the program which communicates over the network).
• The client and server might use User Datagram Protocol (UDP)
for fast communication with some errors (like video sharing,
audio sharing) where small errors are permissible.
(iii) Ring topology: Ring topology ends where it began, all com-
puters/ nodes connected to the endless ring.
(v) Tree topology: Tree topology allows each node of the network
to divide/ diverge into 2 separate connections, each new node
dividing till the end of network is reached.
6.9 Internet
• The global network of networks is called Internet.
• Each website has a web server which shares its data with clients.
• The address bar of the web browser can be opened using the
shortcut Ctrl+L.
• The data sent by the web server is rendered by the web browser.
• Apache web server is the most popular open source web server.
6.14 Email
• The system for electronic transmission of text and documents
over a network from the sender to recipient is called email.
• Email servers use port numbers 25 - SMTP (Simple Mail Trans-
fer Protocol), 109 - POP2 (Post Office Protocol 2), 110 -
POP3 (Post Office Protocol 3), 993 - IMAP (Internet Mes-
sage Access Protocol).
• Email clients have made it possible to access mailing system
from the browser or dedicated client programs.
• Email messages are fast in message delivery.
• the most popular email servers are gmail.com, yahoo.com, red-
iff.com, rediffmail.com, ymail.com, icloud.com, hotmail.com,
etc.
• Corporate companies have their own email servers with their
own domains.
• To use email service, a person needs to register and obtain an
email address from any of the email servers.
• Each person using the social media should exercise self restraint
and should not share any information which can be used by the
other party for blackmailing in the future.
Syllabus
Concepts of Static and Dynamic Web pages. Introduction
to HTML and various tags in HTML. Creating Forms with
controls using HTML. Concepts of CSS and applying CSS to
HTML Introduction to open source CMS viz,. Joomla, Word-
press, etc. and web authoring tools viz. Kompozer,FrontPage
etc.
161
• Dynamic web pages can be created by:
• HTML: All HTML files begin with <HTML> and end with
< /HTML>.
• INPUT: Input tag can have several type options (like text,
date, email, number, etc.), a name, an ID and other attributes
like readonly if necessary.
• RESET: Reset button clears all entries from a form and pro-
vides a blank form.
• A: Anchor tag for hyper text linking. HREF option takes the
URL to be loaded when the link is clicked.
• B: BOLD tag.
</body>
</html>
<tr id=”even”><td>2</td><td>Cone</td>
<td><img width=20% src=”ice-creams/02-cone.jpg”>
</td><td>Rs.60/-</td></tr>
<tr id=”odd”><td>1</td><td>Chocolate</td>
<td><img width=20% src=”ice-creams/03-chaco.jpg”>
</td><td>Rs.90/-</td></tr>
<tr id=”even”><td>4</td><td>Cone</td>
<td><img width=20%
src=”ice-creams/04-strawberry.jpg”>
</td><td>Rs.100/-</td></tr>
</table>
</span>
</body>
</html>
body {
background-color: #222277;
font-size: 300%;
<html>
<head>
<title>Enter your name</title>
<link rel=”stylesheet” type=”text/css” href=”red.css”>
</head>
<body>
<h1>Name form</h1>
<form name=”nameForm” action=”#” method=”POST”>
<center>
<table border=0>
<tr><td>Name</td><td>: </td>
<html>
<head>
<title>Add numbers</title>
<link rel=”stylesheet” type=”text/css”
href=”red.css”>
</head>
<body>
<h1>Add form</h1>
<form name=”addForm” action=”#” method=”POST”>
<center>
<table border=0>
<tr><td>Enter x</td><td>
: </td><td><input type=”text” name=”x”></td>
</tr>
<tr><td>Enter y</td><td>: </td>
<td><input type=”text” name=”y”></td></tr>
<tr><td colspan=3 style=”text-align: center”>
<input type=”button” value=”Add”
onClick=”z.value = Number(x.value)
+ Number(y.value)”></td></tr>
<tr><td>Result</td><td>
: </td><td><input type=”text”
name=”z” readonly></td></tr>
<html>
<head>
<title>Subtract numbers</title>
<link rel=”stylesheet” type=”text/css” href=”red.css”>
</head>
<body>
<h1>Subtract form</h1>
<form name=”subForm” action=”#” method=”POST”>
<center>
<table border=0>
<tr><td>Enter x</td><td>: </td>
<td><input type=”text” name=”x”></td></tr>
<tr><td>Enter y</td><td>: </td>
<td><input type=”text” name=”y”></td></tr>
<tr><td colspan=3 style=”text-align: center”>
<input type=”button” value=”Subtract”
onClick=”z.value = Number(x.value) -
Number(y.value)”>
</td>
</tr> <tr><td>Result</td>
<td>: </td><td>
<input type=”text” name=”z” readonly>
</td></tr>
</table>
</center>
</form>
</body>
<html>
<head>
<title>Multiplication form</title>
<link rel=”stylesheet” type=”text/css” href=”red.css”>
</head>
<body>
<h1>Multiply form</h1>
<form name=”mulForm” action=”#” method=”POST”>
<center>
<table border=0>
<tr><td>Enter x</td><td>: </td><td><input type=”text”
name=”x”></td></tr>
<tr><td>Enter y</td><td>: </td>
<td><input type=”text” name=”y”></td>
</tr>
<tr><td colspan=3 style=”text-align: center”>
<input type=”button” value=”Multiply”
onClick=”z.value = Number(x.value) * Number(y.value)”>
</td></tr>
<tr><td>Result</td><td>: </td>
<td><input type=”text” name=”z” readonly>
</td></tr>
</table>
</center>
</form>
</body>
</html>
<html>
<head>
<title>Division of numbers</title>
<link rel=”stylesheet” type=”text/css” href=”red.css”>
</head>
<body>
<h1>Division form</h1>
<form name=”divForm” action=”#” method=”POST”>
<center>
<table border=0>
<tr><td>Enter x</td><td>: </td>
<td><input type=”text” name=”x”></td></tr>
<tr><td>Enter y</td><td>: </td>
<td><input type=”text” name=”y”></td></tr>
<tr><td colspan=3 style=”text-align: center”>
<input type=”button” value=”Divide”
onClick=”z.value = Number(x.value) / Number(y.value)”>
</td></tr>
<tr><td>Result</td><td>: </td>
<td><input type=”text” name=”z” readonly>
</td></tr>
</table>
</center>
</form>
</body>
</html>
<html>
<head>
<title>Age calculation</title>
<html>
<head>
<title>Power</title>
<link rel=”stylesheet” type=”text/css” href=”green.css”>
</head>
<body>
<h1>Power form</h1>
<form name=”powForm” action=”pow.php”
method=”POST”>
<center>
<?php
$x = $ POST[’x’];
$y = $ POST[’y’];
$z = pow($x, $y);
echo $x . ” ˆ” . $y . ” = ” . $z;
?>
Javascript
Syllabus
Introduction to Web Servers and their features. Introduction
to Programming and Scripting Languages. Introduction to
JavaScript and its application for the web. JavaScript Basics
– Data types, Variables, Constants. Conversion between data
types. The Arithmetic, Comparison, Logical and String Opera-
tors in JavaScript. Operator precedence. Arrays in JavaScript
– concepts, types and usage. Program Control Statements and
loops in JavaScript. Introduction to Functions in JavaScript.
Built in JavaScript functions overview. The String data type in
JavaScript. Introduction to String, Math and Date Functions.
Concepts of Pop Up boxes in JavaScript. Introduction to the
Document Object Model. Concepts of using Animation and
multimedia files in JavaScript.
8.1 Algorithms
1) The sequence steps taken to solve a problem is called an algo-
rithm.
179
8.2 Flowcharts
1) Graphical representation of the step by step solution of a prob-
lem is called flowchart.
2) Flowchart symbols and their purposes are given below:
5 Rectangle Processing
@
@ Decision making (condi-
@
6 @ Rhombus tions - if/ switch, loops -
for/while).
8 Compiler based languages are very strict about syntax and data
types.
8.5 Javascript
1 Javascript loosely follows the syntax of Java programming lan-
guage.
4 The script tag begins with one or both of the following at-
tributes: type = ”text/javascript” and language = ”javascript”.
2 Single line comments start with // symbol and run till the end
of the line in which it is placed. For example,
x*=2; //current value of x is doubled.
//The following code calcualtes age of a person.
are examples of single line comment.
x={3,5,2,10};
for(var y in x)
alert(x[y]);
display all the elements array x.
4 Else block may also omit the pair of { } if the code for it
contains a single line.
Example of if condition
<html>
<head>
<title>Test of if condition</title>
<script type=”text/javascript” language=”javascript”>
function ageMessage() {
var age = this.ageForm.age.value;
2 In case the value is the first test fails (age ¿= 13), the else if
part tests whether the age is between 13 and 19. In such a
case, the message ”You are a teenager!” loads.
4 In case the age is greater than or equal to 36, the third else
if condition checks whether the age is less than 50. If so, the
message ”You are middle aged!” is displayed.
2 It checks the input against several case values (e.g., case 2:)
and executes the lines following the matching case.
3 All cases, other than the last one end with break keyword.
4 For case 11, it displays the message ”Your name is bit long!”.
2 The f or loop has 3 parts, viz., (i) initialization part, (ii) con-
dition part, (iii) increment part.
Example of f or − in loop
<html>
<head>
<title>
Example of for-in loop
</title>
</head>
<body>
<script type=”text/javascript” language=”javascript”>
var x = new Array(4,2,6,8,12,15,25), sum=0;
document.write(”Sum of ”);
for(var y in x) {
document.write(x[y] + ” ”);
sum + = x[y];
}
document.write(” is ” + sum);
<html>
<head>
<title>
Example of for-in loop
</title>
</head>
<body>
<script type=”text/javascript” language=”javascript”>
var x = {’Tamil’:92, ’English’:98, ’Maths’:100, ’Science’:94, ’Social’:91};
var sum=0;
document.write(”<center><h1>Mark statement</h1>”+
”<table border=1>”);
document.write(”<tr><th>Subject</th>”+
”<th>Mark</th></tr>”);
for(var y in x) {
document.write(”<tr><td>” + y + ”</td>
<td style=’text-align:right’>” + x[y] + ”</td></tr>”);
sum + = x[y];
}
document.write(”<tr><td
style=’color: #FF0000; text-align:center’>Total</td>
<td style=’color:#FF0000; text-align:right’>” +
sum + ”</td></tr></table>”);
</script>
</body>
</html>
3 If the loop contains more than one statement, the entire loop body
is enclosed in a pair of curly braces({ }).
3 The do ... while loop checks the condition at the last line (which
is a while).
</script>
</head>
<body>
<script>
add1();
add2(5, 10);
var res = add3(20,45);
document.write(”20 + 45 = ” + res);
</script>
</body>
</html>
1. Number functions
2. String functions
3. Array functions
4. Date functions
5. Math functions
• concat(s1,s2, s3): Joins given Strings (s1, s2, s3, etc.) with
original String and returns the joined String.
• search(s1): Searches the original String for the given String s1.
The String s1 may have regular expression.
• reduce(): Apply given function to the right and left elements and
replace them with given result till there remains only a single ele-
ment.
• shift(): Removes the first element of the array. Returns the value
of removed element.
• Math.floor(x): Returns the integer just lower than the given frac-
tion x.
<html>
<head>
<title>Dialogs in Javascript</title>
</head>
<body>
<script>
var x = prompt(”Enter x:”,”10”);
var y = prompt(”Enter y:”,”20”);
if(confirm(”Do you wish to add the numbers?”)) {
var z = Number(x) + Number(y);
alert(x + ” + ” + y + ” = ” + z);
}
else
alert(”You have chosen not to do anything with the given numbers”);
</script>
</body>
</html>
(6) writeln(str): Writes given string value to the document and ap-
pends a newline character.
(8) innerText: Sets text value for a particular element of the docu-
ment.
Example of DOM
<html>
<head>
<title>
Test of DOM
</title>
<script type=”text/javascript”>
function welcome() {
var name = document.nameForm.n.value; //DOM access
document.write(”Welcome ” + name + ”!”); //DOM method write is
used
}
</script>
</head>
<body>
<form name=”nameForm” method=”GET” action=”#”>
<center>
Enter name: <input type=”text” name=”n”><br />
<input type=”button” value=”Message” onClick=”welcome()”>
</center>
</form>
</body>
</html>
2 The window class of BOM is the parent of all other objects. The
structure of BOM is shown in Fig.8.3.
Syllabus
MS excel revision (row, columns, basic formatting, insert menu,
Print setup, etc. ) and Look up introduction and functions Types of
references and cell naming Excel Linkage Custom Format and Excel
Protection Tips and tricks Pivot table and Pivot chart Conditional
formatting Advanced Graphs Power Queries
217
• Excel can sort and arrange data in easily readable format.
• Excel can draw charts (like pie, bar, column, scatter, etc.) to help
visualize data entered in cells.
• Avoid the most common mistakes of selecting the just the single col-
umn containing the values to be sorted and omitting some columns
which you might consider unnecessary of inclusion. Such an error
may result in separation of data from its proper row members.
• Click Data− > Sort. In the dialog that opens, keep or remove the
tick mark against the field ”My data contains headers”.
• The sort options contain 3 columns. First, select the column using
which data needs to be sorted. In case the data contains headers,
the header name is displayed. Otherwise, column name in alphabets
(A,B,C,...) is displayed.
• In the second criterion, choose either values, cell color or cell icon.
• Choose Data − > Data Validation from the menu. Select Data
Validation.
• Select the data criterion (between, not between, equal to, not equal
to, greater than, less than, greater than or equal to, less than or
equal to).
• To display a chart like column, line, pie or bar, type X-Axis title in
the one column and Y-Axis title in the next column.
• Choose Insert menu. Click the type of chart like column, line, pie,
bar or scatter.
• If you wish to create a column based data table, fill the input values
on the left. Calculate the result for the first row.
• Select the entire table, choose Data − > What If Analysis − >
Data Table.
• Choose first column in the input box (leave the row value blank).
• If you wish to create a matrix using data table, enter input values
in 2 cells, calculate the result value in a new cell.
• Select the new matrix. Leave the row and column input cells uns-
elected.
• In the input box, select the cells for row and column input.
• When OK button is pressed, Excel fills all the cells of the matrix
based on your formula.
• If you wish to know the input for which the formula will yield a
desired result, goal seek will help you.
• Click the cell containing the formula. Choose Data − > What If
Analysis − > Goal Seek.
• The raw data imported into the worksheet should be suitably trans-
formed/ reorganized for easy charting.
E-Commerce
Syllabus
Introduction to E Commerce and advantages. Building business on
the net. Payment and Order Processing, Authorization, Charge-
back and other payment methods. Security issues and payment
gateways.
227
and the buyer too is business firm (not an individual consumer),
the e-commerce transaction is called B2B or Business to Business
transaction.
5 Benefits
2 A product may get damaged during transit, since the seller and the
buyer are located at far off places.
4 The buyer might return the product after using it for few days,
which could result in the loss of transit and other expenses to the
seller.
5 The buyer might get delivery of the product on the expected date.
4 The buyer and seller should be permitted to share and rate their
experience for each online transaction.
3 The seller should keep the buyer updated about each stage of the
online transaction from purchase to eventual delivery of product.
4 The seller should ensure that the buyer is provided a pleasant ex-
perience through all stages of his transaction.
5 The buyer should have the service and support for the online prod-
uct.
• The online catelogue shoud describe all physical and internal fea-
tures.
• Online catelogue should provide clear price tag for each product.
• When the user provides confirmation that the items in the cart are
really meant to be purchased, the checout page redirects the user
to payment page.
• The user should ensure that the lock icon is not crossed out.
• The user should ensure that the Internet connection is stable for
completing payment transaction in one go.
• The user should ensure that the payment URL begins with https,
which is a secure communication protocol over hyper text trans-
mission protocol.
Cyber security
Syllabus
Overview of Information Security, SSL, HTTPS, Security threats,
information Security vulnerability and Risk management. Introduc-
tion to Directory Services, Access Control, Security, Privacy pro-
tection, Audit and Security. Introduction to IT Act and penalties
for cybercrimes.
235
• Under information security, any device having processor and mem-
ory is categorised under computing device.
• Keeping the data of a device safe from unauthorized users is called
information security.
• CIA: CIA is the abbreviation for Confidentiality, Integrity & Avail-
ability under information security.
11.4 Vulnerability
• Sources of weakness in the IT infrastructure for potential theft of
information is called vulnerability.
• Vulnerabilities may be found in the operating system. These vul-
nerabilities are targeted by hackers and exploited.
• The network connection might be insecure due to lack of firewall,
anti-virus and other online protection software packages.
2 66 Hacking 3
years 5 Lakh Yes
Receiving stolen
3 66B 3
computer/ mobile 1 Lakh Yes
years
Publishing sexual 7
9 67A
content years 1Lakh Yes
5; 7 1Lakh;
Publishing child years 1Lakh
10 67B (sub-
porn (sub- Yes
se- se-
quent) quent)
Failure to maintain
11 67C 3
records by operator undefined Yes
years
Non-compliance 3
12 68
with orders years 2Lakh Yes
Refusal to decrypt 7
13 69
data years undefined Yes
Disclosure of wrong 3
14 70
information years 1Lakh Yes
Syllabus
Benefits of cloud services, different categories. Resources avail-
able in cloud. Identify Phases of the Application Development Life
Cycle. Describe Roles in each of phases of the Application Devel-
opment Life Cycle.
• Thin clients like Chromebooks can store data and run programs in
the remote cloud.
243
• Public clouds: Public cloud services are accessed over the common
Internet. The services may be paid or free. OneDrive, iCloud,
Google Drive, DropBox, etc. are examples of public cloud.
• Hybrid clouds: Hybrid clouds provide some public services acces-
sible to everyone and some restricted services accessible for internal
use of employees.
• Community clouds: Some individuals or organizations having com-
mon interests may share data and storage on a cloud. For persons
or organizations outside the particular community, the cloud looks
like a private cloud.
1. Gathering information
2. Analysis
3. Design
4. Coding and testing
5. User and system tests
6. Deploymet (Production)
7. Maintenance
Python Programming
(Optional 1)
Syllabus
Introduction to Python, History of Python, Features, Setting up
path, Basic Syntax, Comments, Variables, Different Data Types,
Casting, string, Boolean
Python Operators Conditional Statements, Looping Control State-
ments, String Manipulation, Lists, Tuple, sets, Dictionaries, Arrays,
Iterators, date, math modules, Input and Output.
247
Figure 13.1: Giodo Van Rossum, Creator of Python[13]
• Python has support for filter, map, list, set, dictionary, generator,
itertools, functools, etc.
• To include Python from the command line, one may issue the com-
mand PATH=%PATH%;c:
python3.
13.7 Variables
• A variable may start with any alphabet or underscore ( ).
1. dict: Name value pairs are stored in dict. Dict is enclosed inside
curly braces{ }. Names and values are separated by colon : symbol.
• Fig. 13.3 shows the conversion of data to int type and str type.
2) if else condition:
x = int(input(”Enter your age: ”))
if(x<18):
print(”You are a kid!”)
else:
print(”You are not a kid!”)
• Following function writes the string All the best with Python
programming! to a file named copa.txt:
f = open(”copa.txt”,”w”)
f.write(”All the best with Python programming!”);
f.close()
• Following code reads the file copa.txt and displays the content:
f = open(”copa.txt”,”r”)
print(f.read())
f.close()
It prints All the best with Python programming! on the screen.
• Single line strings begin and end with ” or ’ (double quote or single
quote).
e.g.,
x=”Good ”
y=”morning”
• lower, upper, strip (trim spaces), lstrip, rstrip, find, swapcase, title,
split, isupper, islower, istitle, isspace, isnumeric, isdigit, isdecimal,
isalnum, capitalize, endswith, startswith, splitlines, swapcase, join,
ljust, rjust, repalce, capitalize, casefold and center are some of the
methods which can be called upon given string.
Syllabus
265
14.1 Object Oriented Programming with
Core Java
• Object Oriented Programming System (OOPS) is the concept of
building objects with properties and methods to solve programming
problems.
14.2.1 Classpath
• Classpath is an environment variable which sets the file system path
of any Java library required for compiling and running other Java
programs.
• To set CLASSPATH for all users on Linux platform, open the file
/etc/prof ile.
• Running byte code (class file): The class file containing byte
code may be executed using the command java ByteCodeFile. No
extension (.class) should be added. e.g., to execute a class file
named Hello.class, the command should be java Hello (.class ex-
tension should be omitted).
• The source code file is saved with the name Welcome.java (name
of the public class with letter to letter match).
import java.lang.*;
import java.util.*;
public class InputDemo
{
public static void main(String arg[]) {
String name;
int age;
double x, y, z;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
name = sc.nextLine();
System.out.print("Enter your age: ");
age = sc.nextInt();
System.out.print("Enter x: ");
x = sc.nextDouble();
System.out.print("Enter y: ");
y = sc.nextDouble();
z = x+y;
System.out.println("Hello "+
name+",\n You are "+age+
" years old!\n"+x+"+"+y+" = "+z);
}
}
[fragile]
Fig. 14.2 shows the how System.out, System.in and
java.util.Scanner classes work.
14.10.1 If condition
[fragile]
import java.util.Scanner;
public class Age
{
public static void main(String arg[]) {
int age;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your age: ");
age = sc.nextInt();
if(age<5) {
System.out.println(
"You are eligible for Kinder Garten school!");
}
}
}
import java.util.Scanner;
public class Age
{
public static void main(String arg[]) {
int age;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your age: ");
age = sc.nextInt();
if(age<5) {
System.out.println(
"You are eligible for Kinder Garten school!");
}
else {
System.out.println(
"You may join a primary or secondary or
higher secondary school!");
}
import java.util.Scanner;
public class Age
{
public static void main(String arg[]) {
int age;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your age: ");
age = sc.nextInt();
if(age<5) {
System.out.println(
"You are eligible for Kinder Garten school!");
}
else if(age<10){
System.out.println(
"You may join a primary school!");
}
else if(age<15) {
System.out.println(
"You may join a Secondary school!");
}
else {
System.out.println(
"You may join a higher secondary school!");
}
}
}
import java.util.Scanner;
public class Age
{
public static void main(String arg[]) {
int age;
Scanner sc = new Scanner(System.in);
System.out.print("Enter your age: ");
age = sc.nextInt();
String eligibility;
eligibility = age<18? "not eligible":"eligible";
System.out.println("You are "+
eligibility+" to cast your vote!");
}
}
• The ternary code determines eligibility to cast vote based on age.
• The program takes age as an input.
• It uses ternary operator. The first part evaluates the condition
age < 18 followed by a question mark.
• The second part of ternary operator following question mark is
the true part. If the condition is true, the String ”not eligible” is
returned. A colon (:) is placed after second part.
• The third part of ternary operator following colon (:) is the false
part. If the condition is false, the String ”eligible” is returned.
• Fig.14.4 shows the execution of the above program.
• The break statement ends looping and transfers control to the next
code block.
import java.util.Scanner;
public class Reverse
{
public static void main(String arg[]) {
long num, n, rev=0;
Scanner sc = new Scanner(System.in);
System.out.print("Enter any large integer: ");
n = num = sc.nextLong();
while(num > 0) {
rev = (rev*10)+(num%10);
num = (int)((num-(num%10))/10);
}
System.out.println("Reverse of "+n+" is "+rev);
}
}
• The while loop program shows the logic for reversing given integer.
• While loop checks whether num is zero. If not, the last digit is
taken out using by taking modulo remainder by 10. The last digit
is added to the result variable after multiplying it by 10.
import java.util.Scanner;
opt = sc.next().charAt(0);
} while(opt==’y’ || opt == ’Y’);
}
}
• Since the variable opt is checked at the end of the loop, the loop
runs at least once.
import java.util.Scanner;
public class Fact
{
public static void main(String arg[]) {
long fact=1;
int n;
• The for loop program takes an integer input and calcualtes its fac-
torial.
• The second part of the for loop checks whether the value of i is less
than or equal to the given input number (i <= n;). A semi-colon
ends the second part.
• Third part of the for loop increments the variable i by 1 after each
cycle (i + +).
• Character class is the wrapper class for char data type (which is
primitive) in Java.
System.out.println(
"Statement of Marks\nSubject\tMark");
for(int i=0; i<mark.length; i++) {
System.out.println(sub[i]+"\t"+mark[i]);
total += mark[i];
}
System.out.println("Total\t"+total);
}
}
• The first for loop obtains marks for all 5 subjects. Second for loop
displays them.
• The second for loop calculates total mark and displays the same
after exiting the for loop.
• Normally, set and get methods are used to modify and read prop-
erties. This convention helps in the development of Java beans.
14.16 Inheritance
• Inheritance is the bestowal of parent class properties and methods
(other than those which are private) on a child class.
• Paper class may be used as the parent for child classes named book,
notebook, newspaper, etc.
• The Book class declares Paper class as its parent using the extends
keyword.
• Book class has one constructor which takes title, author and price.
The first line of the book constructor calls constructor of its paprent
class using super() method.
• The methods print and toString have been overridden in the Book
class. They become virtual methods inside the child class, since
they behave differently for invocation on Paper class and Book
class.
• Fig.14.10 shows execution of Book class program.
• A Java class may extend only one parent class but may implement
many interfaces.
interface Student
{
public String study();
public String appearInExam();
public String attendConvocation();
}
• We may extend Rectangle class in Oval class and override the above
two getArea methods. These 2 virtual methods will be bound at
runtime, called dynimically binding.
class Rectangle
{
public double getArea(double x, double y) {
return x*y;
• While referring to classes inside folders, the folder path and class
are separated by dot (.) symbol.
• All Java source code files in a package begin with the keyword
package. It is followed by the folder path and semi-colon.
• We may refer the packages in Pack.java and get the same results.
• Edit Rectangle class inside the the folder org.copa, using either
notepad org\copa\Rectangle.java or
gedit org/copa/Rectangle.java or
vim org/copa/Rectangle.java.
• Edit Oval class inside the the folder org.copa, using either notepad
org\copa\Oval.java or
gedit org/copa/Oval.java or
vim org/copa/Oval.java.
package org.copa;
import org.copa.Rectangle;
import org.copa.Oval;
{
public static void main(String arg[]) {
Rectangle r = new Rectangle(), o = new Oval();
System.out.println(
"For Sides 3,4: area of rectangle "+
r.getArea(3,4)+" area of oval: "+o.getArea(3,4));
System.out.println(
"For Side 3: area of square "+
r.getArea(3)+" area of circle: "+o.getArea(3));
}
}
• The Oval class getArea results are run time polymorphism results
or dynamic binding results or late binding results.
[1] https://www.wikihow.com/Maintain-Lab-Computers
[2] https://oakdome.com/k5/computer-lab-rules/
[4] https://www.tutorialsmate.com/2022/01/components-of-
computer.html
[7] https://oracletutes.com/rdbms-relational-database-management-
system/
[8] https://www.javatpoint.com/data-models
[11] https://www.javatpoint.com/mysql-join
[12] https://support.microsoft.com/en-us/office/lookup-function-
446d94af-663b-451d-8251-369d5e3864cb
[14] https://www.excelcampus.com/charts/10-advanced-charts/
[15] https://support.microsoft.com/en-us/office/about-power-query-
in-excel-7104fbee-9e62-4cb9-a02e-5bfb1a6c536a
305
[16] https://en.wikipedia.org/wiki/Solid-state drive
[17] https://news.samsung.com/global/samsung-electronics-unveils-
high-performance-990-pro-ssd-optimized-for-gaming-and-creative-
applications
[18] https://www.ifsecglobal.com/global/choose-right-type-fire-
extinguisher/
[25] http://bene.com/pics/office-furniture/workplaces/t-
workstation/t-workstation-03.jpg
[26] http://www.apple.com/shop/buy-ipad/ipad-air-2
[27] https://pixabay.com/en/photos/laptop/
[28] http://www.samsung.com/us/explore/galaxy-s7-features-and-
specs/
[29] https://www.raspberrypi.org/blog/raspberry-pi-2-on-sale/
[31] https://blog.hostonnet.com/wp-content/
uploads/2014/08/Keyboard-White-on-Black.jpg
[32] http://llg.cubic.org/docs/mouse.jpg
[51] http://www.activewin.com/reviews/hardware/processors/intel/-
p422ghz/designsse.shtml
[53] http://innoreviews.com/wp-content/uploads/2016/03/I3-
3220.jpg
[54] http://innoreviews.com/wp-content/uploads/2016/03/I3-
3220.jpg
[55] http://techgage.com/wp-content/uploads/2013/12/Intel-Core-i7-
Haswell-500x362.jpg
[58] https://upload.wikimedia.org/wikipedia/en/thumb/d/d3/
Samsung displays first DDR4 module.jpg/300px- Sam-
sung displays first DDR4 module.jpg
[59] http://www.informationq.com/wp-content/uploads/2012/
10/computer-Motherboard.jpg
310