Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
HAND BOOK
Of
5th Semester
URL: www.bmsit.in
2016-17
Disclaimer
The information contained in this document is the proprietary and exclusive property of Department of
Information Science & Engineering, BMS Institute of Technology & Management except as otherwise
indicated. No part of this document, in whole or in part, may be reproduced, stored, transmitted, or
used for course material development purposes without the prior written permission of BMS Institute of
Technology & Management.
The information contained in this document is subject to change without notice. The information in this
document is provided for informational purposes only.
Trademark
Edition: 2016 - 17
Document Owner
The primary contact for questions regarding this document is:
Author(s):
1.Prof.Swetha M S
2. Prof.Puspha S K.
3.Prof.Vinutha K
4. Dr.Manjunath T N
5.Prof.GireeshBabu C N
6. Prof.Ashwini N
Department:
Contact Email(s):
swethams_ise2014@bmsit.in
pushpask@bmsit.in
vinuthak_ise2014@bmsit.in
manju.tn@bmsit.in
gireeshbabu@bmsit.in
ashwinilaxman@bmsit.in
PEO2
PEO3
PROGRAMME OUTCOMES
Program outcomes are narrower statements that describe what students are expected to know and be
able to do by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of
Engineering Graduation students of Information science and Engineering program at B M S Institute of
Technology will attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate consideration for
the public health and safety, and the cultural, societal, and environmental considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
Department of Information Science & Engineering, B M S Institute of Technology & Management
sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to ones own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Course Code
Core/Elective
Semester
Year
SOFTWARE ENGINEERING
10IS51
Core
2016
Lecture
Tutorials
Practical
Department
Swetha M S,
Assistant Professor,
Swethams_ise2014@bmsit.in
1. Programming Fundamentals,
2. Object Oriented Programming languages
IA Marks
:25
Exam Hours :03
PART A
UNIT 1
6 Hours
Overview: Introduction: FAQ's about software engineering, Professional and ethical responsibility.
Socio-Technical systems: Emergent system properties; Systems engineering; Organizations, people
and computer systems; Legacy systems.
UNIT 2
6 Hours
Critical Systems, Software Processes: Critical Systems: A simple safety-critical system; System
dependability; Availability and reliability. Software Processes: Models, Process iteration, Process
activities; The Rational Unified Process; Computer Aided Software Engineering.
UNIT 3
7 Hours
UNIT 4
7 Hours
System models, Project Management: System Models: Context models; Behavioral models; Data
models; Object models; Structured methods. Project Management: Management activities; Project
planning; Project scheduling; Risk management
PART - B
UNIT 5
7 Hours
Software Design: Architectural Design: Architectural design decisions; System organization; Modular
decomposition styles; Control styles. Object-Oriented design: Objects and Object Classes; An ObjectOriented design process; Design evolution
UNIT 6
6 Hours
UNIT 7
7 Hours
Verification and Validation: Verification and Validation: Planning; Software inspections; Automated
static analysis; Verification and formal methods. Software testing: System testing; Component testing;
Test case design; Test automation.
UNIT 8
6 Hours
Management: Managing People: Selecting staff; Motivating people; Managing people; The People
Capability Maturity Model. Software Cost Estimation: Productivity; Estimation techniques;
Algorithmic cost modeling, Project duration and staffing
1. Write Requirements specification of software after studying the
problem domain
2. Use various process and design models for developing the software
3. Apply project management tools and techniques for scheduling the
diverse activities of software development
4. Document the design, implementation, and testing of the software
system
Department of Information Science & Engineering, B M S Institute of Technology & Management
5
Course Objectives
Text Books:
1. Ian Sommerville: Software Engineering, 8th Edition, Pearson Education, 2007. (Chapters-: 1, 2, 3,
4, 5, 6, 7, 8, 11, 14, 17, 21, 22, 23, 25, 26)
Reference Books:
1.Roger.S.Pressman: Software Engineering-A Practitioners approach, 7th Edition, Tata McGraw Hill,
2007.
2.Pankaj Jalote: An Integrated Approach to Software Engineering, Wiley India, 2009
Recommended Reference Materials:
1. Notes
2. PPT
3. Videos
Course Outcomes
CO1: Apply the importance of engineering practice in developing critical and non- critical system
CO2: Understand various software development process models and their requirements and
analysis process
CO3: Design software and apply strategies of Architecture design and project management
CO4: Understand and design planning, software inspections, automated static analysis, Verification
and validation of formal models
CO5: Apply rapid software development methods and decide on appropriate software architecture
Program Outcomes
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
PO10
PO11
PO12
CO4
Total
CO3
CO5
3
9
1
7
1
2
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs need
not map all PO
Name of the Faculty: Prof.Swetha M S
No. of Hours: 52
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
Unit I
1.
Write Requirements
specification of software after studying
the problem domain
1
2
3
4
5
6
Use
variou
s
proces
s and
design
model
s for
develo
ping
the
softwa
re
UNIT II
Critical Systems: A simple safety-critical
system
10
11
12
13
14
15
16
17
18
UNIT III
Software Requirements
Functional and Non-functional
requirements
User requirements and System
requirements
Interface specification, The software
requirements document
Requirements Engineering Processes,
Feasibility studies;
Requirements elicitation and analysis;
Requirements validation,
Requirements management
19
UNIT IV
System Models: Context models
21
Behavioral models
22
23
24
25
Apply project
management tools and
techniques for scheduling the
diverse activities of software
development
20
30
31
32
33
System organization
Modular decomposition styles
Control styles. Object-Oriented design
development
29
28
27
UNIT V
35
36
37
38
39
34
40
41
42
43
Document
the design,
implementation,
and testing of the
software system
UNIT VII
Verification and Validation
Planning of the Software inspections
Automated static analysis
Verification and formal methods
Component testing
46
UNIT VIII
Managing People: Selecting staff
48
49
50
51
52
47
25
100
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
Department of Information Science & Engineering, B M S Institute of Technology & Management
10
Question Bank
UNIT-1
1.
2.
3.
4.
5.
6.
7.
8.
9.
11
UNIT-2
1. What are the most important dimensions of system dependability? 5marks / Jan 09
2. Give five reasons why dependability is important in critical systems. 5marks / Jan 09
3. Describe silent features of a Spiral model of S/W process with illustration diagram.
10 marks/ Jan 09/ Jan 2010
4. With a figure, explain the requirement of an engineering process May /June 2010
5. Describe the S/W life cycle with diagram. (or) Explain the features of waterfall model.
6. What is non-functional requirement? Explain different types of non-functional requirement.
5 marks / Jan 09
7. Write the structure for requirement document as suggested by IEEE std.
5 marks / Jan 09
8. With neat diagram explain the phases in RUP may/June 2010 (10 marks)
9. What is non-functional requirement? Explain different types of non-functional requirement (10
marks) may/June 2010
UNIT-3
1. What are Enduring and Volatile requirements?
2. Also give the classification of volatile requirements with brief explanation.
10 marks / Jan 09
3. What are all the various metrics for specifying nonfunctional requirements?
4. Write the requirement elicitation and analysis phase with spiral diagram. Give reasons.
2010.
5. Draw and explain the use case diagram and sequence diagram for the library system.
6. Draw and explain the use case diagram and sequence diagram for the ATM system.
MAY
10. Explain with fig the data flow model of an invoice processing system. Jan 2009
Department of Information Science & Engineering, B M S Institute of Technology & Management
12
11. With an example, describe Repository model and give its advantages and dis advantage
5 marks / Jan 09
UNIT-4
1.
What is data-flow model? With an example show the notations used in data flow model.
2. Explain the object aggregation with example
3. Describe the three categories of risks. Explain different stages in risk management.
UNIT-5
1. What is Architectural design? Discuss the advantages of explicitly designing and documenting S/W
architecture.
2. How nonfunctional requirements are taken care in architectural design.
3. Explain the Client server model.
4. Explain the Layered model.
5. Discuss the different types of control models(style). ( i.e centralized model, event drive model )
6. Explain the modular decomposition model.
7. Illustrate with two examples for Object and Object class.
5 marks / Jan 09.
8. Develop an object model including a class hierarchy diagram, Service usage diagram and aggregate
diagram for a Library system.
10 marks / Jan 08.
9. What is architectural design? Explain the architectural design decision. MAY 2010
10. Why requirements need to be validated? Explain the check made in requirement validation.
UNIT-6
1. What are Agile methods? Give brief descriptions of five principles of agile methods. Also
explain why sometimes difficult to realize them.
10 marks /Jan 09
2. Discuss the advantages of pair programming.
5 marks /Jan 09
3. Briefly describe the three types of S/W maintenance. Why sometimes difficult to distinguish
between them.
10 marks / Jan 09
4. What is extreme programming? Explain different practices involved in extreme programming.
5. Explain the four basic issues in assessing business value of a Legacy system.
6. List and state the Lehmans laws given to Software evolution
Department of Information Science & Engineering, B M S Institute of Technology & Management
13
UNIT-7
1. Explain different types of testing that will be done in system testing with neat block diagram
2. What is verification and validation? Explain why validation is a difficult process
3. Explain the clean room approach of software development based of the 5 key strategies.
4. With neat diagram explain logical part of legacy system.
5. Explain the characteristic of rapid software development.
UNIT-8
1.Explain factors governing staff selection.
[June 2013][10M]
14
PEO2
PEO3
PROGRAMME OUTCOMES
Program outcomes are narrower statements that describe what students are expected to know and be
able to do by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of
Engineering Graduation students of Information Science & Engineering program at B M S Institute of
Technology will attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to ones own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Course Code
System Software
10CS52
Lecture
Contact Hours/ week
Department
Core/Elective
Core
Tutorials
Semester
Year
2016
Practical
S.K. Pushpa,
Associate Professor,
pushpask@bmsit.in
I.A. Marks:
50
Exam Hours: 03
Exam Marks: 100
6Hours
UNIT2
6Hours
Assemblers -1: Basic Assembler Function - A Simple SIC Assembler, Assembler Algorithm and Data
Structures, Machine Dependent Assembler Features - Instruction Formats & Addressing Modes,
Program Relocation.
UNIT 3
6Hours
UNIT 4
8Hours
Loaders and Linkers: Basic Loader Functions - Design of an Absolute Loader, A Simple Bootstrap
Loader, Machine-Dependent Loader Features Relocation, Program Linking, Algorithm and Data
Structures for a Linking Loader; Machine-Independent Loader Features - Automatic Library Search,
Loader Options, Loader Design Options - Linkage Editor, Dynamic Linkage, Bootstrap Loaders,
Implementation Examples - MS-DOS Linker.
PART B
UNIT 5
6 Hours
Editors and Debugging Systems: Text Editors - Overview of Editing Process, User Interface,
Editor Structure, Interactive Debugging Systems - Debugging Functions and Capabilities,
Relationship With Other Parts Of The System, User-Interface Criteria
UNIT 6
8Hours
Macro Processor: Basic Macro Processor Functions - Macro Definitions and Expansion, Macro
Processor Algorithm and Data Structures, Machine- Independent Macro Processor Features Concatenation of Macro Parameters, Generation of Unique Labels, Conditional Macro Expansion,
Keyword Macro Parameters, Macro Processor Design Options - Recursive Macro Expansion,
General-Purpose Macro Processors, Macro Processing Within Language Translators, Implementation
Examples - MASM Macro Processor, ANSI C Macro Processor.
UNIT 7
6Hours
Lex and Yacc 1: Lex and Yacc - The Simplest Lex Program, Recognizing Words With LEX, Symbol
Tables, Grammars, Parser-Lexer Communication, The Parts of Speech Lexer, A YACC Parser, The
Rules Section, Running LEX and YACC, LEX and Hand- Written Lexers, Using LEX Regular
Expression, Examples of Regular Expressions, A Word Counting Program, Parsing a Command Line.
UNIT 8
6 Hours
Lex and Yacc - 2 : Using YACC Grammars, Recursive Rules, Shift/Reduce Parsing, What YACC
Cannot Parse, A YACC Parser - The Definition Section, The Rules Section, Symbol Values and
Actions, The LEXER, Compiling and Running a Simple Parser, Arithmetic Expressions and
Ambiguity, Variables and Typed Tokens.
LABORATORY WORK
The following experiments should be practiced:
1.
2.
3.
4.
Course Objectives
Web Resources:
1. http://solomon.ipv6.club.tw/Course/SP/
2. http://www.venim.cz/downloads/manualy/SIC/e8/e8V5_sictools_US.pdf3.
3. https://en.osdn.jp/projects/sfnet_sicvm/howto/install
Course Outcomes
CO1: Gain knowledge on basic internal architecture of a system.
CO2: Analyze and develop ALL programs for SIC and SIC/XE machine architecture
CO3: Understand and Demonstrate assembly programming language and different passing techniques
of assemblers
CO4: Describe the design and implementation of different system software
CO5: Ability to understand the process of scanning and parsing tools
CO6: Analyze and Develop the programs using LEX and YACC tools
Program Outcomes
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
PO10
PO11
PO12
CO4
CO5
CO6
Total
11
12
10
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs need
not map all POS
No. of Hours: 50
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
1
2
3
4
5
6
UNIT I
Machine Architecture
Introduction, System
Machine Architecture,
Software
and
8
9
10
11
12
13
14
15
16
17
18
UNIT III
Assemblers -2: Machine Independent
Assembler Features
Literals,
Symbol-Definition
Statements,
Expression
Program Blocks,
Control Sections and Programming
Linking,
Assembler Design Operations - One- Pass
Assembler,
Multi-Pass Assembler,
Implementation Examples MASM
Assembler.
19
20
21
Implementatio
n and design g
goo loaders
UNIT IV
Loaders and
Functions -
Linkers:
Basic
Loader
24
25
26
27
28
29
30
31
32
implementation of assemblers,
macro processor, linker and loader
UNIT V
Editors and Debugging Systems: Text
Editors
Overview of Editing Process
User Interface, Editor Structure
Interactive Debugging Systems Debugging Functions and Capabilities
Relationship With Other Parts Of The
System
User-Interface Criteria
33
34
Macro Processor
UNIT VI
Macro Processor: Basic Macro Processor
Functions - Macro Definitions and
Expansion
Macro Processor Algorithm and Data
Structures
10
37
38
39
40
41
42
43
44
45
46
UNIT VII
Lex and Yacc 1: Lex and Yacc - The
Simplest Lex Program, Recognizing Words
With LEX, Parsing a Command Line
Symbol Tables, Grammars, Parser-Lexer
Communication, A Word Counting
Program,
The Parts of Speech Lexer, Using LEX
Regular Expression, Examples of Regular
Expressions
A YACC Parser, The Rules Section,
Running LEX and YACC, LEX and HandWritten Lexers
Recognizing Words With LEX, Parsing a
Command Line
Lex and Yacc 1: Lex and Yacc - The
Simplest Lex Program
11
47
48
49
50
51
52
20
100
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
D.1 Occupational Health & Safety (OH&S) Procedures
12
Since this course has a practical component, students are required to undergo OH&S training PRIOR
TO ENTERING the laboratory. Students must undergo this training every year for use of this
laboratory and their successful completion will be documented. Students must follow the OH&S
procedures meticulously and failure to follow them will result in severe penalties, including exclusion
from the College.
NOTE 5: Health and safety procedures have to be printed and displayed in the labs.
Materials
Course Objectives & Outcomes
Lecture notes & homes work
assignments, (mini)projects.
Sample solutions
Course performance (e.g., student
surveys, etc)
13
Question Bank
Unit I Machine Architecture
1. Define system software. Bring out the differences between system software and application
software. Bring out the differences between CISC and RISC
2. Explain SIC machine Architecture.
3. With reference to SIC/XE machine architecture explain
i) Instruction formats
4. Suppose that ALPHA is an array of 100 words. Write a sequence of instruction for SIC/XE to set all
100 elements of the array to 0. Use immediate addressing and register to register instructions to make
process as efficient as possible.
5. What are assembler directive? Give examples.
6. Suppose that RECORD contains a 20 byte record. Write a subroutine for SIC/XE that will write this
record on to device 05. Use immediate addressing and register to register instructions to make the
subroutine as efficient as possible
7. Explain the following with an example
(1) START
(2) END
(3) BYTE
(4) WORD
(5) RESB
(6) RESW
(7) BASE
Unit II Assemblers - 1
1. Give the functions of each pass of a two pass assembler.
Department of Information Science & Engineering, B M S Institute of Technology & Management
14
LOOP
START 0
OPCODE
LDX
#0
LDX
04
LDA
#0
LDA
00
+LDB
#TABLE2
LDB
BASE
TABLE2
ADD
TABLE, X
TIX
2C
ADD
TABLE2, X
JLT
38
TIX
COUNT
STA
0C
JLT
LOOP
RSUB
4C
+STA
TOTAL
ADD
68
18
RSUB
COUNT
RESW
TABLE
RESW
2000
TABLE2
RESW
2000
TOTAL
RESW
END
FIRST
15
9. Explain the two major internal data structures used in simple assemblers. Give reason for using that
data structures.
10. Explain the structure and design of one pass assemblers.
11. What are the fundamental functions that any assembler must perform? With suitable example
explain any six assembler directives.
12. Show the structure of a head record, text record and modification record taking one example for
each.
13. With examples, show the target address calculation with different addressing modes of SIC/XE
machine.
14. Write a subroutine in SIC/XE to read a 100 byte record from a device f5 into BUFFER.
15. List various data structures used in the assembling process. With an algorithm explain the usage of
these data structures in pass-two of a two-pass assembler.
16. Show the structure of head record, text record, modification record and end record taking one
example for each.
17. Write a program to initialize 26 locations with ASCII code A to Z using SIC/XE and generate object
code for the same.
18. Write a program in SIC/XE to add two arrays ALPHA, BETA of 100 words each, and stores the result
in a new array GAMMA of 100 words. And generate object code for the same.
19. Enlist the various assembler features that are machine dependent and explain any one in detail.
16
10. ORG
17
1. What is an interactive editor? Explain briefly, Structure of a typical editor with the help of suitable
block diagram.
2. Briefly discuss command language processor, traveling, editing, viewing and display functions
3. Explain the different debugging functions and debugging capabilities
4. List the important tasks to be accomplished by a text editor for an interactive user- computer
dialogue
5. With figure explain the structure of an editor
6. Briefly explain Debugging functions
7. Write a note on user interface criteria for interactive debugging systems
8.What is an interactive editor?
9.Explain the relationship between editing and viewing buffer?
Department of Information Science & Engineering, B M S Institute of Technology & Management
18
19
Yacc
7. What is shift/reduce parsing? Explain the parsing of the input fred = 12+13 and represent it using
parse tree.
8. Explain the ambiguity while passing 2+3*4. Explain the solution for it.
9. Write yacc program to recognize the given arithmetic expression containing +, -,*,/,unimus operator
with + and having highest precedence.
10. What do you mean by ambiguous grammar? How it can be overcome? Illustrate with an example.
11. Explain the structure of a Yacc program
12. Write a short nite on Parser Lexer communication.
13. What is Yacc? Explain the different sections used in writing the yacc specification.
14. What are conflicts? Explain different types of conflicts in YACC with examples
15. Write a YACC program to evaluate the given expression
16. Explain how grammar conflicts are handled by yacc? Write a yacc program for a desktop calculator.
17. Explain with an example recursive grammer
18. Write a YACC program to recognize the grammar abn / n > 0.
20
PEO2
PEO3
PROGRAMME OUTCOMES
Program outcomes are narrower statements that describe what students are expected to know and be
able to do by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of
Engineering Graduation students of Information science and Engineering program at B M S Institute of
Technology will attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate consideration for
the public health and safety, and the cultural, societal, and environmental considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
Department of Information Science & Engineering, B M S Institute of Technology & Management
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to ones own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Course Code
Core/Elective
Semester
Year
Operating System
10IS53
Core
2016
Lecture
Tutorials
Practical
Department
Vinutha K,
Assistant Professor,
Vinuthak_ise2014@bmsit.in
Operating system
Sub Code : 10IS72
Hrs/Week : 04
Total Hrs : 52
UNIT 1
IA Marks
:25
Exam Hours :03
Exam Marks :100
6 Hours
Introduction to Operating Systems, System structures: What operating systems do; Computer
System organization; Computer System architecture; Operating System structure; Operating System
operations; Process management; Memory management; Storage management; Protection and
security; Distributed system; Special-purpose systems; Computing environments.
System structures :Operating System Services; User - Operating System interface; System calls;
Types of system calls; System programs; Operating System design and implementation; Operating
System structure; Virtual machines; Operating System generation; System boot.
UNIT 2
7 Hours
UNIT 3
7 Hours
UNIT 4
6 Hours
Deadlocks: Deadlocks: System model; Deadlock characterization; Methods for handling deadlocks;
Deadlock prevention; Deadlock avoidance; Deadlock detection and recovery from deadlock.
PART B
UNIT 5
7 Hours
UNIT 6
7 Hours
File System, Implementation of File System: File System: File concept; Access methods; Directory
structure; File system mounting; File sharing; Protection. Implementing File System: File system
structure; File system implementation; Directory implementation; Allocation methods; Free space
management
UNIT 7
6 Hours
Secondary Storage Structures, Protection : Mass storage structures; Disk structure; Disk attachment;
Disk scheduling; Disk management; Swap space management. Protection: Goals of protection,
Principles of protection,Domain of protection, Access matrix, Implementation of access matrix,
Access control, Revocation of access rights, Capability-Based systems.
UNIT 8
6 Hours
Case Study: The Linux Operating System: Linux history; Design principles; Kernel modules; Process
management; Scheduling; Memory management; File systems, Input and output; Inter-process
communication.
Course Objectives
1. Abraham Silberschatz, Peter Baer Galvin, Greg Gagne: Operating System Principles, 8th edition, Wiley India, 2009. (Chapte
9.1 to 9.6, 10, 11.1 to 11.5, 12.1 to 12.6, 17.1 to 17.8, 21.1 to 21.9)
Reference Books:
1. D.M Dhamdhere: Operating systems - A concept based Approach,2nd Edition, Tata McGraw- Hill, 2002.
2. P.C.P. Bhatt: Introduction to Operating Systems: Concepts and Practice, 2nd Edition, PHI, 2008.
3. Harvey M Deital: Operating systems, 3rd Edition, Pearson Education, 1990.
Course Outcomes
CO1:Understand various types of operating systems, its operations, services, virtual machines and their
structure
CO2:Identify difference between process and threads and synchronization issues
CO3:Describe the operations of process, file , disk, I/O and memory management techniques for various OS
CO4: Analyse how deadlock occurs and methods to prevent/detect/avoid and implement them in
multiprogramming system.
CO5:Solve process, memory and disk scheduling based problems
CO6:Develop software programs for various OS concepts
COS/
POS
PO1
PO2
CO1
CO2
CO3
CO4
CO5
CO6
PO3
PO4
PO5
PO6
PO7
PO8
PO9
PO10
PO11
PO12
1
2
Total
18
18
12
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs need
not map all POS
No. of Hours: 52
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
Unit I
What operating systems do(user & sys
view), Computer System organization
10
11
12
Process Management
13
Scheduling algorithms
14
16
Petersons solution
17
Synchronization hardware
18
19
20
Process Synchronization
15
21
22
23
Deadlock
s
UNIT IV
Deadlocks: System model;
Deadlock characterization ,Methods for
handling deadlocks,
25
26
Deadlock detection
27
29
30
31
32
33
Memory Management
28
Paging
Structure of page table; Segmentation
Virtual Memory Management:
Background; Demand paging
Copy-on-write; Page replacement
problems
UNIT VI
34
36
37
38
39
40
35
10
42
Disk scheduling
43
44
45
46
41
UNIT VIII
Linux history; Design principles, Kernel
modules
48
49
50
51
52
47
25
100
11
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
D.1 Occupational Health & Safety (OH&S) Procedures
Since this course does not have a practical component, no need to undergo OH&S procedures
12
Question Bank
PART-A
UNIT-1
1. What are the three main purposes of an operating system?
2. What is the main advantage of multiprogramming?
3. What are the main differences between operating systems for mainframe computers and personal
computers?
4. Define the essential properties of the following types of operating systems:
a. Batch
b. Interactive
c. Time sharing
d. Real time
e. Network
f. Distributed
5.What are the differences between a trap and an interrupt? What is the use of each function?
6.What are the five major activities of an operating system in regard to process management?
7.What are the three major activities of an operating system in regard to secondary-storage management?
8.List five services provided by an operating system.
9.What is the main advantage of the layered approach to system design?
10. What is the main advantage for an operating-system designer of using a virtual-machine architecture?
11.What is the main advantage for a user?
UNIT-2
1. Describe the differences among short-term, medium-term, and long-term scheduling.
2. Describe the actions a kernel takes to context switch between processes.
3. What are two differences between user-level threads and kernel-level threads?
4. Describe the actions taken by a kernel to context switch between kernel-level threads.
5. What resources are used when a thread is created? How do they differ from those used when a process is
created?
6. Define the difference between preemptive and nonpreemptive scheduling
7. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:
Process Burst Time Priority P1 103
P2 11
P3 23
P4 14
P5 52
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptive
Department of Information Science & Engineering, B M S Institute of Technology & Management
13
UNIT-3
1. What is the meaning of the term busy waiting?
2. Explain semaphores with the help of an example.
3. Explain dining philosophers problem, and how it is solved.
4. What is race condition? Explain how it is handled.
5. Define process synchronization.
6. How is producer-consumer problem with the help of semaphores?
UNIT-4
For the following snapshot of the system find the safe sequence (using Bankersalgorithm).
a. Calculate the need of each process?
b. To find safe sequence?
2. Consider the following snapshot of the system and answer the following questions using
Bankersalgorithm?
14
UNIT-5
1. Name two differences between logical and physical addresses.
2. Explain the difference between internal and external fragmentation.
3. Describe the following allocation algorithms:
a. First fit
b. Best fit
c. Worst fit
4. Given memory partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would each of the
Firstfit,
Best-fit, and Worst-fit algorithms place processes of 212K, 417K, 112K, and 426K (in order)? Which
algorithm makes the most efficient use of memory?
5. Why are page sizes always powers of 2?
6. Consider a logical address space of eight pages of 1024 words each, mapped onto a physical memory of
32 frames.
a. How many bits are there in the logical address?
b. How many bits are there in the physical address?
7. Why are segmentation and paging sometimes combined into one scheme?
8. Under what circumstances do page faults occur? Describe the actions taken by the operating system
when a page fault occurs.
9. Which of the following programming techniques and structures are good for a demand paged
environment ?
10. Which are not good? Explain your answers.
a. Stack
b. Hashed symbol table
c. Sequential search
d. Binary search
Department of Information Science & Engineering, B M S Institute of Technology & Management
15
UNIT-6
1. Explain the purpose of the open and close operations.
2. Give an example of an application in which data in a file should be accessed in the following order:
a. Sequentially
b. Randomly
3. In some systems, a subdirectory can be read and written by an authorized user, just as ordinary files can
be.
a. Describe the protection problems that could arise.
b. Suggest a scheme for dealing with each of the protection problems you named in part a.
4. What is a file?
5. List sample file types, based on use, on the VAX under VMS.
6. What is a sequential file?
7. Can a direct access file be read sequentially? Explain.
8. List two types of system directories
9. List operations to be performed on directories
10. How do we overcome the disadvantages of the two-level directory?
UNIT-7
1. What are the main differences between capability lists and access lists?
2. What hardware features are needed for efficient capability manipulation? Can these be used for memory
protection? What protection problems may arise if a shared stack is used for parameter passing?
3. What is the need-to-know principle? Why is it important for a protection systemto adhere to this
principle?
4. Why is it difficult to protect a system in which users are allowed to do their own I/O?
5.. Describe how the Java protection model would be sacrificed if a Java program were allowed to directly
alter the annotations of its stack frame. What are two advantages of encrypting data stored in the
computer system.
UNIT-8
1.What are the main differences between capability lists and access lists?
Department of Information Science & Engineering, B M S Institute of Technology & Management
16
17
PEO2
PEO3
PROGRAMME OUTCOMES
Program outcomes are narrower statements that describe what students are expected to know and be able to do
by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of Engineering
Graduation students of Information Science & Engineering program at B M S Institute of Technology will
attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization to the solution of complex engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the public
health and safety, and the cultural, societal, and environmental considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
Department of Information Science & Engineering, B M S Institute of Technology & Management
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and design
documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to ones own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Course Code
10CS54
Lecture
Contact Hours/ week
Department
Name of the faculty with
Designation and mail ID
Core/Elective
Core
Tutorials
Semester
Year
2016
Practical
PART - A
UNIT 1
6 Hours
UNIT 2
6 Hours
Entity-Relationship Model: Using High-Level Conceptual Data Models for Database Design; An
Example Database Application; Entity Types, Entity Sets, Attributes and Keys; Relationship types,
Relationship Sets, Roles and Structural Constraints; Weak Entity Types; Refining the ER Design;
ER Diagrams, Naming Conventions and Design Issues; Relationship types of degree higher than
two.
UNIT 3
8 Hours
Relational Model and Relational Algebra : Relational Model Concepts; Relational Model
Constraints and Relational Database Schemas; Update Operations, Transactions and dealing with
constraint violations; Unary Relational Operations: SELECT and PROJECT; Relational Algebra
Operations from Set Theory; Binary Relational Operations : JOIN and DIVISION; Additional
Relational Operations; Examples of Queries in Relational Algebra; Relational Database Design
Using ER- to-Relational Mapping.
UNIT 4
6 Hours
SQL 1: SQL Data Definition and Data Types; Specifying basic constraints in SQL; Schema
change statements in SQL; Basic queries in SQL; More complex SQL Queries.
PART - B
UNIT 5
6 Hours
SQL 2 : Insert, Delete and Update statements in SQL; Specifying constraints as Assertion and
Trigger; Views (Virtual Tables) in SQL; Additional features of SQL; Database programming issues
and techniques;
Embedded SQL, Dynamic SQL; Database stored procedures and SQL / PSM.
UNIT 6
6 Hours
Database Design 1: Informal Design Guidelines for Relation Schemas; Functional Dependencies;
Normal Forms Based on Primary Keys; General Definitions of Second and Third Normal Forms;
Boyce-Codd Normal Form
UNIT 7
6 Hours
Database Design -2: Properties of Relational Decompositions; Algorithms for Relational Database
Schema Design; Multivalued Dependencies and Fourth Normal Form; Join Dependencies and Fifth
Normal Form; Inclusion Dependencies; Other Dependencies and Normal Forms
UNIT 8
8 Hours
Transaction Management: The ACID Properties; Transactions and Schedules; Concurrent Execution
of Transactions; Lock- Based Concurrency Control; Performance of locking; Transaction support in
SQL; Introduction to crash recovery; 2PL, Serializability and Recoverability; Lock Management;
Introduction to ARIES; The log; Other recovery-related structures; The write-ahead log protocol;
Checkpointing; Recovering from a System Crash; Media Recovery; Other approaches and
interaction with concurrency control.
LABORATORY WORK
The following experiments should be practiced:
1.
2.
3.
4.
Course Objectives
Reference Books:
1. Silberschatz, Korth and Sudharshan: Data base System Concepts, 6th Edition, McGrawHill, 2010.
2. C.J. Date, A. Kannan, S. Swamynatham: An Introduction to Database Systems, 8th
Edition, Pearson Education, 2006.
Recommended Reference Materials:
1. Notes
2. PPT
3. Videos
Web Resources:
CO1
CO2
CO3
CO4
CO5
CO6
Program Outcomes
PO1
PO2
PO3
CO1
PO4
PO5
PO6
PO7
PO8
PO9
PO10
PO11
PO12
CO3
CO4
CO5
CO6
2
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs need not
map all POS
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
UNIT I
Introduction; An example;
10
11
To understand ER Model
UNIT II
13
UNIT III
15
16
17
18
19
14
21
22
23
24
25
26
20
10
28
29
30
31
32
33
27
Informal Design
Relation Schemas
35
Functional Dependencies
36
37
38
39
34
Guidelines
for
11
40
Properties
of
Decompositions.
42
43
44
45
46
41
Relational
48
49
Concurrent Execution of
Transactions;
50
51
52
47
12
10%
50%
30%
10%
25
100
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
D.1 Occupational Health & Safety (OH&S) Procedures
Since this course has a practical component, students are required to undergo OH&S training PRIOR TO
ENTERING the laboratory. Students must undergo this training every year for use of this laboratory and their
successful completion will be documented. Students must follow the OH&S procedures meticulously and
failure to follow them will result in severe penalties, including exclusion from the College.
NOTE 5: Health and safety procedures have to be printed and displayed in the labs.
13
Course Materials Availability to Students and Others under the Right to Information Act (RTI) of
India
Materials
Course Objectives & Outcomes
Lecture notes & homes work assignments,
(mini)projects.
Sample solutions
Course performance (e.g., student surveys, etc)
Question Bank
UNIT 1
1. What are the responsibilities of DBA and Database designer? (04 marks Dec 2013)
2. With a diagram explain the components modules of DBMS and their interactions.
(08 marks Dec 2013)
3. List the advantages and disadvantages of DBMS. Discuss any five advantages by
comparing with file systems.
(08 marks Dec 2013)
4. Define the following with examples
14
5. Draw an ER diagram for maintain a movie database taking into account at least four
entities.
(10 marks Dec 2013)
UNIT 3
1. What do you mean by recursive relationship? Can a foreign key exist, only for a single
table? Explain
(04 marks Dec 2011)
2. What is meant by integrity constraint? Explain the importance of referential integrity
constraint. How referential integrity constraint is implemented in SQL.
(10 marks Dec 2012)
3. Consider the following schema and write the relational algebra(10 marks Dec 2012)
SAILOR (SID, SNAME, RATING, AGE)
BOATS (BID, BNAME, COLOR)
RESERVE (SID, BID, DAY)
i.
Retrieve the sailors names who have reserved red green boats.
ii.
Retrieve the sailors names with age over 20years and reserved black boat.
iii.
Retrieve the sailors names who have reserved green boat on Monday
iv.
Retrieve the sailors names who is the oldest sailor with rating 10.
15
v.
4. How can an interaction operator be implemented using union and minus operator?
(03 marks Dec 2011)
i.
ii.
Retrieve the name of the managers working in location named XYZ who has
no female dependents.
iii.
Retrieve the names of employee who works in the same department as that of
Raj
UNIT 4
1. Explain all possible options that can be specified when a referential integrity constraint
is violated using suitable examples for all options. (08 marks Dec 2011)
2. Write queries in SQL for the following.
Retrieve the name of the employee who gets second highest salary
ii.
For each department that has more than five employees, retrieve the department
number of its employee who have salary more than Rs.5000
16
iii.
Retrieve the name of employees whose salary is greater than all the employees
working in either department 5 or 6
Retrieve the student name who is studying under faculties of Mechanical dept.
ii.
Retrieve the student name who have enrolled under any of the courses in which
Kumar has enrolled
iii.
Retrieve the faculties name who earn salary which is greater than the average salary of
all the faculties
iv.
Retrieve the sname who are not been taught by faculty Kumar
v.
4. Describe the six clauses in the syntax of SQL. Retrieval Query .Show what type of
constructs can be specified in each of the six clauses. Which of the six clauses is
required and which are optional.
(06 marks Dec 2013)
5. Explain how the group by clause works. What is the difference between the where and
Having clause?
(06 marks Dec 2013)
UNIT 5
1. List the differences between independent nested and co- related nested query.
(04 marks Dec 2013)
17
UNIT 6
1. Suggest and Explain three different techniques to achieve 1NF using a suitable example.
(08 marks Dec 2011)
2. Differentiate between prime and non-prime attribute, with example. (04 marks Dec
2011)
3. Consider the relation R(A,B,C,D,E,F) and the FD A->B, C-> DF,AC-> E,D-> F. what is
the key and highest normal from of R? If it is not in 3NF find a decomposition that is
lossless and dependency preserving? (08 marks Dec 2011)
4. Consider R={ABCDEF}; FDS {A->BC,C->E,CD->EF} show that AD->F
marks Dec 2012)
Department of Information Science & Engineering, B M S Institute of Technology & Management
(06
18
5. What is the set of functional dependencies F said to be minimal? Give an algorithm for
finding a minimal cover G for F. (06 marks Dec 2012)
6. What do you mean by closure of attribute? Write an algorithm to find closure of
attributes.
(06 marks Dec 2013)
UNIT 7
1. What is dependency preservation property for decomposition? Why is it important?
(06 marks Dec 2013)
2. Define fourth normal form. When is it violated? Why is it useful? (06 marks Dec 2013)
3. Consider the following universal relation
UNIT 8
1. What are anomalies occur due to interleave execution? Explain them with example.
(08 marks Dec 2013)
19
2. Describe the steps in crash recovery in Aries. What is the goal of each phase?
(04 marks Dec 2013)
3. Write short notes on :
i.
ii.
ARIES algorithm
iii.
Embedded SQL
iv.
5. What is a schedule? Explain with example conflict serializable schedule. (08 marks Dec
2011)
(06
20
PEO2
PEO3
Program outcomes are narrower statements that describe what students are expected to know and be
able to do by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of
Engineering Graduation students of Information science and Engineering program at B M S Institute
of Technology will attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to ones own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
A) Course Administrator Details
Course Title
Course Code
COMPUTER NETWORKS - 1
10CS55
Lecture
Contact Hours/ week
Core/Elective
Core
Tutorials
52
Semester
Year
V SEM
2016
Practical
Department
Gireesh Babu C N
gireeshbabu@bmsit.in
Prerequisites for the Course 1.Students should possess the knowledge of Computers and its parts
(exemption from the prerequisites2. Basics of Network concepts.
is provided only in exceptional
circumstances)
Subject Code:
Hours/Week: 4
Total Hours : 52
I.A. Marks: 25
Exam Hours: 3
Exam Marks: 100
SYLLABUS
PART A
UNIT 1:
7 Hours
UNIT 2:
Layered
7 Hours
Physical Layer-1: Analog & Digital Signals, Transmission Impairment, Data Rate limits,
Performance, Digital-digital conversion (Only Line coding: Polar, Bipolar and Manchester
coding), Analog-to-digital conversion (only PCM), Transmission Modes, Digital-to -analog
conversion
UNIT 3:
6 Hours
UNIT 4:
6 Hours
Data Link Layer-1: Error Detection & Correction: Introduction, Block coding, linear block codes,
cyclic codes, Checksum.
PART B
UNIT 5:
07 Hours
Data Link Layer-2:Framing, Flow and Error Control, Protocols, Noiseless Channels, Noisy
channels, HDLC, PPP (Framing, Transition phases only)
UNIT 6:
06 Hours
Multiple Access & Ethernet: Random access, Controlled Access, Channelization, Ethernet: IEEE
standards, Standard Ethernet, Changes in the standard, Fast Ethernet, Gigabit Ethernet.
UNIT 7:
07 Hours
Wireless LANs and Cellular Networks: Introduction, IEEE 802.11, Bluetooth, Connecting devices,
Cellular Telephony.
UNIT 8:
7 Hours
Network Layer: Introduction, Logical addressing, IPv4 addresses, and IPv6 addresses, Internetwork
ing basics, IPv4, IPv6, Comparison of IPv4 and IPv6 Head ers.
Course Objectives
Web Resources:
1.VTU e-Learning
2.Youtube Videos on Networking
3.NPTEL Materials
Course Outcomes
CO1: Demonstrate the fundamental concepts of data communication
Department of Information Science & Engineering, B M S Institute of Technology & Management
Program Outcomes
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
CO1
CO2
CO3
CO4
CO5
CO6
PO9
PO10
PO11
PO12
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs
need not map all POS
No. of Hours: 52
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
UNIT I
1
Addressing
UNIT II
10
11
PHYSICAL
LAYER 1
12
13
Transmission Modes
14
15
Multiplexing
Multiplexing
17
Spread Spectrum
18
19
PHYSICAL
Circuit switched networks
LAYER 2,
SWITCHING
Datagram Networks
Virtual circuit Networks
20
UNIT IV
21
22
Block coding
23
24
DATA LINK
LAYER - 1
Block coding
Linear block codes
25
Cyclic codes
26
Checksum
UNIT V
27
Framing
28
29
30
Noiseless Channel
DATA LINK
Noisy Channel
LAYER 2
31
HDLC
32
UNIT VI
33
Random Access
34
Controlled Access
35
Channelization
36
37
MULTIPLE
ACCESS,
ETHERNET
38
Fast Ethernet
39
Gigabit Ethernet
UNIT VII
Introduction
40
IEEE 802.11
41
42
43
WIRELESS
LANs &
CELLULAR
NETWORKS
Bluetooth
Connecting Devices
44
Connecting Devices
45
Cellular Telephony
UNIT VIII
46
Introduction
47
Logical Addressing
48
IPv4 Addressing
49
NETWORK
LAYER
IPv6 Addressing
50
51
IPv6
52
10
25
100
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
D.1 Occupational Health & Safety (OH&S) Procedures
Since this course does not have a practical component, no need to undergo OH&S procedures
D.2 Ethics and Code of Conduct Policy
This course complies with the B M S Institute of Technology Policies on Ethics and Code of Conduct
as described in the website: www.Ethics&CodeofConductPolicy.
Accordingly, plagiarism in any student submissions, copying during assessments of any form and other
such unethical practices will not be tolerated at any time and failure to follow the rules will result in
severe penalties, including exclusion from the College.
NOTE 6 D.2 to be included for all courses.
Course Materials Availability to Students and Others under the Right to Information Act (RTI)
of India
Materials
Course Objectives & Outcomes
Lecture notes & homes work
assignments, (mini)projects.
Sample solutions
Course performance (e.g., student
surveys, etc)
11
Question Bank
UNIT I - Introduction to Networks
1 a. What is data communication? List and explain the five components of a data communication
system, with examples. 07 M
b. discuss the OSI-ISO layered model. Bringing out the functionalities of each layer. 10 M
c. define the key element of a protocol. 03 M
2 a. What is data communication? What are its characteristics and components? Explain. 06M
b. give the comparison between LAN,MAN and WAN with an example.06M
c. describe with a neat diagram. The functionalities of each layer in the TCP/IP model. 08M
3 a. What is data communication? What are its four important fundamental characteristics? 06M
b. What is a protocol? What are its key elements? 02M
c. Explain OSI reference model. With a neat figure explain. 08M
d. Differentiate between:04M
i. ARP and RARP
ii. ICMP and IGMP
iii. UDP and TCP
4 a. with neat diagram explain mesh topology with applications of each.06M
b. what are standards ? Name any four standard organizations.06M
c. explain OSI reference model with functions of following layers. 08M
i) Physical layer ii) Data link layer iii) Network layer
12
13
14
15
16
17
18
PEO2
PEO3
PROGRAMME OUTCOMES
Program outcomes are narrower statements that describe what students are expected to know and be
able to do by the time of graduation. These relate to the skills, knowledge and behavior. Bachelor of
Engineering Graduation students of Information science and Engineering program at B M S Institute of
Technology will attain the following program outcomes.
Program Outcomes:
After the successful completion of the course, the graduate will be able to
PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering problems.
PO2: Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics, natural
sciences, and engineering sciences.
PO3: Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate consideration for
the public health and safety, and the cultural, societal, and environmental considerations.
PO4: Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
Department of Information Science & Engineering, B M S Institute of Technology & Management
sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms
of the engineering practice.
PO9: Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
PO10: Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write effective
reports and design documentation, make effective presentations, and give and receive clear instructions.
PO11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to ones own work, as a member and leader in
a team, to manage projects and in multidisciplinary environments.
PO12: Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Course Code
Core/Elective
Semester
Year
10CS56
Core
2016
Lecture
Tutorials
Practical
Department
Ashwini N
Assistant Professor,
ashwinilaxman@bmsit.in
IA Marks
:25
Exam Hours :03
Exam Marks :100
PART A
UNIT 1
7 Hrs
UNIT 2
7 Hrs
Finite Automata, Regular Expressions: An application of finite automata; Finite automata with
Epsilon-transitions; Regular expressions; Finite Automata and Regular Expressions; Applications of
Regular Expressions.
UNIT 3
6 Hrs
Regular Languages, Properties of Regular Languages: Regular languages; Proving languages not
to be regular languages; Closure properties of regular languages; Decision properties of regular
languages; Equivalence and minimization of automata.
UNIT 4
6 Hrs
Context-Free Grammars And Languages: Context free grammars; Parse trees; Applications;
Ambiguity in grammars and Languages.
PART B
Department of Information Science & Engineering, B M S Institute of Technology & Management
UNIT 5
7Hrs
Pushdown Automata: Definition of the Pushdown automata; the languages of a PDA; Equivalence
of PDAs and CFGs; Deterministic Pushdown Automata.
UNIT 6
6 Hrs
Properties of Context-Free Languages: Normal forms for CFGs; The pumping lemma for CFGs;
Closure properties of CFLs.
UNIT 7
7 Hrs
Introduction To Turing Machine: Problems that Computers cannot solve; The turning machine;
Programming techniques for Turning Machines; Extensions to the basic Turning Machines; Turing
Machine and Computers.
UNIT 8
6 Hrs
Undecidability: A Language that is not recursively enumerable; An Undecidable problem that is RE;
Posts Correspondence problem; other undecidable problems.
Course Objectives
1. John E. Hop croft, Rajeev Motwani, Jeffrey D.Ullman: Introductionto Automata Theory,
Languages and Computation, 3rd Edition, Pearson Education, 2007.
(Chapters: 1.1, 1.5, 2.2 to 2.5, 3.1 to 3.3, 4, 5, 6, 7, 8.1 to8.4, 8.6, 9.1, 9.2, 9.4.1, 9.5)
Reference Books:
1. K.L.P. Mishra: Theory of Computer Science, Automata, Languages, and Computation, 3rd Edition,
PHI, 2007.
2. Raymond Greenlaw, H.James Hoover: Fundamentals of the Theory of Computation, Principles and
Practice, Morgan Kaufmann, 1998.
3. John C Martin: Introduction to Languages and Automata Theory, 3rd Edition, Tata McGraw-Hill,
2007.
4. Thomas A. Sudkamp: An Introduction to the Theory of Computer Science, Languages and
Machines, 3rd Edition, Pearson Education, 2006.
Recommended Reference Materials:
1. Notes
2. PPT
3. Videos
Web Resources:
1. http://www.ics.uci.edu/~goodrich/teach/cs162/notes/
2. https://www.iitg.ernet.in/dgoswami/Flat-Notes.pdf
3. http://nptel.ac.in/courses/111103016/
Course Outcomes
CO1: Design Deterministic finite automata, Nondeterministic finite automata, conversion of NFA to DFA,
design of E- NFA and regular expressions.
CO2: Obtain minimized DFA and convert automata to regular expressions and regular expression to automata
and proving languages are not regular.
CO3: Writing CFGs, Construction of parse trees, finding and removing ambiguity in grammars, designing
problems on Pushdown Automata.
CO4: Conversion of grammar to Chomsky Normal Form , Greibach normal form and conversion of grammar
to PDA .Prove that languages are not context free using pumping lemma.
CO5: Designing Turing machines, understanding the working of various types of Turing machines and solving
post correspondence problems.
COS/
POS
PO1
PO2
CO1
CO2
PO3
Total
PO6
PO7
PO8
PO9
PO10
PO11
1
9
PO12
1
2
CO4
PO5
CO3
CO5
PO4
2
1
1
1
1
NOTE: Mapping in terms of Slight (1), Moderate (2), Good (3) and Excellent (4) levels and COs need
not map all POS
Name of the Faculty: Prof.Ashwini N
No. of Hours: 52
LESSON PLAN
Lecture
No
Learning
Objective
Topic to be covered
Remarks
1
2
3
4
Introduction to
Finite Automata
Unit I
Introduction to Finite Automata.
The central concepts of Automata
theory.
Deterministic finite automata.
Problems on Deterministic finite
automata.
6
7
UNIT II
8
10
11
12
13
Finite Automata,
Regular Expressions
14
15
UNIT IV
Construction of Context-Free Grammars
16
17
18
19
ContextFree
Grammars
And
Languages
20
Applications
21
22
23
24
25
26
UNIT VI
CNF
GNF
The pumping lemma for CFGs
Closure properties of CFLs
Closure properties of CFLs
30
31
32
33
Pushdown Automata
28
29
34
35
36
Regular
37
Languages,
38
Properties
39
of Regular
Languages
40
UNIT VII
Introduction To Turing Machine
42
43
44
45
46
Introduction To Turing
Machine
41
50
51
52
Undecidability
48
49
25
100
TOTAL
125
NOTE 4: The administration of the Final exam/s and their evaluation is carried out by VTU directly
and with little direct input from the College.
D) Other Important Details
D.1 Occupational Health & Safety (OH&S) Procedures
Since this course does not have a practical component, no need to undergo OH&S procedures
10
Course Materials Availability to Students and Others under the Right to Information Act (RTI)
of India
Materials
Course Objectives & Outcomes
Lecture notes & homes work
assignments, (mini)projects.
Sample solutions
Course performance (e.g., student
surveys, etc)
Question Bank
1
(10 Marks)
i)
Alphabets and power of an alphabet
ii)
Language
iii)
DFA, NFA and -NFA
Define Finite automata and discuss why study automata?
(5 Marks)
(10 Marks)
i)
All strings with exactly one a
ii)
All strings with at least one a
iii)
All strings except those which end with abb
Obtain a DFA to accept the language L = w | w (a + b)*; Na (w)mod 3 = 2 and Nb(w)
mod 2 = 1}
(8 Marks)
(6 Marks)
(10 Marks)
->p
{q, s}
{q}
11
{s}
{p}
*s
{p}
(8 Marks)
(8 Marks)
Start
q0
(8 Marks)
0
1
q1
q1
q0
q1, q2
q2
q1
(8 Marks)
Obtain an NFA to accept strings of as and bs ending with ab or ba. From this NFA obtain
an equivalent DFA using subset construction.
(8 Marks)
10a
Let r be a regular expression, show that there exists some NFA that accepts L(r)
(6 Marks)
10b
(4 Marks)
i)
ii)
(6 Marks)
11a
12
11b
12
(6 Marks)
(6 Marks)
13
Prove that there exists a finite automata to accept the language L(R) corresponding to
the RE R.
(6 Marks)
14
Obtain an NFA to accept the language consisting of as and bs ending with string ab or ba
and convert it into equivalent DFA.
(10Marks)
15
Define regular expressions and the languages accepted by the regular expressions.
(4 Marks)
16
Prove that every language defined by a regular expression is also defined by a finite
automation.
(10Marks)
17
(6 Marks)
18
i)
Strings with 0s and 1s containing substring 10.
ii)
Strings of as, bs containing at least one a in it.
Minimize the following DFA using Table filling algorithm.
(8 Marks)
->A
*D
13
20
Minimize the following DFA using table-filling algorithm where A is the start state. The
states C, F, I are final states.
0
*C
*F
*I
(10 Marks)
(7 Marks)
(10 Marks)
22
(10 Marks)
S ->AbB
A ->aA |
B->ab | bB |
Give leftmost derivation, rightmost derivation and parse tree for the string aaabab.
23
(8 Marks)
(7 Marks)
14
A ->bBb
B -> A |
Construct the derivation tree.
25
(5 Marks)
S ->aS | aSbS |
26
When the language is said to be inherently ambiguous? Show that the following grammar (7 Marks)
is ambiguous.
S-> AB | aaB
A -> a | aA
B -> b
Construct an unambiguous grammar equivalent to above grammar.
27
Discuss the languages accepted by a PDA. Design a PDA for the language that accepts the
strings with na(w) <nb(w).
(14 Marks)
28
Obtain a PDA to accept the language L = {anbn | n>=0} by a final state. Give the graphical
representation for PDA obtained. Show the moves made by the PDA for the aaabbb.
(10 Marks)
29
Design a PDA to accept the language L = {anb2n | n>= 1}. Give the graphical
representation for PDA obtained. Show the moves made by the PDA for the string
aabbbb.
(10 Marks)
30
(8 Marks)
S->aABB | aAA
A->aBB | a
B->bBB | A
C-> a
31
(4 Marks)
S ->aA
A ->aA | bA | a | b
15
(4 Marks)
E -> E + E
E -> E * E
E -> E / E
E -> E E
E -> (E) | a | b
34
(4 Marks)
35
i)
Languages of a PDA
ii)
Instantaneous Description
Write the CFG for the following languages:
(7 Marks)
36
i)
L = {aibjck:i+j=k,i0,j0}
ii)
L = { anbmck: n+2m=k}
Define CFG and write the grammar for the following languages.
(8 Marks)
37
i)
L = {anb2n: n1}
ii)
L = {anbn+3 : n>0}
Define CFG. Construct the CFG for the language
(10 Marks)
L = {anwwrbn: w{a,b}*}
38
(12 Marks)
39
(5 Marks)
40
i) Grammar ii) CFG iii)Leftmost Derivation iv) Rightmost derivation v)Derivation tree
Write the CFG for the following languages:
(9 Marks)
41
iii)
L = {aibjck:i+j=k,i0,j0}
iv)
L = { anbmck: n+2m=k}
Define CFG and write the grammar for the following languages.
(10
Marks)
16
L = {anbn+3 : n>0}
(10 Marks)
L = {anwwrbn: w{a,b}*}
43
44
iv)
L = { xy | w (a+b)* and y(ab or ba)}. Show the RMD for the string aabbba
along with derivation tree.
(12 Marks)
(5 Marks)
ii) Grammar ii) CFG iii)Leftmost Derivation iv) Rightmost derivation v)Derivation tree
45
(9 Marks)
46
i)
Eliminate productions
ii)
iii)
What are useless symbols? Eliminate useless symbols and productions from the following
grammar.
(10 Marks)
S->abA | bB
A->aA|d
B->bB
Department of Information Science & Engineering, B M S Institute of Technology & Management
17
E->aC|a
47
Eliminate the useless symbol from the following grammar. Also eliminate the useless
productions.
(6 Marks)
S->aB | aCD | aE
B->bC
C->aB | b
D ->aE
E->bCD
48
Find a CFG without -productions, unit productions and useless productions equivalent
to the grammar defined by
(12 Marks)
S->ABaC
A -> BC
B-> b |
C -> D |
D -> d
49
Define Unit, useless and -productions. Convert the following grammar into CNF. E ->
E+T|T, T->T*F|F, F->(E)|I, I->Ia|Ib|a|b.
(10 Marks)
50
What is Chomsky Normal Form? Convert the following grammar to Chomsky Normal
Form.
(5 Marks)
S ->ABa
A ->aab
B -> Ac
51
(4 Marks)
52
What are CNF and GNF? Obtain the following grammar in CNF.
(10 Marks)
S->aBa | abba
A ->ab | AA
Department of Information Science & Engineering, B M S Institute of Technology & Management
18
What are CNF and GNF of grammar? Obtain the CNF notation for the following grammar.
(8 Marks)
S->ASB
A->aAS | a
B->SbS | aAS | a|bb
54
(7 Marks)
S ->abAB
A->bAb |
B -> Baa | A| into CNF.
55
(4 Marks)
S -> AB
A ->aA | bB | b
B -> b
56
If L1 and L2 are context free languages then prove that family of Context free languages
are closed under Union and concatenation operations.
(6 Marks)
57
If L1 and L2 are two context free languages then prove that L1UL2, L1.L2 and L1* are CFLs.
(6 Marks)
58
(10 Marks)
59
(6 Marks)
60
What is Turing Machine? With a neat sketch, explain the working of Turing Machine.
(8 Marks)
61
Design Turing Machine to accept all set of palindromes over {0,1}*. Also write its
transition diagram and instantaneous description on the string 10101
(14 Marks)
62
Define a Turing Machine. Design a Turing Machine to accept the language L={anbncn:n1}.
Draw the transition diagram. Show the moves made by this Turing Machine for the string
aabbcc.
(12 Marks)
19
2016-2017
2016-2017
Prepared by
Dr.Manjunath T N
Reviewed by
HOD/ISE
2016-2017
IA Marks : 25
Exam Hours : 03
Exam Marks : 50
2016-2017
3. Consider the following database of student enrollment in courses & books adopted for each course:
STUDENT (regno: string, name: string, major: string, bdate:date)
COURSE (course #:int, cname:string, dept:string)
ENROLL ( regno:string, course#:int, sem:int, marks:int)
BOOK _ ADOPTION (course# :int, sem:int, book-ISBN:int)
TEXT (book-ISBN:int, book-title:string, publisher:string,author:string)
(1) Create the above tables by properly specifying the primary key and the foreign keys.
(2) Enter at least five tuples for each relation.
(3) Demonstrate how you add a new text book to the database and make this book be adopted by some
department.
(4) Produce a list of text books (include Course #, Book-ISBN, Book-title) in the alphabetical order for
courses offered by the CS department that use more than two books.
(5) List any department that has all its adopted books published by a specific publisher.
(6) Generate suitable reports.
(7) Create suitable front end for querying and displaying the results.
2016-2017
Instructions:
1. The exercises are to be solved in an RDBMS environment like Oracle or DB2.
2. Suitable tuples have to be entered so that queries are executed correctly.
3. Front end may be created using either VB or VAJ or any other similar tool.
4. The student need not create the front end in the examination. The results of the queries may be displayed
directly.
5. Relevant queries other than the ones listed along with the exercises may also be asked in the examination.
6. Questions must be asked based on lots.
2016-2017
Exercise-1:
1. Consider the following relations containing student class information:
Student (snum: integer, sname: string, major: string, level: string, age: integer)
Class (cname: string, meets at: time, room: string, fid: integer)
Enrolled (snum: integer, cname: string)
Faculty (fid: integer, fname: string, deptid: integer)
Step-1: ER Diagram Design
SNAME
SNUM
MEETS AT
SNUM
MAJOR
ROOM
NAME
STUDENT
CLASS
ENROLL
Dept
LEVEL
AGE
CNAME
TEACHES
FACULTY
FID
DEPTID
FNAMEE
2016-2017
Sname
Major
Level Age
FACULTY
Fname
Fid
CLASS
Cname
Meetsat
Room
deptid
fid
ENROLLED
Snum
Cname
The table STUDENT contains the attributes namely snum, sname, major, Level & age where the snum
is primary key.
The table CLASS contains the attributes such as cname, meetsat, room & fid where the primary key is
cname.
The table FACULTY contains the attributes such as fid,fname & deptid where the primary key is fid.
The table ENROLLED contains the attributes snum & cname, both the attributes are foreign key &
they together constitute the composite key.
STUDENT
Snum
Sname
Major
Level
Age
ENROLLED
Snum
Cname
CLASS
Cname
Meetsat
Room
Fid
FACULTY
Fid
Fname
Deptid
2016-2017
STUDENT TABLE:
===================
create table student
(snum number primary key,
sname varchar2(20),
major varchar2(10),
level1 varchar2(10),
age number);
CLASS TABLE:
================
create table class
(cname varchar2(10) primary key,
meetsat varchar2(10),
room varchar2(10),
fid number);
FACULTY TABLE:
==================
create table faculty
(fid number primary key,
fname varchar2(10),
deptid number);
ENROLLED TABLE:
===================
create table enrolled
(snum number,
cname varchar2(10)
foreign key(snum) references student(snum),
foreign key(cname) references class(cname),
primary key(snum,cname)
);
===============================================================
2016-2017
2016-2017
2. Find the names of all classes that either meet in room R128 or have five or more students enrolled.
SQL>SELECT C.cname
FROM Class C
WHERE C.room = 'R128'
OR C.cname IN (SELECT E.cname
FROM Enrolled E
GROUP BY E.cname HAVING COUNT (*) >= 5)
3. Find the names of all students who are enrolled in two classes that meet at the same time.
SQL> SELECT DISTINCT S.*
FROM Student S
Copyright Dept. of ISE, BMSIT-Bengaluru
2016-2017
4. Find the names of faculty members who teach in every room in which some class
is taught.
SQL> select * from faculty
where fid
in(select fid from
(select count(room) cnt,fid from class group by fid)
where cnt=(select count(distinct(room)) from class));
5. Find the names of faculty members for whom the combined enrollment of the courses that they teach is less
than five.
SQL> select fid,fname
From faculty
where fid in(
select fid from
(select count(1) cnt,fid
From (SELECT E.snum,c.fid
FROM Class C, Enrolled E
WHERE C.cname = E.cname)
group by fid) where cnt<5)
2016-2017
2016-2017
Exercise-2:
Consider the following relations containing airline flight information:
Flights (flno: integer, from: string, to: string, distance: integer, departs: time, arrives: time, price: real)
Aircraft (aid: integer, aname: string, cruisingrange: integer)
Certified (eid: integer, aid: integer)
Employees (eid: integer, ename: string, salary: integer)
Note that the Employees relation describes pilots and other kinds of employees as well; every pilot is certified for
some aircraft (otherwise, he or she would not qualify as a pilot), and only pilots are certified to fly.
Step-1: ER Diagram Design:
From
To
Ename
Fno
Flno
FLIGHTS
Departs
Arrives
EMPLOYEE
FLYS
Price
Salary
Eid
Distance
Eid
CERTIFIES
AIRCRAFT
Cruisingrange
Aid
Aname
2016-2017
To
AIRCRAFT
Aid
Aname
Eid
Cruisingrange
CERTIFIED
EID
AID
FLIGHT
AIRCRAFT
Fno
From
To
Distance
Departure
Arrival
Price
Aid
Aname
Cruisingrange
EMPLOYEE
CERTIFIED
Eid
Aid
Eid
Ename
Salary
Ename
Salary
2016-2017
to1 varchar2(10),
distance number,
departs date,
arrives date,
price number(10,2));
AIRCRAFT TABLE:
===================
create table Aircraft
(aid number primary key,
aname varchar2(10),
cruisingrange number);
CERTIFIED TABLE:
====================
create table Certified
(eid number,
aid number,
foreign key(eid) references employee(eid),
foreign key(aid) references aircraft(aid),
primary key(eid,aid));
EMPLOYEES TABLE:
===================
create table Employees
(eid number primary key,
ename varchar2(10),
salary number(10,2));
======================================================
2016-2017
2016-2017
2016-2017
2. For each pilot who is certified for more than three aircrafts, find the eid and the maximum cruising range of
the aircraft for which she or he is certified.
SQL> SELECT C.eid, MAX(A.cruisingrange)
FROM Certified C, Aircraft A
WHERE C.aid = A.aid
GROUP BY C.eid
HAVING COUNT (*) > 3
3.Find the names of pilots whose salary is less than the price of the cheapest route from bengaluru to
Frankfurt.
SQL>SELECT E.*
FROM Employees E, Flights F
WHERE F.from1 = 'BANGLORE' AND F.to1 = 'FRANKFURT' AND E.salary <F.price
4. For all the aircraft with cruising range over 1000 kms, find the name of the aircraft and the average salary
of all pilot certified for this aircraft.
2016-2017
SQL>select avg(salary),aname
from
(SELECT E.*,A.*
FROM Certified C, Employees E, Aircraft A
WHERE A.aid = C.aid AND E.eid = C.eid AND A.cruisingrange > 1000)
group by aname
6.Find the aircraft ids for all aircraft that can be used on routes from Bengaluru to New delhi.
SQL> SELECT A.aid
FROM Aircraft A
WHERE A.cruisingrange >
( SELECT MIN (F.distance)
FROM Flights F
WHERE F.from1 = 'BANGLORE' AND F.to1 = 'DELHI' )
2016-2017
2016-2017
2016-2017
III.
STUDENT
REGNO
---------------1AY01IS01
1AY01CS02
1AY01ME03
1AY01EC04
NAME
--------------VINOD
DIVYA
MAHESH
ARUN
MAJOR
-------------ISE
CSE
MECH
E&C
BDATE
--------------02-JAN-84
12-OCT-85
23-SEP-82
21-FEB-84
1AY01CS05
COURSE
COURSE_NO
----------------11
22
33
44
55
2016-2017
NANDU
CNAME
------------DCS
ADA
CN
TD
MUP
CSE
20-MAY-79
DEPT
--------------CSE
CSE
E&C
MECH
E&C
ENROLL
REGNO
COURSE
----------------- -------------1AY01IS01
11
1AY01IS01
22
1AY01CS02
33
1AY01ME03
22
1AY01CS05
44
SEM
-------5
3
6
5
5
MARKS
------------76
90
55
75
7
ISBN
PUBLISHER
TEXT
--------7722
1144
4400
5566
3388
BOOK_TITLE
-------------------VB
DSWITHC
CPROG
CN
MP
BOOK_ADOPTION
COURSE _NO
--------------11
22
11
11
----------------PHI
SAPNA
PHI
PHI
TATA
SEM
---------3
4
5
8
ISBN
----------7722
7722
4400
5566
AUTHOR
--------------------HOLZNER
NANDAGOPAL
BALAGURU
TENENBAUM
BREY
55
44
44
33
2016-2017
4
4
7
5
3388
5566
3388
3388
IV.
DEMONSTRATE HOW YOU ADD NEW TEXT BOOK TO THE DATABASE AND MAKE
THAT BOOK IS ADOPTED BY SOME DEPARTMENT.
INSERT INTO TEXT VALUES (1000,'ORACLE','MINIYA','BARY');
INSERT INTO COURSE VALUES (10,'ORACLE','ISE');
INSERT INTO BOOK_ADOPTION VALUES (10, 1, 1000);
V.
PRODUCE A LIST OF TEXTBOOKS (INCLUDE COURSE, BOOK_ISBN, BOOK_TITLE) IN
THE ALPHABETIC ORDER FOR COURSES OFFERED BY THE CSE DEPT THAT USE MORE
THAN TWO BOOKS.
SELECT C.COURSE, CNAME, B.ISBN, BOOK_TITLE
FROM COURSE C, BOOK_ADOPTION B, TEXT T
WHERE C.COURSE=B.COURSE AND B.ISBN=T.ISBN AND
C.COURSE IN (
SELECT C1.COURSE
FROM COURSE C1, BOOK_ADOPTION B1
WHERE DEPT=CSE AND C1.COURSE=B1.COURSE
GROUP BY C1.COURSE
HAVING COUNT (*)>2)
ORDER BY CNAME;
VI.
LIST ANY DEPARTMENT THAT HAS ALL ITS ADOPTED BOOKS PUBLISHED BY A
SPECIFIC PUBLISHER.
SELECT DISTINCT C.DEPT FROM COURSE C
WHERE C.DEPT
IN ( SELECT C1.DEPT
FROM COURSE C1, BOOK_ADOPTION B, TEXT T
WHERE T.PUBLISHER='PHI' AND B.ISBN=T.ISBN AND
C1.COURSE=B.COURSE)
AND C.DEPT NOT
IN ( SELECT C2.DEPT FROM COURSE C2, BOOK_ADOPTION B1,TEXT T1
WHERE T1.PUBLISHER! ='PHI' AND C2.COURSE=B1.COURSE
AND B1.ISBN=T1.ISBN
);
Copyright Dept. of ISE, BMSIT-Bengaluru
I.
2016-2017
2016-2017
III.
AUTHOR
AUTHORID
---------------1000
2000
3000
4000
5000
PUBLISHER
2016-2017
ANAME
--------- -----MANJUNATH
TONY
TONIER
TENNENBAUM
BALGURU
PUBLISHERID
PNAME
----------- -------- ----- -------11
WEILY
22
PHI
33
SAPNA
44
TMH
55
WROX
ACITY
ACOUNTRY
---------------------------------------BANGALORE
INDIA
HAYHOOD
USA
NEWYORK
USA
LONDON
UK
CHENNAI
INDIA
PCITY
---- ---------------NEWDELHI
CALIFORNIA
BANGALORE
NEWYORK
TEXAS
PCOUNTRY
-----------INDIA
USA
INDIA
USA
USA
CATEGORY
CATEGORYID
---------- --------1
2
3
4
5
DESCRIPTIONM
-----------------------OS
LANGUAGES
HARDWARE
ALGORITHMS
INTERNET
CATALOG
BOOKID
-----------1
2
3
4
5
TITLE AUTHORID
PUBLISHERID CATEGORYID
YEAR
PRICE
---------- ------------------ ------------------------------------- --------- ----------DSC
1000
33
2
2000
190
N/W
4000
44
4
2002
365
VB-6
2000
11
2
2000
300
SE
4000
44
5
2002
500
ADA
1000
33
4
2000
200
ORDER_DETAILS
2016-2017
ORDERNO
BOOKID QUANTITY
--------- ---------- ---------------------------100
1
100
200
1
20
300
2
20
400
3
50
500
5
8
IV.
GIVE THE DETAILS OF THE AUTHORS WHO HAVE TWO OR MORE BOOKS IN THE
CATALOG AND THE PRICE OF THE BOOKS IS GREATER THAN THE AVERAGE PRICE OF THE
BOOKS IN THE CATALOG & THE YEAR OF PUBLICATION IS AFTER 2000.
SELECT * FROM AUTHOR A
WHERE A.AUTHORID
IN (SELECT C.AUTHORID
FROM CATALOG C
WHERE C.PRICE > (SELECT AVG (PRICE) FROM CATALOG)
AND
C.YEAR>2000
GROUP BY C.AUTHORID
HAVING COUNT (*)>=2
);
V.
2016-2017
VI.
DEMONSTRATE HOW YOU INCREASE THE PRICE OF BOOK PUBLISHED BY A SPECIFIC
PUBLISHER BY 10%
UPDATE CATALOG SET PRICE = PRICE+PRICE*0.10
WHERE PUBLISHERID
IN (
SELECT P.PUBLISHERID
FROM PUBLISHER P
WHERE P.PNAME='&PNAME'
);
2016-2017
(15),
(15),
(15),
2016-2017
III.
2016-2017
BRANCH
BRANCH_NAME
--------------------------KUMBALAGODU
JAYANAGAR
VIJAYANAGAR
KUVEMPUNAGAR
GOKULUM
BRANCH_CITY
-----------------------BANGALORE
BANGALORE
BANGALORE
MYSORE
MYSORE
ASSETS
------------200000
100000
300000
100000
100000
CUSTOMER
CUSTOMER_NAME
CUSTOMER_ADDRES
CUSTOMER_CITY
--------------- --------------- -------------------------------------------------------RAVI
VIJAYANAGAR
BANGALORE
HARISH
BULLTEMPLEROAD
BANGALORE
BHAVYA
GANDHIBAZAR
BANGALORE
SRIRAM
KUMBALAGODU
BANGALORE
RANI
MGROAD
BANGALORE
ACCOUNT
ACCOUNT_NUMBER
BRANCH_NAME
BALANCE
--------------- -----------------------------------------------------------------101
KUMBALAGODU
2000
102
KUMBALAGODU
3000
103
VIJAYANAGAR
4000
104
KUVEMPUNAGAR
5000
105
GOKULUM
5000
106
JAYANAGAR
6000
107
KUMBALAGODU
5000
2016-2017
DEPOSITOR
CUSTOMER_NAME
ACCOUNT_NUMBER
--------------- ----------------------------------------- RAVI
101
HARISH
102
RAVI
103
SRIRAM
104
RAVI
107
RAVI
106
LOAN
LOAN_NUMBER
BRANCH_NAME
----------- --------------- --------------------------201
KUMBALAGODU
202
JAYANAGAR
203
VIJAYANAGAR
204
KUVEMPUNAGAR
205
GOKULUM
BORROWER
CUSTOMER_NAME
-----------------------RAVI
HARISH
BHAVYA
SRIRAM
RANI
LOAN_NUMBER
-----------------------201
202
203
204
205
AMOUNT
----------10000
20000
30000
40000
50000
2016-2017
IV.
FIND ALL CUSTOMERS WHO HAVE ACCOUNT AT ALL THE BRANCHES LOCATED IN A
SPECIFIC CITY
SELECT * FROM CUSTOMER C
WHERE
NOT EXISTS ( SELECT BRANCH_NAME
FROM BRANCH
WHERE BRANCH_CITY ='&BRANCH_CITY'
MINUS
SELECT A.BRANCH_NAME
FROM ACCOUNT A, DEPOSITOR D
WHERE D.ACCOUNT_NUMBER=A.ACCOUNT_NUMBER
AND C.CUSTOMER_NAME=D.CUSTOMER_NAME
);
V.
FIND ALL CUSTOMERS WHO HAVE AT LEAST TWO ACCOUNTS AT THE MAIN BRANCH
SELECT * FROM CUSTOMER C
WHERE
EXISTS ( SELECT CUSTOMER_NAME,COUNT(D.CUSTOMER_NAME)
FROM
DEPOSITOR D, ACCOUNT A
WHERE D.ACCOUNT_NUMBER=A. ACCOUNT_NUMBER
AND C.CUSTOMER_NAME=D.CUSTOMER_NAME AND
A.BRANCH_NAME='KUMBALAGODU' GROUP BY
D.CUSTOMER_NAME
HAVING COUNT (D.CUSTOMER_NAME)>=2
);
VI.
DEMONSTRATE HOW YOU DELETE ALL THE TUPLES AT EVERY BRANCH LOCATED IN
A PARTICULAR CITY.
DELETE FROM ACCOUNT
WHERE BRANCH_NAME
IN ( SELECT B.BRANCH_NAME
FROM BRANCH B
WHERE B.BRANCH_CITY='BANGALORE'
);
2016-2017
Create the necessary FORM using label, textbox & button controls.
STEP 2:
6. To set the connection [property click on BUILD button & You get a
Data Link Dialog box as follows
2016-2017
2016-2017
2016-2017
10. Click on RecordSource TAB & select 2 - adCmdTable. Wait till the tables
are listed in the Table combo Box
Copyright Dept. of ISE, BMSIT-Bengaluru
2016-2017
STEP 4:
2016-2017
2016-2017
End Sub
4. Double click on the Delete button & add the following code
Private Sub Delete_Click()
adcBranch.Recordset.Delete
adcBranch.Recordset.Save
MsgBox "Record Deleted..."
adcBranch.Recordset.MoveNext
End Sub
5. Execute the program
1. Select Run menu
2. Click on start sub menu
*********
1. Define Database
2016-2017
VIVA Questions
2016-2017
2016-2017
Prepared by
Mrs. Pushpha S K
Reviewed by
HOD/ISE
CONTENTS
Sl.No
1.
2.
5.
6.
Particulars
PART A
LEX and YACC Programs:
Design, develop, and execute the following programs using LEX:
1a: Program to count the number of characters, words, spaces and lines
in a given input file.
1b: Program to count the numbers of comment lines in a given C
program. Also eliminate them and copy the resulting program into
separate file.
2a. Program to recognize a valid arithmetic expression and to
recognize the identifiers and operators present. Print them
separately.
2b. Program to recognize whether a given sentence is simple or
compound.
Program to recognize and count the number of identifiers in a given
input file.
Design, develop and execute the following programs using YACC:
4a. Program to recognize a valid arithmetic expression nvolving
operators +,-,* and /.
4b. Program to recognize a valid variable which starts with a letter,
followed by any number of letters or digits.
5a. Program to evaluate an arithmetic expression involving operators
+, -, * and /.
5b. Program to recognize strings aaab, abbb, ab and a using
grammar (anbn, n>=0).
Program to recognize the grammar (anb, n>=10).
PART B
UNIX Programming:
Design, develop, and execute the following programs:
7a. Non-recursive shell scripts that accepts any number of arguments
and prints them in the reverse order, (For example, if scripts is named
rargs, then executing rargs A B C should produce C B A on the
Standard output)
7b. C Program that creates a child process to read commands from the
standard input and execute them ( a minimal implementation of a shelllike program). You can assume that no arguments will be passed to the
commands to be executed.
8a. Shell Script that accepts two file names as arguments, checks if the
permissions for these files are identical, outputs the common
permissions. Otherwise outputs each file name followed by its
permissions.
8b. C Program to create a file with 16 bytes of arbitrary data from the
beginning and another 16 bytes of arbitrary data from an offset of 48.
Display the file contents to demonstrate how the hole in file is handled.
9a. Shell Scripts that accepts file names specified as arguments and
creates a shell scripts that contains this file as well as the code to
Page.No
10
11
12
13
10CSL58
PART A
1 a: Program to count the number of characters, words, spaces and lines in a given input
file.
b: Program to count the numbers of comment lines in a given C program. Also eliminate
them and copy the resulting program into separate file.
1a.l
%{
#include <stdio.h>
int character=0, word=0, line=0, blank=0;
%}
%%
[^ \t\n]+
[\n]
[
]
{word++, character+=yyleng;}
{line++;}
{blank++;}
%%
int main(int argc ,char * argv)
{
if(argc==2)
{
yyin=fopen(argv[1],r);
yylex();
printf(number of characters=%d, word=%d, line=%d, blank=%d,character,
word,line, blank);
}
else
{
printf(usage file);
return 0;
}
}
Output:
lex 1a.l
cc lex.yy.c -ll
./a.out file.txt
no of chars=13,no of words=5,no of blanks=4,no of lines=1
file.txt
hi this is ss lab
10CSL58
1b.l
%{
#include<stdio.h>
int c=0;
%}
%%
[/][*][^ "*/"]*[*][/] {c++;}
[/][/][a-zA-Z0-9]*[^ \n] {c++;}
[ a-zA-Z0-9] {fprintf(yyout,"%s",yytext);}
%%
int main(int argc,char *argv[])
{
if(argc>=3)
{
yyin=fopen(argv[1],"r");
yyout=fopen(argv[2],"w");
yylex();
printf("\n No of comment lines=%d",c);
}
return 0;
}
Output:
lex 1b.l
cc lex.yy.c -ll
./a.out 1b.c 1bb.c
no of comment lines=2
2. a) Program to recognize a valid arithmetic expression and to recognize the
identifiers and operators present. Print them separately.
2a.l
%{
#include<stdio.h>
#include<stdlib.h>
10CSL58
int oper=0,b=0,id=0;
%}
%%
[ +-/* ] { oper++; printf("%s is an operator\n",yytext); }
[A-Za-z0-9]+ { id++; printf("%s is an operand.\n",yytext); }
[(] { b++; }
[)] { b--; }
%%
intyywrap()
{
return 1;
}
int main()
{
printf("\n enter expression");
yylex();
if( (b==0) && (oper==id-1) )
{
printf("\n valid expression.");
printf("\n There are %d operators.",oper);
printf("\n There are %d operands.",id);
exit(0);
}
else
{
printf("\n invalid expression");
return 0;
}
}
Output:
lex 2a.l
cc lex.yy.c -ll
./a.out
10CSL58
[ Press CTRL+D]
%%
int main()
{
printf("\n enter the sentence");
yylex();
if(flag==1)
printf("compound sentence.");
else
printf("simple sentence.");
return 0;
}
Output:
lex 2b.l
cc lex.yy.c -ll
./a.out
enter the sentence ss and os lab
compound sentence.
10CSL58
./a.out
enter the sentence this is ss lab
simple sentence.
3. Program to recognize and count the number of identifiers in a given input file.
3.l
%{
#include<stdio.h>
int id=0;
%}
%%
("int "|"float "|"char "|"long int "|"short int ") { int ch;
ch=input();
while(1)
{
if(ch==',')
id++;
else if(ch==';')
break;
ch=input();
}
id++;
}
%%
int main(int argc,char *argv[])
{
if(argc<=3)
{
yyin=fopen(argv[1],"r");
yylex();
printf("\n Number of ids=%d",id);
}
}
Output:
lex 3.l
cc lex.yy.c -ll
./a.out 3input.c
main()
{
}
Number of ids=7
3input.c
main()
{
Dept. of ISE, BMSIT&M
10CSL58
inta,b,c,d;
floate,f;
char g;
c=a+b;
printf("c=%d",c);
}
{return N;}
\n
{return 0;}
{return yytext[0];}
%%
4a.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token N
%left
'+' '-'
%left
'*' '/'
%%
S:P
;
P : P '+' P
| P '-' P
| P '*' P
| P '/' P
Dept. of ISE, BMSIT&M
10CSL58
| '(' P ')'
|N
|L;
%%
main()
{
printf("enter an expression");
yyparse();
printf("\n valid.");
}
yyerror()
{
printf("INVALID EXPRESSION");
exit(0);
}
Output:
lex 4a.l
yacc -d 4a.y
cc lex.yy.c y.tab.c -ll -c
./a.out
enter an expression
a+b*c-d
valid.
./a.out
enter an expression
a+b-
Invalid Expression
b) Program to recognize a valid variable, which starts with a letter, followed by any
number of letters or digits.
4b.l
%{
#include"y.tab.h"
%}
%%
[a-zA-Z]+ {return C;}
10CSL58
[0-9]+
{return N;}
\n
{return 0;}
{return
yytext[0];}
%%
4b.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token
%%
s: C s1;
s1: N s1
| C s1
|
%%
main()
{
printf("enter a string:");
if(yyparse( )==0)
printf("valid string\n");
}
yyerror()
{
printf("\n invalid string");
exit(0);
}
Output:
lex 4b.l
yacc -d 4b.y
cc lex.yy.o
y.tab.o -ll
cc lex.yy.c
y.tab.c -c
./a.out
10CSL58
enter a string:abc5657
valid string
./a.out
enter a string:45abc
invalid string
int
yylval;
%}
%%
[0-9]+
{yylval=atoi(yytext);
\n
return 0;
{return
return N;}
yytext[0];}
%%
5a.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token
%left
'+' '-'
%left
'*' '/'
%%
S:P { printf("result is %d\n",$1);
exit(0); };
P:P'+'P{$$=$1+$3;}
| P'-'P{$$=$1-$3;}
|P'*'P{$$=$1*$3;}
|P'/'P{if($3==0)
10CSL58
{
printf("DIVIDE BY ZERO.\n");
exit(0);
}
$$=$1/$3;
}
|'(' P ')' { $$=$2; }
|N { $$=yyval; }
;
%%
main()
{
printf("enter an arithmetic expression");
yyparse();
}
yyerror()
{
printf("invalid expression");
exit(0);
}
Output:
lex 5a.l
yacc -d 5a.y
cc lex.yy.cy.tab.c -ll -ly
./a.out
enter an arithmetic expression4+6-3*5
result is -5
./a.out
enter an arithmetic expression6*8+2-30/6
result is 45
b) Program to recognize strings aaab, abbb, ab and a using the grammar
anbn, n>= 0).
10
10CSL58
5b.l
%{
#include "y.tab.h"
%}
%%
a
{return A;}
{return B;}
\n
{return 0;}
{return yytext[0];}
%%
5b.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token
%%
s:AsB
|
;
%%
main( )
{
printf("\nEnter string:\n");
yyparse( );
printf("\nValidexp\n");
}
yyerror()
{
printf("\nInvalid expression\n");
exit(0);
}
Output:
lex 5b.l
11
10CSL58
yacc -d 5b.y
cc lex.yy.c y.tab.c -ll -c
./a.out
1. Enter string:
aaab
Invalid expression
./a.out
2. Enter string:
ab
Valid exp
{return A;}
{return B;}
\n
{return 0;}
{return yytext[0];}
%%
6.y
%{
#include<stdio.h>
#include<stdlib.h>
%}
%token A B
%%
s : A A A A A A A A A A s1 B ;
s1: A s1
|
%%
main()
12
10CSL58
{
printf("enter a string\n");
yyparse( );
printf("\n valid\n");
}
yyerror()
{
printf("invalid expression\n");
exit(0);
}
Output:
lex 6.l
yacc -d 6.y
cc lex.yy.c y.tab.c -ll -c
./a.out
enter a string
aaaaaaaaaaaaaaaaaaab
valid
./a.out
enter a string
baaab
invalid expression
PART B
UNIX Programming:
Design, develop, and execute the following programs:
7a. Non-recursive shell scripts that accepts any number of arguments and prints them in
the reverse order, (For example, if scripts is named rargs, then executing rargs A B C should
produce C B A on the Standard output)
7b. C Program that creates a child process to read commands from the standard input
and execute them ( a minimal implementation of a shell- like program). You can assume
that no arguments will be passed to the commands to be executed.
7a.sh
#!/bin/sh
echo Total number of arguments are: $#
Dept. of ISE, BMSIT&M
13
10CSL58
7b.c
#include<stdio.h>
#include<stdlib.h>
main()
{
int pid,i,n;
char cmd[15];
printf(Enter the no. Of commands \n);
scanf(%d,&n);
pid=fork();
if(!pid)
{
printf(Child process is created \n);
for(i=0;i<n;i++)
{
printf(Enter Command \n);
scanf(%s,cmd);
system(cmd);
}
printf(Child process is complete);
}
else
{
wait();
exit();
}
printf(Parent process is complete\n);
}
OUTPUT:
14
10CSL58
8a. Shell Script that accepts two file names as arguments, checks if the permissions for these
files are identical, outputs the common permissions. Otherwise outputs each file name
followed by its permissions.
8b. C Program to create a file with 16 bytes of arbitrary data from the beginning and
another 16 bytes of arbitrary data from an offset of 48. Display the file contents to
demonstrate how the hole in file is handled.
8a.sh
#!/bin/sh
f1=`ls -l $1| cut -c 2-10`
f2=`ls -l $2| cut -c 2-10`
if [ $f1 = $f2 ]
then
echo The two files have identical permission
echo Permission is $f1
else
echo The two files do not have identical permission
echo File $1 has $f1 permission
echo File $2 has $f2 permission
fi
OUTPUT:
sh 8a.sh 1.c 2.c
The two files have identical permission
rw_r_ _r _ _
sh 8a.sh 1.c 3.c
The two files do not have identical permission
File 1.c has rw_ r _ _r_ _
File 3.c has rwxrw_ r_ _
8b.c
#include<stdio.h>
#include<sys/stat.h>
#include<sys/types.h>
Dept. of ISE, BMSIT&M
15
10CSL58
#include<unistd.h>
#include<fcntl.h>
char buf1[]=abcdefghijklmnop;
char buf2[]=ABCDEFGHIJKLMNOP;
int main()
{
int fd;
fd=creat(file.dat,O_WRONLY|777);
write(fd,buf1,16);
lseek(fd,48,SEEK_SET);
write(fd,buf2,16);
system(cat file.dat);
}
OUTPUT:
gcc 8b.c
abcdefghijklmnopABCDEFGHIJKLMNOP
9a. Shell Scripts that accepts file names specified as arguments and creates a shell scripts
that contains this file as well as the code to recreate these files. Thus if the script generated
by your script is executed it would recreate the original files (This is same as the bundle
script described by Brain W. Kernighan and Rob Pike in The Unix Programming
Environment, Prentice- Hall India)
9b. C Program to do the following: using fork() create a child process. The child process
prints its own process-id and id of its parent and then exits. The parent process waits for
its child to finish (by executing the wait()) and prints its own process-id and the id of its
child process and then exits.
9a.sh:
#!/bin/sh
if [ $# -eq 0 ]
then
echoEnter two arguments
exit
fi
for i in $*
do
echo cat >$i<<HERE
abc
def
16
10CSL58
ghi
HERE
done> recreate.sh
OUTPUT
Sh 9a.sh a.c b.c
Sh recreate.sh
Cat recreate.sh
Cat>a.c<<HERE
Abc
Def
HERE
Cat>b.c<<HERE
Abc
Def
HERE
Cat a.c
Abc
Def
Cat b.c
Abc
Def
9b.c:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int pid;
pid=fork();
if(!pid)
{
printf(Child process is created\n);
printf(The pid of Child process is %d,getpid());
printf(The pid of parent process is %d,getppid());
exit():
}
else
{
Dept. of ISE, BMSIT&M
17
10CSL58
wait();
printf(Parent process\n);
printf(The pid of the parent process is %d, getpid());
printf(The pid of the child process is %d,pid);
exit();
}
}
OUTPUT:
cc 9b.c
Child process is created
The pid of Child process is 3823
The pid of parent process is 3822
Parent process
The pid of the parent process is 3822
The pid of the child process is 3823
10. Design, develop and execute a program in C/C++ to simulate the working of shortest
remaining time and Round- Robin scheduling Algorithms. Experiment with different
quantum sizes for the Round- Robin Algorithm. In all cases, determine the average turnaround time. The input can be read from keyboard or from a file.
#include<stdio.h>
#include<stdlib.h>
main()
{
for(;;)
{
int choice;
printf("enter the choice\n");
printf("1.ROUND ROBIN\n 2.SRT \n 3.EXIT \n");
scanf("%d",&choice);
switch(choice)
{
case 1:printf("round robin scheduling algo");
rr();
break;
case 2:printf("\n\n__SHORTEST REMAINING TIME NEXT___\n\n");
srtf();
break;
case 3:exit(0);
}
}
Dept. of ISE, BMSIT&M
18
10CSL58
}
int
{
rr()
int i, j, n, time, remain, flag=0, ts;
int sum_wait=0, sum_turnaround=0, at[10], bt[10], rt[10];
printf("Enter no of Processes : ");
scanf("%d",&n);
remain=n;
for(i=0;i<n;i++)
{
printf("Enter arrival time and burst time for Process P%d :",i+1);
scanf("%d",&at[i]);
scanf("%d",&bt[i]);
rt[i]=bt[i];
}
printf("Enter time slice");
scanf("%d",&ts);
printf("\n\nProcess\t|Turnaroundtime|waiting time\n\n");
for(time=0,i=0;remain!=0;)
{
if(rt[i]<=ts&&rt[i]>0)
{
time+=rt[i];
rt[i]=0;
flag=1;
}
else if(rt[i]>0)
{
rt[i]-=ts;
time+=ts;
}
if(rt[i]==0 && flag==1)
{
remain--;
printf("P[%d]\t|\t%d\t|\t%d\n",i+1,time-at[i],time-at[i]-bt[i]);
sum_wait+=time-at[i]-bt[i];
sum_turnaround+=time-at[i];
flag=0;
}
if(i==n-1)
i=0;
else if(at[i+1]<=time)
i++;
else
i=0;
}
printf("\nAvgsum_wait = %f\n",sum_wait*1.0/n);
printf("Avgsum_turnaround = %f",sum_turnaround*1.0/n);
return 0;
}
Dept. of ISE, BMSIT&M
19
10CSL58
int srtf()
{
int at[10],bt[10],rt[10],endTime,i,smallest;
int remain=0,n,time,sum_wait=0,sum_turnaround=0;
printf("Enter no of Processes : ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("Enter arrival time for Process P%d : ",i+1);
scanf("%d",&at[i]);
printf("Enter burst time for Process P%d : ",i+1);
scanf("%d",&bt[i]);
rt[i]=bt[i];
}
printf("\n\nProcess\t|Turnaround Time| Waiting Time\n\n");
rt[9]=9999;
for(time=0;remain!=n;time++)
{
smallest=9;
for(i=0;i<n;i++)
{
if(at[i]<=time &&rt[i]<rt[smallest] &&rt[i]>0)
{
smallest=i;
}
}
rt[smallest]--;
if(rt[smallest]==0)
{
remain++;
endTime=time+1;
printf("\nP[%d]\t|\t%d\t|\t%d",smallest+1,endTime-at[smallest],endTimebt[smallest]-at[smallest]);
sum_wait+=endTime-bt[smallest]-at[smallest];
sum_turnaround+=endTime-at[smallest];
}
}
printf("\n\nAverage waiting time = %f\n",sum_wait*1.0/n);
printf("Average Turnaround time = %f",sum_turnaround*1.0/n);
return 0;
}
11. Using OpenMP, Design, develop and run a multi-threaded program to generate and
print Fibonacci Series. One thread has to generate the numbers up to the specified limit
and another thread has to print them. Ensure proper synchronization.
11.c
#include<omp.h>
Dept. of ISE, BMSIT&M
20
10CSL58
#include<stdio.h>
int main()
{
int fib[100],n,i;
printf("enter range:");
scanf("%d",&n);
fib[0]=0;
fib[1]=1;
if(n<2)
printf("\n%d\n%d\n",fib[0],fib[1]);
else
{
printf("\nthread 1 generating fibonacci series..\n");
#pragma omp parallel num_threads(2)
for(i=2;i<n;i++)
fib[i]=fib[i-1]+fib[i-2];
}
printf("thread 2 printing fibonacci series..");
#pragma imp critical
printf("\n%d\n%d\n",fib[0],fib[1]);
for(i=2;i<n;i++)
{
printf("%d\n",fib[i]);
}
return 0;
}
OUTPUT:
cc -fopenmp 11.c
./a.out
enter range:5
thread 1 generating fibonacci series..
thread 2 printing fibonacci series..
0
1
Dept. of ISE, BMSIT&M
21
10CSL58
1
2
3
12. Design, Develop and run a program to implement the Bankers Algorithm.
Demonstrate its working with different data Values.
#include<stdio.h>
#include<stdlib.h>
int count=0,prc,k=0,i,j,comp[10],avail[10],total,work[10],reg[10][10],safe[10],a=1;
intrscr[10],safe[10],claim[10][10],alloc[10][10],p,r;
void banker()
{
for(i=1;i<=p;i++)
comp[i]=0;
for(j=1;j<=r;j++)
{
total=0;
avail[j]=0;
for(i=1;i<=p;i++)
total=total+alloc[i][j];
avail[j]=rscr[j]-total;
for(j=1;j<=r;j++)
work[j]=avail[j];
for(i=1;i<=p;i++)
for(j=1;j<=r;j++)
reg[i][j]=claim[i][j]-alloc[i][j];
printf("the request matrix");
for(i=1;i<=p;i++)
{
for(j=1;j<=r;j++)
{
printf("%d\t",reg[i][j]);
}
printf("\n");
}
while(count!=p && k<p)
{
k++;
for(i=1;i<=p;i++)
{
prc=0;
if(comp[i]==0)
{
for(j=1;j<=r;j++)
{
if(reg[i][j]<=work[j])
Dept. of ISE, BMSIT&M
22
10CSL58
prc=prc+1;
else
break;
}
if(prc==r)
{
count++;
safe[a]=i;
a++;
comp[i]=1;
for(j=1;j<=r;j++)
{
work[i]=work[j]+alloc[i][j];
claim[i][j]=0;
alloc[i][j]=0;
}
}
}
else
continue;
}
}
if(count!=p)
{
printf("sys is in unsafe state\n");
}
else
{
printf("sys is in safe state");
for(j=1;j<=p;j++)
printf("the safe sequence of the process is %d\n",safe[j]);
}
}
}
int main()
{
printf("enter the no of process\n");
scanf("%d",&p);
printf("enter the no of resources\n");
scanf("%d",&r);
printf("enter the rsrc instances array\n");
for(i=1;i<=r;i++)
{
scanf("%d",&rscr[i]);
}
printf("enter the claim matrix");
for(i=1;i<=p;i++)
for(j=1;j<=r;j++)
scanf("%d",&claim[i][j]);
printf("enter the alloc matrix\n");
for(i=1;i<=p;i++)
Dept. of ISE, BMSIT&M
23
10CSL58
for(j=1;j<=r;j++)
scanf("%d",&alloc[i][j]);
banker( );
}
24
10CSL58
25