computer science-ii

12
Dipak Pudasaini Him Koirala Manoj Kumar Karn Ramesh Rimal Approved by Government of Nepal, Ministry of Education, Science & Technology, Curriculum Development Centre, Bhaktapur, as an Additional Material from 2078 to 2080 Computer Science-II GRADE XII

Upload: others

Post on 20-Dec-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Dipak PudasainiHim Koirala

Manoj Kumar KarnRamesh Rimal

Approved by Government of Nepal, Ministry of Education, Science & Technology, Curriculum Development Centre, Bhaktapur, as an Additional Material from 2078 to 2080

Computer Science-IIGRADE XII

Edition 2021

Copyright © 2020, by the Buddha Publications. All rights reserved. Printed in the Nepal. Except as permitted under the Nepal Copyright Act of 2059, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.

Publishers: Buddha Publications Pvt. Ltd. Anamnagar, Kathmandu - 29, Nepal Tel. 00977-1- 5705165, 5705210, 5705177 e-mail: [email protected] www.buddhapublication.com

Design by: Gyanu Karki

Price: Rs. 410/–

ISBN: 978-9937-30-3897

Printed in Nepal

Computer Science-II

Quality education ensures the overall development of an individual. Quality education demands quality textbooks that shape and develop inner potentiality of a reader. The traditional reading materials have failed to fulfil the present competitive requirement of the learners who have the urgency to strengthen themselves in diverse fields and expose or apply their competency in the global environment.

Considering this reality, we have come up with COMPUTER SCIENCE–II for Grade XII students and thus, feel immense pleasure for our invaluable attempt to meet the pressing and changing need of the present day learners. It is, in fact, an ideal product with distinct concepts and features in the field of Computer Science–II.

So we have developed this book to cover all the topics prescribed by NEB. This book is designed in such a way that it includes Computer system, Number System and their Conversion, Logic Function and Boolean algebra, Computer Software and Operating System, Application Package, Programming Concept and Logics, Web Technology (HTML and CSS), Multimedia and Information security and cyber law.

The book contains the following distinct features:

LEARNING OBJECTIVES Every chapter of the book begins with learning objectives, which the readers should be able to achieve after they have completely studied it. The illustrative examples, figures, theoretical questions as well as keywords and exercises designed to help them achieve the objectives.

TEACHING INSTRUCTIONS Every chapter of the book begins with teaching instructions along with learning objectives and meaningful pictures, which the teachers should be able to achieve guidelines of different topics. The teachers should be able to know about the teaching hours and course contents in detail both theory and practical.

POINTS TO REMEMBER (PTR) Important points and concepts have been emphasized that help to overview quickly the main points of the sections as well as additional information required to the readers. It also helps to remind the main conclusion of the text as well as main points of the topic.

KEYWORDS At the end of every chapter, a list of key terms has been provided for a quick review and linking purpose of the relevant terms. Those terms help to clarify the meaning of the related terms used in the chapters.

EXERCISE At the end of every chapter, a section relating to ‘Exercise is provided which helps the readers to develop their theoretical understanding of the concerned chapters. It is divided into 3 parts. First part is very short question, second part is short question and third part is long question. Such theoretical questions are also useful from the point of view of final examinations.

BIOGRAPHY At the end of every chapter, a section relating to ‘Biography’ provided which helps the readers to develop their practical understanding of the concerned topics. Such biography is helpful for extra knowledge for the readers.

CASE STUDY At the end of every sub-unit, case study is given to enhance the capacity of students.

ASSIGNMENTS This book has provided a large number of assignments at the end of each session. These assignments help the readers to get mastery in the chapters. These assignments are arranged in order of simple to complex. The solved problems are to be practised in the classroom with the help of the teacher.

Every effort has been made to make this book student friendly. Still some errors and comments may exist on the book. So, we welcome any suggestions, ideas, comments and thoughts that would help to make the book more students friendly.

We wish our readers all the very best in their careers. Authors

Preface

This book is an outcome of a long inspiration and moral support of many people, especially, our +2 graduate students in Nepal, and we are always grateful to all of them. It is hardly possible to list the names of all our well-wishers here but we sincerely acknowledge the precious encouragement they offered us. We take this opportunity to express our sincerest gratitude to all those who have inspired to write this book.

We are indebted to all those authors whose works have directly or indirectly influenced in this textbook. We have also taken a number of references, which have been listed, at the end of the text. We sincerely acknowledge the references used in this book.

We would like to express to extend our sincere thanks to Prof. Dr. Shashidhar Ram Joshi, Dr. Subarna Shakya, Mr. Saroj Shakya, Mr. Rom Kant Pandey for their encouragement to develop this book.

We are proud to acknowledge Dr. Shiba Datta Gnawali, Mr. Prem Raj Rimal, Mr. Maroof Ahmad Khan, Mr. Nirmal Adhikari, Mr. Rabindra Jung Thapa, Mr. Nara Bahadur Bista, Mr. I.B. Gurung, Mr. Yuba Raj Sharma, Mr. Pranaya Singh, Mr. Birendra Narayan Sah, Mr. Santosh Maskey, Mr. Prajwal Baniya, Dr. Manoj Jha, Mr. Govinda Karki whose philosophy and guidance has inspired us to write the text book in this form.

We are also grateful to our friends: Akhilesh Yadav, Amit Ramdam, Anil Amatya, Anil Dutta, Arun Sharma, Asim Ghishing, Bal Krishna Shrestha, Basanta Kumar Yadav, Bhoj Raj Subba, Bikash Balami, Bikash Paudel, Binod Adhikari, Binod Bidari, Binod Sharma, Binod Sitaula, Bishwo Prakash Pokharel, Chandra Kandel, Deepak Kumar Adhikari, Deepak Thakur, Deepesh Sthapit, Dhirendra Yadav, Dibya Kant Pant, Dilip Thakur, Dilip Kumar Thapa, Dinesh Khadka, Hari Bhakta Acharya, Hem Raj Ojha, Heramba Raj Panta, Hikmat Rokaya, Hiranya Prasad Bastokoti, Indra Chaudhary, Jeevan K.C., Krishna Prasad Poudel, Lachhima Adhikary, Lal Krishna Mallik, Lalita Sthapit, Laxmi Maharjan, Maheshwor Devkota, Mohan Chandra Adhikari, Mukunda Khadka, Narayan Baral, Narayan Dahal, Navin Karna, Prachandra Ram Shrestha, Pramesh Bikram Nembang Ramesh Kunwar, Prakash Adhikari, Pralad Basnet, Pran Kunwar, Prayaschit Bhandari, Purusottam Karn, Rajan K.C., Rajan Khadka,Rakesh Thakur, Ramesh Sah, Ratna Maharjan , Ravi Kumar Singh, Ravi Lama, Ridip Khanal, Roshan Bhusal, Sabina Bhatta, Sagar Bhatta, Sailendra Khadka, Sanjesh Rimal, Saroj Bajracharya, Saurav Kumar Chaudhary, Shankar Ghimire, Subash Siwa, Surendra Yadav, Suresh Khatiwada, Suresh Pd. Shrestha, Umesh Sharma, Vivek Moktan, Vivek Pandit for their supports and innovative ideas for this book.

We are also grateful to the members of CFAN (Computer Faculty Association of Nepal) Prachadra Ram Shrestha, Satya Ram Suwal, Gopal Prasad Shah, Krishna Kumar Shrestha, Madhav Aryal, Bir Bahadur Kshetri, Ananta Pandey, Ananta Raj Shah, Bhoj Raj Joshi and Hari Prasad Sapkota.

We are grateful to Nabaraj Bajgain, Managing Director of Buddha Publications Pvt. Ltd. and Mr. Dipendra Shrestha of Buddha Publication for his holy contribution to prepare this book.

We are equally grateful to Mr. Bharat Giri, Mr. Ramakanta Mishra, Mr. Babu Ram Timsina,

Mr. Arun Kumar KC, Mr. Dipendra Dahal, Mr. Surendra Paneru, Mr. Rajan Khatiwada, Mr. Nandu Prasad Kushwaha, Mr. Hem Bahadur KC, Mr. Suman Basnet, Mr. Yam Karki, Mr. Dipendra Dahal, Mr. Binod Joshi, Mr. Abhaya Srivastav, Mr. A. K. Chaudhary, Mr. Chiranjibi Ghimire, Mr. Subhash Baral, Mr. Ramesh Niraula, Mr. Ashim Sitaula for taking a good care and inspiration.

Authors

Acknowledgement

SyllabusS. N. Content Area Contents Working

Hour

1 DatabaseManagementSystem(DBMS)

1.1 Introductiontodata,database,Databasesystem,DBMS1.2 Field,Record,Objects,PrimaryKey,Alternatekey,Candidatekey1.3 AdvantagesofusingDBMS1.4 DDL(DataDefinitionLanguage)andDML(DataManipulationLanguage)1.5 DatabaseModel:NetworkModel,HierarchicalModel,Relationaldatabase

model1.6 ConceptofNormalization:1NF,2NF,3NF1.7 CentralizedVs.DistributedDatabase1.8 Database Security

12

2 DataCommunicationandNetworking

2.1 BasicelementsofCommunicationSystem:2.2 ConceptofCommunicationSystem2.3 BlockDiagramofcommunicationSystem/Model2.4 ElementsofDataCommunication/Transmission2.5 Simplex,HalfduplexandFullduplexcommunicationmode2.6 ConceptofLANandWAN2.7 TransmissionMedium:GuidedandUnguided2.8 Transmissionimpairmentsterminology(Jitter,Singing,Echo,Crosstalk,

Distortion,Noise,Bandwidth,Numberofreceivers)2.9 BasicconceptofNetworksArchitecture:Client-ServerandPeer-to-peer2.10 SomeBasicTermsandToolUsedinComputer Network:IPAddress,SubNetMaskandGateway,MACaddress,Internet,

Intranet,Extranet2.11 NetworkTool:Packettracer,RemoteLogin2.12 NetworkConnectingDevices:NIC,Modem,router,switch2.13 NetworkTopologies:Bus,Ringandstartopology2.14 BasicConceptOSIReferenceModel2.15 InternetProtocolAddressing

15

3 WebTechnologyII

3.1 Introduction3.2 ServersideandClientSideScripting3.3 Introductionofinternettechnology3.4 AddingJavascripttoHTMLpage3.5 Javascriptfundamental3.6 JavaScriptDatatypes3.7 Variablesandoperators3.8 Functionsandcontrolstructureif-else,if-elseif,switch-case,for,while,do

whileloop3.9 ObjectbasedprogrammingwithJavaScriptandEventhandling3.10 Image,eventandformobjects3.11 Formvalidation,JQuery3.12 ServerSideScriptingusingPHP3.13 IntroductiontoPHP:HardwareandSoftwareRequirements3.14 Objectorientedprogrammingwithserversidescripting3.15 BasicPHPsyntax3.16 PHPdatatypes3.17 BasicProgramminginPHP3.18 Operators(Arithmetic,logical,comparison,operatorprecedence)3.19 VariablesManipulation3.20 DatabaseConnectivity3.21 Connectingserversidescripttodatabase3.22 MakingSQLqueries3.23 Fetchingdatasetsgettingdataaboutdata3.24 CreatingSQLdatabasewithserversidescripting3.25 Displayingqueriesintables

12

4 ProgramminginC

4.1 ReviewofCprogrammingconcept

4.2 Functions4.2.1 Conceptoflibraryanduserdefinedfunctionsandadvantages4.2.2 functiondefinition,prototype,callandreturnstatements4.2.3 AccessingaFunctionbypassingvalues4.2.4 Conceptofstorage:automaticandexternal4.2.5 ConceptofRecursion:factorialandFibonacciproblems

4.3 StructuresandUnions4.3.1 Structure:Definition,Declaration,InitializationandSizeof

Structure.4.3.2 Accessingmemberofstructure4.3.3 Arrayofstructure4.3.4 Union:Definition,Declaration4.3.5 Differencebetweenunionandstructure.

4.4 Pointers4.4.1 DefinitionofPointer4.4.2 Address(&)andindirection(*)operator4.4.3 PointerExpressionandAssignment4.4.4 Callbyvaluesandcallbyreference

4.5 WorkingwithFiles4.5.1 ConceptofDataFile4.5.2 SequentialandRandomFile4.5.3 Filemanipulationfunction:putw,getw,putc,getc,fscanf,fprintf4.5.4 Opening,Reading,WritingandAppendingdatafile

12

5 Object-OrientedProgramming(OOP)

5.1 Programmingparadigms:procedural,structuralandobjectoriented5.2 FeaturesofOOP:Class,Object,PolymorphismandInheritance5.3 AdvantagesofOOP5.4 ApplicationofOOP

10

6 SoftwareProcessModel(SPM)

6.1 SoftwareProjectConcept6.2 Conceptofsoftwaredevelopmentprocess6.3 ConceptSDLClifecycle6.4 SystemAnalystVsSoftwareEngineer6.5 RequirementCollectionMethods6.6 Conceptofsystemdesign6.7 Softwareandquality6.8 Softwaredevelopmentmodel:waterfall,prototype,agile

10

7 RecentTrendsinTechnology

7.1 ConceptofArtificialIntelligence(AI)andRobotics7.2 ConceptofCloudComputing7.3 ConceptofBigData7.4 ConceptofVirtualReality7.5 Conceptofe-com,e-medicine,e-gov.7.6 ConceptofMobileComputing7.7 ConceptofInternetofthings(IoT)

9

Total 80

Contents

CHAPTER 1

Database Management System (DBMS)1.1 Introduction: Data, Information, Database

and DBMS 2

1.2 Field, Record, Objects, Primary Key, Alternate key, Candidate key 3

1.3 Advantages and Disadvantages of DBMS 4

1.4 DDL (Data Definition Language) and DML (Data Manipulation Language) 6

1.5 Database Model: Network Model, Hierarchical Model, Relational database Model 7

1.6 Concept of Normalization: 1NF, 2NF, 3NF 10

1.7 Centralized Vs. Distributed Database 14

1.8 Data Security 16

Keywords 35

Exercise 36

Case Study 37

CHAPTER 2

Data Communication and Networking2.1 Basic Elements of Communication

System 40

2.2 Concepts of Communication System 42

2.3 Block Diagram of Communication System/Model 43

2.4 Elements of Data Communication/Transmission 43

2.5 Simplex, Half Duplex and Full Duplex Communication Mode 44

2.6 Concept of LAN and WAN 45

2.7 Transmission Media 48

2.8 Transmission Impairments Terminology 52

2.9 Basic Concepts of Network Architecture 54

2.10 Some Basic Terms and Tools 56

2.11 Network Tool: Packet Tracer, Remote Login 59

2.12 Network Connecting Devices 61

2.13 Network Topologies 62

2.14 Basic Concept OSI Reference Model 65

2.15 Internet Protocol Addressing 66

Keywords 68

Exercise 69

Case Study 71

CHAPTER 3

Web Technology II3.1 Introduction 73

3.2 Server Side and Client Side Scripting 73

3.3 Introduction of Internet Technology 74

3.4 Adding Java Script to HTML Page 76

3.5 Java Script Fundamental 77

3.6 Java Script Data Types 79

3.7 Variables and Operators 80

3.8 Functions and Control Structure 85

3.9 Object Oriented Programming and Event Handling 92

3.10 Image, Event and Form Objects 98

3.11 Form Validation and jQuery 102

3.12 Server Side Scripting using PHP 106

3.13 Introduction to PHP: Hardware and Software Requirements 106

3.14 Object oriented programming with server side scripting 108

3.15 Basic PHP syntax 109

3.16 PHP data types 110

3.17 Basic Programming in PHP 113

3.18 Operators (Arithmetic, logical, comparison, operator precedence) 118

3.19 Variables Manipulation 121

3.20 Database Connectivity 122

3.21 Connecting server side script to database 123

3.22 Making SQL queries 125

3.23 Fetching data sets getting data about data 128

3.24 Creating SQL database with server side scripting 129

3.25 Displaying queries in tables 131

Keywords 133

Exercise 134

Case Study (Project work) 136

CHAPTER 4

Programming Concept4.1 Review of C programming concept 139

4.2 Functions 171

4.2.1 Concept of library and user defined functions and advantages 171

4.2.2 Accessing a Function by passing values 182

4.2.3 Concept of Storage: automatic and external 184

4.2.4 Concept of Recursion: factorial and Fibonacci problems 187

Keywords 193

Exercise 194

Case study 195

4.3 Structures and Union 196

4.3.1 Structure: Definition, Declaration, Initialization and Size of Structure 196

4.3.2 Accessing member of structure 198

4.3.3 Array of structure 201

4.3.4 Union: Definition, Declaration 203

4.3.5 Differences between structure and union 204

Workout Examples 206

Keywords 211

Exercise 211

Lab Work 2: Structure and Union 212

Case Study 212

4.4 Pointers 213

4.4.1 Definition of pointer 213

4.4.2 The Address (&) and Indirection (*) Operator 213

4.4.3 Pointer Expression and Assignment 214

4.4.4 Call by values and call by reference 218

Keywords 220

Exercise 220

Lab Works 3: Pointer 221

Case Study 221

4.5 Working with Files 222

4.5.1 Concept of Data Files 222

4.5.2 Sequential and Random Access File 222

4.5.3 File manipulation function: putw, getw, putc, getc, fscanf, printf 223

4.5.4 Opening, reading, writing and appending on /from data File 229

Keywords 234

Exercise 235

Lab Works 4: Working with Files 237

Case Study 237

CHAPTER 5

Object Oriented Programming (OOP)5.1 Programming paradigms: procedural,

structural and object oriented 240

5.2 Feature of OOP: Class, Object, Polymorphism and Inheritance 242

5.3 Advantages of OOP 247

5.4 Application of OOP 247

Keywords 248

Exercise 249

Case Study 250

CHAPTER 6

Software Process Model (SPM)6.1 Software Project Concept 252

6.2 Concept of software development process 255

6.3 Concept SDLC life cycle 255

6.4 System Analyst Vs Software Engineer 263

6.5 Requirement Collection Methods 264

6.6 Concept of System Design 265

6.7 Software and quality 273

6.8. System Development Model: waterfall, prototype, agile 273

6.9 Case Study 278

Keywords 279

Exercise 280

CHAPTER 7

Recent Trends in Technology7.1 Concept of Artificial Intelligence and

Robotics 285

7.2 Concept of Cloud Computing 290

7.3 Concepts of Big Data 293

7.4 Concept of Virtual Reality 296

7.5 Concept of e-com, e-medicine, e-gov 300

7.6 Concept of Mobile Computing 305

7.7 Concept of Internet of Things (IoT) 307

Keywords 308

Exercise 309

Case Study 312

Database Management System (DBMS)Computer Science XII