22
PCA241C: Python Programming 4 credits (4-0-0) CIE Marks: 50 SEE Marks: 100 Total Hours: 52 SEE Hours: 03 UNIT I 13 Hours Installing Python, Simple program using Python, Expressions and Values, Variables and Computer Memory, error detection, multiple line statements, Designing and using functions, functions provided by Python, Tracing function calls in memory model, omitting return statement. Working with Text: Creating Strings of Characters, Using Special Characters in Strings, Creating a Multiline String, Printing Information, Getting Information from the Keyboard. A Boolean Type, Choosing Statements to Execute, Nested If Statements, remembering the Results of a Boolean Expression Evaluation. UNIT II 13 Hours A Modular Approach to Program Organization, Importing Modules, Defining Your Own Modules, Testing Code Semi automatically Grouping Functions Using Methods: Modules, Classes, and Methods, Calling Methods the Object-Oriented Way, Exploring String Methods, Underscores. Storing Collections of Data Using Lists: Storing and Accessing Data in Lists, modifying Lists. Operations on Lists, Slicing Lists, Aliasing, List Methods, Working with a List of Lists. UNIT III 13 Hours Repeating Code Using Loops: Processing Items in a List, Processing Characters in Strings, Looping Over a Range of Numbers, Processing Lists Using Indices, Nesting Loops in Loops, Looping Until a Condition Is Reached, Repetition Based on User Input, Controlling Loops Using Break and Continue. Reading and Writing Files: Kinds of files, Opening a File, Techniques for Reading Files, Files over the Internet, Writing Files, and Writing Algorithms That Use the File-Reading Techniques, Multiline Records.

PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

  • Upload
    votuyen

  • View
    316

  • Download
    1

Embed Size (px)

Citation preview

Page 1: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA241C: Python Programming

4 credits (4-0-0)

CIE Marks: 50 SEE Marks: 100

Total Hours: 52 SEE Hours: 03

UNIT I 13 Hours

Installing Python, Simple program using Python, Expressions and Values, Variables and

Computer Memory, error detection, multiple line statements, Designing and using

functions, functions provided by Python, Tracing function calls in memory model,

omitting return statement. Working with Text: Creating Strings of Characters, Using

Special Characters in Strings, Creating a Multiline String, Printing Information, Getting

Information from the Keyboard. A Boolean Type, Choosing Statements to Execute,

Nested If Statements, remembering the Results of a Boolean Expression Evaluation.

UNIT II 13 Hours

A Modular Approach to Program Organization, Importing Modules, Defining Your Own

Modules, Testing Code Semi automatically Grouping Functions Using Methods:

Modules, Classes, and Methods, Calling Methods the Object-Oriented Way, Exploring

String Methods, Underscores. Storing Collections of Data Using Lists: Storing and

Accessing Data in Lists, modifying Lists. Operations on Lists, Slicing Lists, Aliasing,

List Methods, Working with a List of Lists.

UNIT III 13 Hours

Repeating Code Using Loops: Processing Items in a List, Processing Characters in

Strings, Looping Over a Range of Numbers, Processing Lists Using Indices, Nesting

Loops in Loops, Looping Until a Condition Is Reached, Repetition Based on User Input,

Controlling Loops Using Break and Continue. Reading and Writing Files: Kinds of

files, Opening a File, Techniques for Reading Files, Files over the Internet, Writing Files,

and Writing Algorithms That Use the File-Reading Techniques, Multiline Records.

Page 2: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

UNIT IV 13 Hours

Storing Data Using Other Collection Types: Storing Data Using Sets, Storing Data

Using Tuples, Storing Data Using Dictionaries, Inverting a Dictionary, Using the In

Operator on Tuples, Sets, and Dictionaries, Comparing Collections. Collection of New

Information Object-Oriented Programming: Understanding a Problem Domain,

Function “Isinstance,” Class Object, and Class Book, Writing a Method in Class Book.

Plugging into Python Syntax: More Special Methods. Creating Graphical User

interface: Building a Basic GUI, Models, Views, and Controllers, Customizing the

Visual Style Introducing few more Widgets, Object-Oriented GUIs, Keeping the

Concepts from Being a GUI Mess.

Text Books:

1. Practical Programming: An introduction to Computer Science Using Python, second

edition, Paul Gries, Jennifer Campbell, Jason Montojo, The Pragmatic Bookshelf.

2. Learning with Python: How to Think Like a Computer Scientist Paperback – Allen

Downey , Jeffrey Elkner, 2015

Reference Books:

1. Introduction to Python for Computational Science and Engineering (A beginner's

guide), Hans Fangohr.

2. Exploring Python, Timothy A. Budd, Mc Graw Hill Education.

3. Python for Informatics: Exploring Information, C harles Severance.

4. Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

Page 3: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA242C: Object Oriented Programming Using C++

4 Credits (4- 0- 0)

CIE Marks: 50 SEE Marks: 100

Total Hours: 52 SEE Hours: 03

UNIT I 13 Hours

Principles of Object-Oriented Programming :Software Crisis, Software Evolution, A

Look at Procedure-Oriented Programming, Object-Oriented Programming Paradigm,

Basic Concepts of Object-Oriented Programming, Benefits of OOP, Object-Oriented

Languages,

Applications of OOP . Beginning With C++: What is C++? Applications of C++, A

Simple C++ Program, More C++ Statements, An Example with Class, Structure of C++

Program, Creating the Source File, Compiling and Linking, Functions in C++:

Introduction, The Main Function, Call by Reference, Return by Reference, inline

Functions, Default Arguments, const Arguments, Function Overloading, Friend and

Virtual Functions.

UNIT II 13 Hours

Classes and objects: Introduction, C Structures Revisited, Specifying a Class, Defining

Member Functions, A C++ Program with Class, Making an Outside Function Inline,

Nesting of Member Functions, Private Member Functions, Arrays within a Class,

Memory Allocation for Objects, Static Data Members, Static Member Functions, Arrays

of Objects, Objects as Function Arguments, Friendly Functions, Returning Objects, const

Member Functions, Pointers to Members, Local classes. Constructors and Destructors:

Introduction, Constructors, Parameterized Constructors, Multiple Constructors in a Class,

Constructors with Default Arguments, Dynamic Initialization of Objects, Copy

Constructor, Dynamic Constructors ,Constructing Two-Dimensional Arrays, const

Objects, Destructors. Operator Overloading and Type Conversions: Introduction,

Defining Operator Overloading, Overloading Unary Operators, Overloading Binary

Operators, Overloading Binary Operators Using Friends ,Manipulation of Strings Using

Operators .

Page 4: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

UNIT III 13 Hours

Rules for Overloading Operators, Type Conversions. Inheritance: Extending Classes

Introduction, Defining Derived Classes Contents, Single Inheritance Making a Private

Member Inheritable, Multilevel Inheritance, Multiple Inheritance, Hierarchical

Inheritance, Hybrid Inheritance, Virtual Base Classes, Abstract Classes, Constructors in

Derived Classes. Pointers, Virtual Functions and Polymorphism :Introduction, Pointers

to Objects, this Pointer, Pointers to Derived Classes, Virtual Functions, Pure Virtual

Functions .Managing Console I/O Operations: Introduction, C++ Streams, C++ Stream

Classes, Unformatted I/O Operations, Formatted Console I/O Operations, Managing

Output with Manipulators.

UNIT IV 13 Hours

Working With Files :Introduction, Classes for File Stream Operations, Opening and

Closing a File, Detecting End-of File ,More about Open(): File Modes, File Pointers and

their Manipulations Sequential Input and Output Operations, Updating a File: Random

Access, Error Handling During File Operations, Command-Line Arguments. Templates:

Introduction, Class Templates, Class Templates with Multiple Parameters, Function

Templates, Function Templates with Multiple Parameters, Overloading of Template

Functions, Member Function Templates, Non-Type Template Arguments.

Text Books:

1.Balaguruswamy ,“Object Oriented Programming with C++ ”, TMH , 2nd Edition.

Reference Books:

1. Herbert Schildt ,”C++ , The Complete Reference “, TMH, 3rd Edition.

2. Stanley B. Lippman and Josee Lajore,” C++ Primer”, Addison Wesley, 3rd

Edition,2006

3. Bjarne Stroustrup,”The C++ programming language” , Pearson Education, 3rd

Edition,2002

Page 5: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA243C: Database Management Systems

4 Credits (4-0-0)

CIE Marks: 50 SEE Marks: 100

Total Hours: 52 SEE Hours: 03

UNIT I 13 Hours

Databases and Database Users: Introduction, An Example, Characteristics of the

Database Approach, Actors on the scene, Workers behind the scene, Advantages of using

the DBMS approach, A brief history of database applications, When not to use a DBMS,

Database System Concepts and Architecture: Data models, schemas and instances,

Three-schema architecture and data independence, Database language and interfaces, The

database system environment. Data Modeling Using the Entity-Relationship(ER)

Model: Using High-Level Conceptual Data Models for Database Design; An Example

Database Application; Entity Types, Entity Sets, Attributes and Keys; Relationships,

Relationship Types, Roles and Structural Constraints; Weak Entity Types; Refining the

ER Design for the COMPANY Database; ER Diagrams, Naming Conventions and

Design Issues.

UNIT II 13 Hours

The Relational Data Model and Relational Database Constraint: Relational Model

Concepts, Relational Constraints and Relational Database Schemas, Update Operations,

Transactions, and Dealing with Constraint Violations. Relational Algebra and Relational

Calculus: Unary Relational Operations, Relational Algebra Operations from Set Theory,

Binary Relational Operations, Additional Relational Operations; Examples of Queries in

Relational Algebra. Relational Database Design Using ER and EER to-Relational

Mapping: Relational Database Design Using ER to Relational Mapping. SQL-99:

Schema Definition, Constraints, Queries and Views: SQL Data Definition and Data

types, Specifying Constraints in SQL, Schema Change statement in SQL, Basic Queries

in SQL, More Complex SQL Queries, Insert, Delete and Update Statements in SQL,

Specifying Constraints as Assertion and Triggers, Views (Virtual Tables) in SQL,

Additional Features of SQL.

Page 6: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

UNIT III 13 Hours

Functional Dependencies and Normalization for Relational Database: 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. Relational Database Design Algorithms and Further Dependencies:

Properties of Relational Decompositions, Algorithms for Relational Database Schema

Design; Multi-valued Dependencies and fourth normal form, Join Dependencies and fifth

normal form, Inclusion Dependencies; Other Dependencies and Normal Forms.

Overview of Query Evaluation The System Catalog: Information in the Catalog;

Introduction to Operator Evaluation: Three Common Techniques, Access Paths;

Algorithms for Relational Operations: Selection, Projection, Join, Other Operations;

Introduction to Query Optimization: Query Evaluation Plans, Multi-operator Queries,

Pipelined Evaluation, The Iterator Interface; Alternative Plans: A Motivating Example:

Pushing Selections, Using Indexes; What a Typical Optimizer Does: Alternative Plans

Considered, Estimating the Cost of a Plan.

UNIT IV 13 Hours

Overview of Transaction Management: The ACID Properties: Consistency and

Isolation, Atomicity and Durability; Transactions and Schedules; Concurrent Execution

of Transactions: Motivation for Concurrent Execution, Serializability, Anomalies due to

Interleaved Execution, Schedules Involving Aborted Transactions; Lock- Based

Concurrency Control: Strict Two-Phase Locking, Deadlocks; Performance of Locking;

Transaction Support in SQL: Creating and Terminating Transactions, What Should We

Lock? Transaction Characteristics in SQL: Introduction to Crash Recovery: Stealing

Frames and Forcing Pages, Recovery - Related Steps during Normal Execution,

Overview of ARIES recovery algorithm, Atomicity: Implementing Rollback. Database

Security, Introduction to Database Security; Access Control; Discretionary Access

Control: Grant and Revoke on Views and Integrity Constraints; Mandatory Access

Control: Multilevel Relations and Polyinstantiation, Covert Channels, DoD Security

Levels.

Page 7: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

Text books:

1. R. Elmasri and S. Navathe, Fundamentals of Database Systems, Fifht Edition,

Pearson Education 2011.

2. Raghu Ramakrishnan and Johannes Gehrke, Database Management Systems,Third

Edition, McGraw-Hill 2003.

Reference books:

1. Silberschatz,Korth and Sudarshan, Database System Concepts, Fourth Edition,

McGraw-Hill.

2. Alexis Leon, Mathews Leon, Vikas,Database Management Systems, Publishing

House.

3.Database Systems: A practical approach to design implementation and management -

Connolly. Third Edition, Pearson Education.

Page 8: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA244C: Operating Systems

4 Credits (4-0-0)

CIE Marks: 50 SEE Marks: 100

Total Hours: 52 SEE Hours: 03

UNIT I 13 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. 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.

Process Management: Process concept; Process scheduling; Operations on processes;

Inter-process communication. Multi-Threaded Programming: Overview; Multithreading

models; Thread Libraries; threading issues. Process Scheduling: Basic concepts;

Scheduling criteria; Scheduling algorithms; Multiple-Processor scheduling; Thread

scheduling.

UNITII 13 Hours

Process Synchronization: Synchronization: The Critical section problem; Peterson’s

solution; Synchronization hardware; Semaphores; Classical problems of synchronization;

Monitors.

Deadlocks: Deadlocks: System model; Deadlock characterization; Methods for handling

deadlocks; Deadlock prevention; Deadlock avoidance; Deadlock detection and recovery

from deadlock.

Page 9: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

UNIT III 13 Hours

Memory Management: Memory Management Strategies: Background; Swapping;

Contiguous memory allocation; Paging; Structure of page table; Segmentation. Virtual

Memory Management: Background; Demand paging; Copy-on-write; Page replacement;

Allocation of frames; Thrashing.

UNIT IV 13 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.

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.

Text Book:

1. Abraham Silberschatz, Peter Baer Galvin, Greg Gagne ,Operating System Principles ,

7th edition, Wiley-India, 2006.

Reference Books:

1. D.M Dhamdhere, Operating Systems: A Concept Based Approach 2nd Edition,

Tata McGraw- Hill, 2002.

2. P.C.P. Bhatt, Operating Systems, 2nd Edition, PHI, 2006.

3. Harvey M Deital, Operating Systems, 3rd Edition, Addison Wesley, 1990.

Page 10: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA245C: Discrete Mathematical Structures

4 credits (4-0-0)

CIE Marks: 50 SEE Marks: 100

Total Hours: 52 SEE Hours: 03

UNIT I 13 Hours

Fundamentals of Logic: Basic Connectives and Truth Tables, Logic Equivalence – The

Laws of Logic, Logical Implication – Rules of Inference, The Use of Quantifiers,

Quantifiers, Definitions and the Proofs of theorems.

UNIT II 13 Hours

Sets, Functions and Relations: Sets, set operations and laws of set theory. Cartesian

Products and Relations, Functions – Plain and One-to-One, Onto Functions – Stirling

Numbers of the Second Kind, Special Functions, The Pigeon-hole Principle, Function

Composition and Inverse Functions, Properties of Relations, Computer Recognition

Zero-One Matrices and Directed Graphs.

UNIT III 13 Hours

Partial Orders – Hasse Diagrams, Equivalence Relations and Partitions. Permutations

and combinations: permutations and combinations, principles of inclusion and

exclusion. Probability: Introduction to probability, axioms of probability and conditional

probability.

UNIT IV 13 Hours

Graph Theory: Definition and examples, subgraphs, complements, graph isomorphism,

vertex degree: Euler trails and circuits and planar graphs, Hamiltonian paths and cycles,

graph coloring. Trees: Definition, properties and examples,rooted trees, trees and

sorting.

Page 11: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

Text Books:

1. Ralph P. Grimaldi and B V Ramana, Discrete and Combinatorial Mathematics: An

Applied Introduction by (Indian corrupted adaptation), 5th edition, Pearson, 2011.

2. Kenneth H Rosen ,Discrete Mathematics and its Applications , 6th edition, (Indian

adaptation by Kamala Krithivasan), Tata McGraw Hill, 2011.

Reference Books:

1. NarsinghDeo, Graph Theory with Applications to Engineering and Computer Science

Prentice Hall India, 2004.

2. J. P. Tremblay and R. Manohar, Discrete Mathematical Structures with Applications to

Computer Science, McGraw Hill.

Page 12: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA246L: Python Programming Laboratory

1.5 credits (0-0-3)

CIE Marks: 50 SEE Marks: 50

Total Hours: 42 SEE Hours: 03

Laboratory Experiments:

NOTE: The experiments are to be carried using discrete components only.

1. a) Write a program to sum all the elements from n1 to n2 where n1 and n2 are

positive integers

b) Input an array of n numbers and find separately the sum of positive numbers

and negative

numbers.

2. a) Write a program to search an element using linear search

b) Write a program to search an element using binary search.

3. Write a program to simulate stack.

4. Write a program to evaluate an arithmetic expression using a stack.

5. a) Write a program to multiply two matrices.

b) Write a program to find the roots of a quadratic equation

6. Insert a number in a sorted array.

7. Write a Python Program to check whether the given string is palindrome or not

using built in string manipulation methods.

8. Write a Python Program to read a word and prints the number of letters, vowels

and percentage of vowels in the word using dictionary

9. Write a Python Program to check a given sentence is a pangram or not using

function/Module. Write a Python Event driven Program for file operations Press

1: to open file in read mode 2: open the file in write mode 3: current position of

the file pointer 4: Reposition the pointer at the beginning 5: exit.

10. Write an Object oriented Python program to create two Time objects:

currentTime, which contains the current time; and breadTime, which contains the

amount of time it takes for a bread maker to make bread. Then we'll use

addTimeto figure out when the bread will be done. Write the printTime function

to display the time when the bread will be done by the bread maker.

Page 13: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA247L: Object Oriented Programming Using C++ Laboratory

1.5 Credits (0-0-3)

CIE Marks: 50 SEE Marks: 50

Total Hours: 42 SEE Hours: 03

Laboratory Experiments:

1. Define a STUDENT class with USN, Name, and Marks in 3 tests of a subject.

Declare an array of 10 STUDENT objects. Using appropriate functions, find the

average of the two better marks for each student. Print the USN, Name and the

average marks of all the students.

2. Write a C++ program to create a class called COMPLEX and implement the

following overloading functions ADD that return a complex number:

4. ADD(a,s2), where 'a' is an integer (real part) and 's2' is a complex

number.

5. ADD(s1,s2), where 's1' and 's2' are complex numbers.

3. Write a C++ program that Exchanges the contents of data members of two

different classes to demonstrate how a friend function acts as bridge between two

different classes.

4. Write a C++ program to create a class called MATRIX using a two-dimensional

array of integers, row and column. Implement the following operation by

overloading the operator '==' that checks the compatibility of two matrices to be

multiplied. Perform the multiplication operation by overloading the operator *

using member function. Display the results by overloading the

operator <<.

if (M1 == M2)

M3 = M1 * M2;

else

display Multiplication is not possible;

5. Write a C++ program to create two strings dynamically and concatenate two

string using overloading + operator with help of friend function.

6. Write a C++ program to create class called STUDENT with data members :

Name, USN, Semester and a constructor to initialize these data members. Create

Page 14: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

a class called SUBJECT with data members: m1, m2, m3, average and a

constructor to initialize these m1,m2 and m3. Create a class class NCC with data

member : Grade and a constructor to initialize the data member. Demonstrate

multilevel inheritance and pass values to base class constructor using derived

class constructor.

7. Create an abstract base class EMPLOYEE with data members: Name, EmpID and

BasicSal and a pure virtual function Cal_Sal().Create two derived classes

MANAGER (with data members: DA and HRA) and SALESMAN (with data

members: DA, HRA and TA). Write appropriate constructors and member

functions to initialize the data, read and write the data and to calculate the net

salary. The main() function should create array of base class pointers/references to

invoke overridden functions and hence to implement run-time polymorphism.

8. Write a C++ program to create a template function for Insertion Sort and

demonstrate sorting of integers and doubles.

9. Write a program to create a file to store some records and search for a particular

record and display it.

10. Write a program to create a generic stack class and member functions to perform

stack operations..

11. Write a program to implement Exception Handling with minimum 5 exceptions

Classes including two built-in exceptions

12. Write a program to demonstrate namespaces and Volatile member functions

Page 15: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

PCA248L: Database Laboratory

2 Credits(0-0-4)

CIE Marks: 50 SEE Marks:50

Total Hours: 56 SEE Hours: 04

Laboratory Experiments:

1. Consider the following relations of medical consultation centre:

FACULTY (F_id, F-name, F-designation).

PATIENT (P_id, P_name, p_address, date_of_ registration).

CONSULTATION DATE (C_date, F_id, P_id).

Create tables for above relations considering suitable data types and constraints.

Insert 5 appropriate tuples in the tables.

Write the SQL statements for the following queries.

1.Generate list of patients and their consultation detail.

2.Find patients consulted by specific faculty.

3.Find the details of the entire faculty whose designation is a senior doctor and

have consultation date next month.

4.Find the patient whose consultation date is today along with the concerned

faculty detail.

Page 16: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

2. Consider the following relations of the manufacturing unit.

EMPLOYEE (Essn, Ename, Dept_No, Salary, date_of_join)

DEPENDENT (Essn, Depend_Name, Relation, Dob)

DEPARTMENT (Dept_No, Dept_Name, Manager)

Create tables for above relations considering suitable data types and

constraints. Insert 5 appropriate tuples in the tables.

Write the SQL statements for the following queries.

1. Find details of dependents for employee with a given name.

2. Find the name of the manager of the department in which employee with a

given ESSN Code works.

3. Find the name of all employees whose age is less than 35 years.

4. Find the DOB of a son/daughter of an employee with a given employee code.

3. Consider the Insurance database given below. The primary keys are

underlined and the data types are specified.

PERSON (driver-id#: string, name: string, address: string)

CAR (regno: string, model: String, year: int)

ACCIDENT (report-number: int, adate: date, location: string)

Page 17: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

OWNS (driver-id#: string, regno: string)

PARTICIPATED (driver-id: string, regno: string, report-number: int,

damageamount: int)

Create tables for above relations considering constraints. Insert five appropriate

tuples in the tables.

Write the SQL statements for the following queries.

Demonstrate how you

1. Find the owner of car that is involved in the accident of specific date.

2. Find the total damage amount out of accidents between given dates.

3. Find the car that is frequently meeting an accident.

4. Find person and his accident details

4. Consider the following relations for an order processing database

application in a company.

CUSTOMER (cust#: int, cname: string, city: string)

CUST-ORDER (corder#: int, odate: date, cust#: int, ord-amt: int)

ORDER-ITEM (corder#: int, item#: int, qty: int)

ITEM (item#: int, unit-price: int)

Page 18: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

SHIPMENT (corder#: int, warehouse#: int, ship-date: date)

WAREHOUSE (warehouse#: int, city: string)

Create tables for above relations defining appropriate constraints. Insert five

appropriate tuples in the tables.

Write the SQL statements for the following queries.

1. Display detail of orders of specific customer.

2. Display detail of orders of the items in a proper order.

3. Produce a listing: CustName, Orders, Avg_Order_Amt, where the middle

column is the total number of orders by the customer and the last column is

the average order amount for that customer

4. List the orders that were shipped from all the warehouses that the company

has in a specific city.

5. Referring problem definition of question 1, write the SQL statements for the

following queries.

1. List the details of all patients who have got consultation dates fixed between

said dates.

2. Find the first patient registered in the center along with consultation details.

3. Generate up-to date list of faculty-wise the number of consultations.

Page 19: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

4. Generate the list of faculty-wise consultation per month for the specific year.

6. Referring problem definition of question 2, write the SQL statements for the

following queries.

1. Display the list of employees who joined in the specific year.

2. Find the details of the departments in which the employee having experience of

at least ten years.

3. Find number of employees in each department.

4. Fine the employee whose salary is greater than the salary of a manager.

7. Referring problem definition of question 1, write the SQL statements for the

following queries.

1. Generate list of patients who visited the center for consultation at least three

times.

2. Find the patient frequently visiting the center.

3. Find the faculties who have maximum consultations.

4. Find the patient who is consulted by all faculties.

8. Referring problem definition of question 3, write the SQL statements for the

following queries.

1. Find the total number of people who owned cars that were involved in accident

Page 20: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

in 2002.

2. Find the number of accidents in which cars belonging to a specific model were

involved.

3. Find the model highly involved in the accidents.

4. Generate the list of year wise damage amount.

9. Referring problem definition of question 3, write the SQL statements for the

following queries.

1. Generate the list of most sensitive accident location and the number of

accidents occurred there.

2. Find the vehicle that is involved in the accident at sensitive location.

3. Count number of accidents happening each year.

4. Find first two highest damage amounts.

10. Referring problem definition of question 4, write the SQL statements for the

following queries.

1. Demonstrate how you delete an Item with a given number from ITEM table and

make that field null in the ORDER-ITEM table.

2. Generate the list of orders to be shipped next month.

3. Display the list of orders whose customer exists in the same city that of the

warehouse.

Page 21: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

4. To display which item is highly demanded by the customers.

11. Consider a “Library Management System” which keeps the following tables:

BOOK (isbn-no, book-title, author, publisher, edition, year-of- copyright)

BOOKACCESSION (accession-no, isbn-no, date-of-purchase)

MEMBERS (m-id, m-name, m-address, m-phone).

ISSUE-RETURN (accession-no, m-id, expected-date-of-return, actual-date-

of-return)

Create tables for above relations defining appropriate data type and constraints.

Insert five appropriate tuples in the tables. Please note that a member can be

issued a book for a period of 15 days. The actual-date-of-return is kept blank for

the books that have not been returned.

Write the SQL statements for the following queries.

1. Find the m-id and m-name of the members who have maximum number of un-

returned books.

2. List the book details along with the number of copies for that book in the

library (issued and not-issued both)

3. Find the names of all those students who have got all the books issued to him of

the given author.

4. Find the books expected to be returned in this week.

5. Find those members who have not got any book issued to him/her during last

six months.

Page 22: PCA241C: PYTHON Programming - BEC - HOMEbecbgk.edu/department/ca/Sylaug2016/3sem.pdfPCA241C: Python Programming ... Learning Python, Fourth Edition, Mark Lutz, O’Re illy publication

12. The following tables are maintained by a book dealer.

AUTHOR (author-id: int, name: string, city: string, country: string)

PUBLISHER (publisher-id: int, name: string, city: string, country:string)

CATALOG (book-id: int, title: string, author-id: int, publisher-id:

int,category- id: int, year: int, price: real)

CATEGORY (category-id: int, description: string)

ORDER-DETAILS (order-no: int, book-id: int, quantity: int)

Create tables for above relations defining appropriate data type and constraints.

Insert five appropriate tuples in the tables.

Write the SQL statements for the following queries.

1. Give the details of the authors who have 2 or more books in the catalog and the

price of the books is grater than the average price of the booksin the catalog and

the year of publication is after 2000.

2. Find the author of the book, which has maximum sales.

3. Demonstrate how you increase the price of books published by a specific

publisher by 10%.