Docsity

Database Management System Concepts, Exams of Calculus

Toggle sidebar
bg1
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Page 1 of 20
WINTER– 18 EXAMINATION
Subject Name: Database Management System Model Answer Subject Code:
Important Instructions to examiners:
1) The answers should be examined by key words and not as word-to-word as given in the model answer
scheme.
2) The model answer and the answer written by candidate may vary but the examiner may try to assess the
understanding level of the candidate.
3) The language errors such as grammatical, spelling errors should not be given more Importance (Not
applicable for subject English and Communication Skills.
4) While assessing figures, examiner may give credit for principal components indicated in the figure. The
figures drawn by candidate and model answer may vary. The examiner may give credit for any equivalent
figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed constant values
may vary and there may be some difference in the candidate’s answers and model answer.
6) In case of some questions credit may be given by judgement on part of examiner of relevant answer
based on candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on equivalent
concept.
Q.
No.
Sub
Q.
N.
Answer
Marking
Scheme
1
Attempt any FIVE of the following :
10 M
a
List disadvantages of typical file processing system.
2 M
Ans
Disadvantages of file processing system
1. Data redundancy and inconsistency
2. Difficulty in accessing data
3. Data isolation
4. Integrity problems
5. Atomicity problems
any 4
disadvantages
– 1/2 Mark
each
disadvantage
b
Define i)Data Abstraction ii)Data Redundancy
2 M
Ans
1. Data Abstraction :
Many end users are not computer trained so it is needed to hide complex data structures
from them.
Hiding complexity of data structures from end user through different levels is known
as data abstraction.
It has 3 levels :
1 mark Data
Abstraction
description 1
mark Data
Redundancy
description
22319
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14

Partial preview of the text

Download Database Management System Concepts and more Exams Calculus in PDF only on Docsity!

**(Autonomous) (ISO/IEC - 27001 - 2013 Certified)


WINTER– 18 EXAMINATION Subject Name: Database Management System Model Answer** Subject Code: Important Instructions to examiners:

  1. The answers should be examined by key words and not as word-to-word as given in the model answer scheme.
  2. The model answer and the answer written by candidate may vary but the examiner may try to assess the understanding level of the candidate.
  3. The language errors such as grammatical, spelling errors should not be given more Importance (Not applicable for subject English and Communication Skills.
  4. While assessing figures, examiner may give credit for principal components indicated in the figure. The figures drawn by candidate and model answer may vary. The examiner may give credit for any equivalent figure drawn.
  5. Credits may be given step wise for numerical problems. In some cases, the assumed constant values may vary and there may be some difference in the candidate’s answers and model answer.
  6. In case of some questions credit may be given by judgement on part of examiner of relevant answer based on candidate’s understanding.
  7. For programming language papers, credit may be given to any other program based on equivalent concept. Q. No. Sub Q. N. Answer Marking Scheme 1 Attempt any FIVE of the following : 10 M a List disadvantages of typical file processing system. 2 M Ans Disadvantages of file processing system
  1. Data redundancy and inconsistency
  2. Difficulty in accessing data
  3. Data isolation
  4. Integrity problems
  5. Atomicity problems any 4 disadvantages
    • 1/2 Mark each disadvantage b Define i)Data Abstraction ii)Data Redundancy 2 M Ans 1. Data Abstraction : Many end users are not computer trained so it is needed to hide complex data structures from them. Hiding complexity of data structures from end user through different levels is known as data abstraction. It has 3 levels : 1 mark Data Abstraction description 1 mark Data Redundancy description

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ a. Physical level b. logical level c. view level

2. Data redundancy : The repetition of information is known as redundancy .This redundancy leads to higher storage and access cost. It may lead to data inconsistency, that is different copies of the same data may have different values. c Define the term: i) Candidate key ii) ii) Primary key

2 M

Ans Candidate key: In a relation, there may be a primary key or may not, but there may be a key or combination of keys which uniquely identify the record. Such a key is called as Candidate key. OR A candidate key is a column, or set of columns, in a table that can uniquely identify any database record without referring to any other data. The candidate key can be simple (having only one attribute) or composite as well. For Example, {STUD_NO, COURSE_NO} is a composite candidate key for relation STUDENT_COURSE. Primary key: A key which is selected by the designer to uniquely identify the entity is called as Primary key. A primary key cannot contain duplicate values and it can never contain null values inside it. Example, RollNo attribute is a primary key for Relation Student. 1 mark Candidate key 1 mark Primary Key d List Four DDL commands with syntax. 2 M Ans DDL commands

1. 1.Create Syntax : create table <table_name>(Column_name1 datatype1, column_name Datatype2,…Column_nameN DatatypeN); 2. Drop 1/2 mark for each command and ½ mark for syntax

**(Autonomous) (ISO/IEC - 27001 - 2013 Certified)


Ans Cursor:** The Oracle Engine uses a work area for its internal processing in order to execute an SQL statement. This work area is private to SQL‟s operations and is called a Cursor. OR A cursor is a temporary work area created in the system memory when a SQL statement is executed. Types of cursor are:

  1. Implicit cursor
  2. Explicit cursor 1 mark Cursor definition and 1 mark for types of cursor 2 Attempt any THREE of the following : 12 M a Distinguish between network model and hierarchical model. 4 M Ans (^) Sr. No. Hierarchical model Network model

Hierarchical model is not more popular than network model Network model is more popular than the hierarchical and relational model.

It does not uses client server architecture It uses client – server architecture

One to many relationship is maintained. One to many and many to many relationship is maintained.

Hierarchical model is based on tree like structure with one root. Network model is based on tree like structure with many roots.

One child or many children have only one parent Many children have many parent

Main application of hierarchical model is in the mainframe database system. It is upgraded version of hierarchical model so used in network any 4 points b Explain set Operators with example. 4 M Ans Set operators combine the results of two component queries into a single result. Queries containing set operators are called as compound queries. Set operators in SQL are represented with following special keywords as: Union, Union all, intersection & minus. Consider data from two tables emp and employee as 1 mark for explanation and 1 mark for example each

**(Autonomous) (ISO/IEC - 27001 - 2013 Certified)


Emp Employee

  1. Union:** The Union of two or more sets contains all elements, which are present in either or both. Union works as or. E.g. select ename from emp union select ename from employee; The output considering above data is : **Output
  2. Union all:** The Union of 2 or more sets contains all elements, which are present in both, including duplicates. E.g. select ename from emp union all select ename from employee; The output considering above data is: Output Ename a b c d Ename c e Ename a b c d e

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ Output: rajesh ii) Upper(char)- Returns the input string with all letters in upper case. Example: SQL>Select upper (‘rajesh’) from dual; Output: RAJESH iii) Ltrim(char,set)- It removes or trims from left of character string

. Example: SQL>Select Ltrim(‘university’,’univ’) from dual; Output: ersity iv) Rtrim(char,set)- It removes or trims from right of character string. Example: SQL>Select Rtrim(‘university’,’sity’) from dual; Output: univer v) Length(char)- It returns length of character string. Example: SQL> Select length(‘University’) from dual; Output: vi) Concat(str1,str2,...)- Returns the string that result from concatenating the arguments. Example: Select Concat(‘employee’, ‘name’) from dual; Output: employeename vii) Lpad(str, len, padstr)- Returns the string str, left-padded with the string padstr to a length of len characters. Example: Select lpad(ename,10.’’) from emp where empno=7782; viii) Rpad(str,len,padstr)- Returns the string str, right-padded with the string padstr to a length of len characters. Example: Select rpad(ename,10.’’) from emp where empno=7782;

**(Autonomous) (ISO/IEC - 27001 - 2013 Certified)


viii) Substr(Char,m,n)-** It returns a portion of char, beginning at a character m, n character long. Example: Select substr(‘College’,3,4) from dual; Output: lleg d Describe exception handling in brief. 4 M Ans Exception Handling: Exception is nothing but an error. Exception can be raise when DBMS encounters errors or it can be raised explicitly. When the system throws a warning or has an error it can lead to an exception. Such exception needs to be handled and can be defined internally or user defined. Exception handling is nothing but a code block in memory that will attempt to resolve current error condition. **Syntax: DECLARE ; Declaration section …executable statement; EXCEPTION WHEN ex_name1 THEN ; Error handling statements/user defined action to be carried out; END; Types of Exception:

  1. Predefined Exception/system defined exception/named exception:** Are always automatically raised whenever related error occurs. The most common errors that can occur during the execution of PL/SQL. Not declared explicitly i.e. cursor already open, invalid cursor, no data found, zero divide and too many rows etc. Programs are handled by system defined Exceptions. 2) User defined exception: It must be declare by the user in the declaration part of the block where the exception is used. It is raised explicitly in sequence of statements using: Raise_application_error(Exception_Number, Error_Message); any relevant 4 points 1 mark each 3 Attempt any THREE of the following : 12 M a Describe commit and rollback with syntax and example. 4 M

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ Syntax: SELECT tablename.column1_name,tablename.column1_name FROM table_name1,table_name where table_name1.column_name=table_name2.column_name; Example: Select stud_info.stud_name, stud_info.branch_code, branch_details.location From stud_info, branch_details Where Stud_info.branch_code=branch_details.branch_code; 2) SELF JOIN: The SQL SELF JOIN is used to join a table to itself, as if the table were two tables, temporarily renaming at least one table in the SQL statement. Syntax: SELECT a.column_name, b.column_name FROM table1 a, table1 b WHERE a.common_filed = b.common_field; Example: Select x.stud_name, y.stud_name from stud_info x, stud_info y Where x.leader= y.stud_id; 3) LEFT OUTER JOIN: A left outer join retains all of the rows of the “left” table, regardless of whether there is a row that matches on the “right” table. Syntax: Select column1name,column2name from table1name any_alias1 ,table2name any_alias on any_alias1.columnname(+) = any_alias2.columnname; OR

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ Select column1name,column2name from table1name left outer join table2name on table1name.columnname= table2name.columnname; Example: select last_name, department_name from employees e, departments d on e.department_id(+) = d.department_id; OR select last_name, department_name from employees left outer join departments on employees.department_id = departments.department_id; 4) RIGHT OUTER JOIN: A right outer join retains all of the rows of the “right” table, regardless of whether there is a row that matches on the “left” table. Syntax: Select column1name, column2name from table1name any_alias1, table2name any_alias on any_alias1.columnname =any_alias2.columnname (+); OR Select column1name, column2name from table1name any_alias1 right outer join table2 name any_alias on any_alias1.columnname =any_alias2.columnname; Example: Select last_name,department_name from employees e, departments d on e.department_id = d.department_id(+); OR

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ Where,  function-name specifies the name of the function.  [OR REPLACE] option allows the modification of an existing function.  The optional parameter list contains name, mode and types of the parameters. IN represents the value that will be passed from outside and OUT represents the parameter that will be used to return a value outside of the procedure.  The function must contain a return statement.  The RETURN clause specifies the data type you are going to return from the function.  function-body contains the executable part.  The AS keyword is used instead of the IS keyword for creating a standalone function. Example: CREATE OR REPLACE FUNCTION Success_cnt RETURN number IS cnt number(7) := 0; BEGIN SELECT count(*) into cnt FROM candidate where result='Pass'; RETURN cnt; END; / d Explain database security with its requirements in detail. 4 M Ans Database security Database security refers to the collective measures used to protect and secure a database or database management software from illegal use and malicious threats and attacks. Requirements of Database Security:

  1. For prevention of data theft such as bank account numbers, credit card information, passwords, work related documents or sheets, etc.
    1. To make data remain safe and confidential.
  2. To provide confidentiality which ensures that only those individuals should ever Definition 1 Mark, 3 mark for detail description

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ be able to view data they are not entitled to.

  1. To provide integrity which ensures that only authorized individuals should ever be able change or modify information.
  2. To provide availability which ensure that the data or system itself is available for use when authorized user wants it.
  3. To provide authentication which deals with the desire to ensure that an authorized individual.
  4. To provide non-repudiation which deals with the ability to verify that message has been sent and received by an authorized user. **OR
  5. Confidentiality:** The principle of confidentiality specifies that only sender and intended recipients should be able to access the contents of a message. Confidentiality gets compromised if an unauthorized person is able to access the contents of a message 2. Integrity: when the contents of the message are changed after the sender sends it, but before it reaches the intended recipient, we say that the integrity of the message is lost. 3. Authentication: Authentication helps to establish proof of identities. The Authentication process ensures that the origin of a message is correctly identified.
    1. Availability: The goal of availability s to ensure that the data, or the system itself, is available for use when the authorized user wants it. 4 Attempt any THREE of the following : 12 M a Explain the four roles of database administrator. 4 M Ans 1. Schema Definition^ The Database Administrator creates the database schema by executing DDL statements. Schema includes the logical structure of database table (Relation) like data types of attributes, length of attributes, integrity constraints etc. 2. Storage structure and access method definition The DBA creates appropriate storage structures and access methods by writing a set of definitions which is translated by data storage and DDL compiler. 3. Schema and physical organization modification DBA writes set of definitions to modify the database schema or description of physical storage organization. 1 Mark for each role

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ Example: In the above relation NAME, LOCATION depends on SNO and QTY on (SNO, PNO) so the table can be split up into two tables as Supplier(SNO,SNAME,LOCATION) and SP(SNO,PNO,QTY) and now both the tables are in second normal form. Supplier SNO SNAME LOCATION S1 Abc Mumbai S2 Pqr Pune S3 Lmn Delhi Supplier_Product SNO PNO QTY S1 P1 200 S2 P2 300 S3 P1 400 c Draw the block structure of PL/SQL. List advantages of PL/SQL. 4 M Ans (^) Declare (Optional) --Use for declaring variables Begin (Mandatory) --Use for writing executable code; Exception (Optional) --Use to write exceptions to be catch during run time. End; (Mandatory) --To terminate PL-SQL block/ code. For block structure - 2 Marks, For advantages - 2 Marks

**(Autonomous) (ISO/IEC - 27001 - 2013 Certified)


Advantages of PL/SQL:**

  1. PL/SQL is portable and high transaction processing language.
  2. PL/SQL is in fact procedural language but it also supports object oriented programming.
  3. It allows user to write as well as access the functions and procedures from outside the programs.
  4. It has got built in libraries of packages. d Write step by step syntax to create, open and close cursor in PL/SQL. 4 M Ans A cursor holds the rows (one or more) returned by a SQL statement. Declaring: This term is used to declare a cursor so that memory initialization will take place. A cursor is declared by defining the SQL statement that returns a result set. Example: Declare CURSOR Winter_18 IS SELECT roll_no, std_name, percentage FROM student; Opening: A Cursor is opened and populates data by executing the SQL statement defined by the cursor. Example: Open Winter_18; Closing a Cursor: This forces cursor for releasing the allocated memory assigned/ occupied by cursor. Example: CLOSE Winter_18; 2 marks, Opening: 1 mark, Closing cursor: 1 mark e Explain Transaction ACID properties. 4 M **Ans ACID properties of transaction
  5. Atomicity:** When one transaction takes place, many operations occur under one transaction. Atomicity means either all operations will take place property and reflect in the database or none of them will be reflected. 2. Consistency: Consistency keeps the database consistent. Execution of a transaction For each property - 1 Mark

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ where emp_city=’Pune’ or emp_city=’Nagpur’ ii) Change the employee name ‘Ayush’ to ‘Ayan’ update Employee set emp_name=’Ayan’ where emp_name=’Ayush’ iii) Display the total number of employee whose dept is 50 Select count(*) from Employee where emp_dept=50; c Consider the following schema Depositor (ACC_no, Name, PAN, Balance). Create a view on Depositor having attributes(ACC_No,PAN) where balance is greater than 100000

6 M

Ans create view v as select ACC_No,PAN from Depositor where balance > 100000; Correct logic 3M, Correct syntax :3M 6 Attempt any TWO of the following : 12 M a Create a sequence i) Sequence name is Seq_1, Start with 1, increment by 1, minimum value 1, maximum value 20. ii) Use a seq_1 to insert the values into table Student( ID Number(10), Name char (20)); iii) Change the Seq_1 max value 20 to 50. iv) Drop the sequence.

6 M

Ans i)^ create sequence Seq_1 start with 1 increment by 1 minvalue 1 maxvalue 20; ii) insert into student values(Seq_1.nextval,’ABC’); Query 1: 2M, Query 2: 2M, Query 3 : 1M, Query 4 : 1M

(Autonomous) (ISO/IEC - 27001 - 2013 Certified) __________________________________________________________________________________________________ iii) Alter sequence Seq_1 maxvalue 50; iv) Drop sequence Seq_1; b Write a PL/SQL program which accepts the customer_ID from the user. If the enters an invalid ID then the exception invalid_id is raised using exception handling.

6 M

Ans DECLARE c_id numeric(10); invalid_id_Exception Exception; BEGIN c_id:=&c_id; if(c_id<0) then raise invalid_id_Exception; end if; EXCEPTION WHEN invalid_id_Exception THEN dbms_output.put_line('Invalid customer id'); END; Correct logic : 3M, Correct syntax : 3M c i) create user ‘Rahul’ ii) grant create, select,insert,update, delete, drop privilege to ‘Rahul’ iii) Remove the select privilege from user ‘Rahul’

6 M

Ans (i) create user Rahul identified by rahul1234; (ii)

  1. assuming table Employee for granting permissions to user ‘Rahul’ for select, insert, update and delete privilege) Grant select, insert,update,delete on employee to Rahul;
  2. for create and drop privilege which are system privileges not specific to any object such as table Grant connect, resource, DBA to Rahul; iii) (assuming table Employee for revoking permissions to user ‘Rahul’) Revoke select on Employee from Rahul; each query : 2M