Top Banner

of 14

DBMS Viva Questions MCA Idol

Jul 05, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/15/2019 DBMS Viva Questions MCA Idol

    1/14

     

    DBMS Basic VIVA Questions and Answers

    MCA – SEM3

    1. What is database?

    A database is an organized collection of data. The data are typically organized tomodel

    2. What is DBMS?

    Database management system is a collection of interrelated data and a set ofprograms to access those data. Collection of data is referred to as a database.

    3. What is data independence?

    We can define two types of data independence

    1. Logical data independence: It is the capacity to change the conceptualschema without having to change external schemas or application programs.

    2. Physical data independence: It is the capacity to change theinternal schema without having to change the conceptual (or external) schemas.

    4. What is data Abstraction?

    Since database system users are not computer trained, developers hide thecomplexity from users through 3 levels of abstraction, to simplify user’s

    interaction with the system. Is known as abstraction

    5. What are the levels of abstraction?

    1)Physical level of data abstraction: This s the lowest level of abstraction whichdescribes how data are actually stored.

    2)Logical level of data abstraction: This level hides what data are actually storedin the database and what relationship exists among them.

    3)View Level of data abstraction: View provides security mechanism to preventuser from accessing certain parts of database.

    6. What are data models?

    A data model is a collection of concepts that can be used to describe thestructure of a database. Data models can be broadly distinguished into 3 maincategories-1)high-level or conceptual data models (based on entities & relationships) Itprovides concepts that are close to the way many users perceive data.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    2/14

     

    2)lowlevel or physical data models It provides concepts that describe the detailsof how data is stored in the computer. These concepts are meant for computerspecialist, not for typical end users.3)representational or implementation data models (record-based,object-oriented)

    7. What are the different types of database users?

    1) Naive users:

    These are the unsophisticated users who interact with the system by invokingone of the application programs that have been written previously.

    2) Application programmers:

    These are computer professionals who write application programs, used todevelop user interfaces.

    3) Sophisticated users:These users interact with the database using database query language. Theysubmit their query to the query processor.

    4) Specialized users:

    These users write specialized database applications to retrieve data. Theseapplications can be used to retrieve data with complex data types

    8. Who is database administrator (DBA)?A person having who has central control over data and programs that access thedata is called DBA

    9. What are the roles of DBA?

    1) Schema definition: DBA creates database schema by executing DataDefinition Language (DDL) statements.

    2) Storage structure and access method definition3) Schema and physical organization modification: If any changes are to be

    made in the original schema, to fit the need of your organization, then thesechanges are carried out by the DBA.

    4) Granting of authorization foe data access: DBA can decide which parts ofdata can be accessed by which users.

    5) Routine maintenance: DBA has to take periodic backups of the database,ensure that enough disk space is available to store new data, ensure thatperformance of dbms ix not degraded by any operation carried out by theusers.

    10. What is hierarchical data model

    In this model, each record in the database represented a specific part. Therecords had parent/child relationships, linking each part to its subpart, and so on.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    3/14

     

    11. What is network data model

    The network data model extended the hierarchical model by allowing a record toparticipate in multiple parent/child relationships.

    12. What is Entity?

    The basic object that the ER model represents is an entity, which is a “thing” inthe real world with an independent existence.

    13. What is Attributes?

    Each entity has attributes—the particular properties that describe it.

    For example, an employee entity may be described by the employee’s name,age, address, salary, and job.

    14. What is Keys?

    An important constraint on the entities of an entity type is the key or uniquenessconstraint on attributes. A key is an attribute (also known as column or field) or acombination of attribute that is used to identify records.

    15. What are the types of Key?

    (I) Super Key – An attribute or a combination of attribute that is used to identifythe records uniquely is known as Super Key. A table can have many SuperKeys.

    (II) Candidate Key – It can be defined as minimal Super Key or irreducible SuperKey. In other words an attribute or a combination of attribute that identifies therecord uniquely but none of its proper subsets can identify the recordsuniquely.

    (III)Primary Key – A Candidate Key that is used by the database designer forunique identification of each row in a table is known asPrimary Key

    (IV) Foreign Key – A foreign key is an attribute or combination of attribute inone base table that points to the candidate key (generally it is the primarykey) of another table.

    (V) Composite Key – If we use multiple attributes to create a Primary Key thenthat Primary Key is called Composite Key

    (VI) Alternate Key – Alternate Key can be any of the Candidate Keys exceptfor the Primary Key.

    (VII) Secondary Key – The attributes that are not even the Super Key but canbe still used for identification of records (not unique) are known as SecondaryKey.

    16. What is cardinalities?

    Mapping cardinalities, or cardinality ratios, express the number of entities towhich another entity can be associated via a relationship set.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    4/14

     

    There are three types of relationships

    1) One to one2) One to many3) Many to many

    17. What is Participation?

    The participation of an entity set E in a relationship set R is said to be total ifevery entity in E participates in at least one\ relationship in R.

    •  If only some entities in E participate in relationships in R, the participation ofentity set E in relationship R is said to be partial.

    18. What is Weak Entities?

    An entity set may not have sufficient attributes to form a primary key. Such an

    entity set is termed a weak entity set.

    19. What is Weak Entities?

    An entity set having sufficient attributes to form a primary key. Such an entity setis termed a Strong entity set.

    20. What is Specialization

    The process of designating sub groupings within an entity set is calledspecialization.

    For example, customer entities may be described further by the attributecustomer-id, whereas employee entities may be described further by the

    attributes employee-id and salary.

    21. What is Generalization

    Generalization defines a is-a-kind of relationship in which one class shares itsstructure and/or behavior with one or more other classes.

    22. What is Aggregation

    Aggregation represents abstract entities by allowing relationship betweenrelationships. As you work with ER Diagrams you will come across the need forcertain type of entities that are overlapping. For example, an ‘Employee’ ‘works-on’ a ‘branch’. An ‘Employee’ ‘manages’ some tasks. The ‘Works-on’ entity herecan be abstracted via the use of aggregation. This is represented in a ERdiagram by a diamond shape.

    23. How to Create Table?

    create table account(account-number char(10),balance integer)

  • 8/15/2019 DBMS Viva Questions MCA Idol

    5/14

     

    24. how to drop a table?

    DROP TABLE CUSTOMER

    25. Difference between TRUNCATE, DELETE and DROP commands

    The DELETE command is used to remove rows from a table. A WHERE clausecan be used to only remove some rows. If no WHERE condition is specified, allrows will be removed.

    TRUNCATE removes all rows from a table. The operation cannot be rolled backand no triggers will be fired. As such, TRUCATE is faster and doesn’t use asmuch undo space as a DELETE.

    The DROP command removes a table from the database. All the tables’ rows,

    indexes and privileges will also be removed. No DML triggers will be fired. Theoperation cannot be rolled back.

    DROP and TRUNCATE are DDL commands, whereas DELETE is a DMLcommand. Therefore DELETE operations can be rolled back (undone), whileDROP and TRUNCATE operations cannot be rolled back.

    26. What is View?

    A view is a “virtual table” in the database whose contents are defined by a query.

    27. Advantages of VIEW?

    Security, Query simplicity, Structural simplicity, Insulation from change, Data

    integrity

    28. Disadvantages of VIEW?

    Performance issue, Update restrictions

    29. What are different DDL commands?

    Create, drop, and alter

    30. What are different DDL commands?

    Select, insert, update, delete

    31. What is Joins?

    The process of forming pairs of rows by matching the contents of relatedcolumns is called joining the tables.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    6/14

     

    32. What are the types of Joins?

    INNER JOIN

    Inner join shows matches only when they exist in both tables.

    LEFT OUTER JOINLeft join will display all records in left table of the SQL statement.

    RIGHT OUTER JOIN

    Right join will display all records in right table of the SQL statement.

    33. What is trigger

    The concept of a trigger is relatively straightforward. For any event that causes achange in the contents of a table, a user can specify an associated action thatthe DBMS should carry out. The three events that can trigger an action areattempts to INSERT, DELETE, or UPDATE rows of the table.

    34. What are the different types of storage?

    Primary storage: This category includes storage media that can be operated ondirectly by the computer central processing unit (CPU), such as the computermain memory and smaller but faster cache memories.

    Secondary storage: This category includes magnetic disks, optical disks, andtapes. These devices usually have a larger capacity, cost less, and provideslower access to data than do primary storage devices.

    35. What is indexing?

    A database index is a data structure that improves the speed of data retrievaloperations on a database table at the cost of slower writes and increased storagespace. Indices can be created using one or more columns of a database table,providing the basis for both rapid random lookups and efficient access of orderedrecords.

    36. What is Tree Structured Indexing?

    The data entries are arranged in sorted order by search key value, and ahierarchical search data structure is maintained that directs searches to thecorrect page of data entries.

    37. What is Hash Based indexing?

    We can organize records using a technique called hashing to quickly find recordsthat have a given search key value. For example, if the file of employee recordsis hashed on the name field, we can retrieve all records about Joe. In thisapproach, the records in a file are grouped in buckets, where a bucket consists ofa primary page and, possibly, additional pages linked in a chain. The bucket towhich a record belongs can be determined by

  • 8/15/2019 DBMS Viva Questions MCA Idol

    7/14

     

    applying a special function, called a hash function, to the search key. Given abucket number, a hash-based index structure allows us to retrieve the primarypage for the bucket in one or two disk l/Os. On inserts, the record is inserted intothe appropriate bucket, with ‘overflow’ pages allocated as necessary.

    38. What is Functional dependency?Functional dependency describes the relationship between attributes in arelation. For example, if A and B are attributes of relation R, and B is functionallydependent on A ( denoted A B), if each value of A is associated with exactly onevalue of B. ( A and B may each consist of one or more attributes.)

    39. Explain 1NF,2NF,3NF?

    Normalization is the process of successively reducing relations with anomalies toproduce smaller and well structured relations.

    First normal form (1NF) is a relation that has a primary key and in which there

    are no repeating groups.

    Second normal form (2NF) a relation in first normal form in which every non keyattribute is fully functionally dependent on the primary key.

    Third normal form (3NF)a relation that is in second normal form and has notransitive dependencies.

    40. What is BCNF?

    Boyce-Codd normal form (or BCNF or 3.5NF) is a normal form used in databasenormalization. It is a slightly stronger version of the third normal form (3NF). Atable is in Boyce-Codd normal form if and only if for every one of its non-trivial[dependencies] X→ Y, X is a superkey—that is, X is either a candidate key or asuperset thereof.

    41. Compare 3NF & BCNF

    Boyce Codd normal form (also known as BCNF) is a normal form –that is a formthat provides criteria for determining a table’s degree of vulnerability to logicalinconsistencies and anomalies. 3NF is a normal form that is also used indatabase normalisation. It is thought that a table is in 3NF if and only if 1) thetable is in second normal form (or 2NF, which is a first normal code, or 1NF, thathas met the criteria to become a 2NF), and 2) every non-prime attribute of thetable is non-transitively dependent on

    every key of the table (meaning it is not directly dependent on every key). Thereis another postulation of 3NF that is also used to define the differences between3NF and the BCNF.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    8/14

     

    42. What is Transaction?

    A transaction is a collection of operations that performs a single logicalfunction in a database application

    43. What is Recovery? What are its techniques?

    Process of restoring database to a correct state in the event of a failure. TheRecovery techniques are as follows:Deferred Update• Updates are not written to the database until after a transaction has reached itscommit point.

    Immediate Update• Updates are applied to database as they occur.• Need to redo updates of committed transactions following a failure.

    Shadow Paging.

    • Maintain two page tables during life of a transaction: current page and shadowpage table.• When transaction starts, two pages are the same.• Shadow page table is never changed thereafter and is used to restore databasein event of failure.

    44. What is locking? Explain locking techniques.

    DBMS products use sophisticated locking techniques to handle concurrent SQLtransactions for many simultaneous users. A shared lock is used by the DBMSwhen a transaction wants to read data from the database. Another concurrenttransaction can also acquire a shared lock on the same data, allowing the other

    transaction to also read the data. An exclusive lock is used by the DBMS when atransaction wants to update data in the database. When a transaction has anexclusive lock on some data, other transactions cannot acquire any type of lock(shared or exclusive) on the data.

    45. What is deadlock? Its Prevention & Avoidance?

    A deadlock is a situation wherein two or more competing actions are eachwaiting for the other to finish, and thus neither ever does.

    46. What is two phase locking?

    According to the two-phase locking protocol, a transaction handles its locks in

    two distinct, consecutive phases during the transaction's execution:

    1. Expanding phase (number of locks can only increase): locks Care acquiredand no locks are released.2. Shrinking phase: locks are released and no locks are acquired.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    9/14

     

    47. What is GRANT privileges?

    The GRANT statement is used to grant the privileges on the database objects tospecific users. Normally the GRANT statement is used by owner of the table orview to give other users access to the data. The GRANT statement includes listof the privileges to be granted, name of the table to which privileges apply and

    user id to which privileges are granted.E.g. 1) Give user ABC full access to employee table:GRANT Select, Insert, Delete, update on employee to ABC

    48. What is REVOKE privileges?

    In most SQL based databases, the privileges that you have granted with theGRANT statement can be taken away with the REVOKE statement. Thestructure of the REVOKE statement is much similar to that of the GRANTstatement. A REVOKE statement may take away all or some of the privilegesgranted to a user id.

    E.g. Revoke Select, Insert on employee from ABC.

    49. What is Serializability?

    In concurrency control of databases, transaction processing (transactionmanagement), and various transactional applications, both centralized anddistributed, a transaction schedule is serializable, has the Serializability property,if its outcome (the resulting database state, the values of the database's data) isequal to the outcome of its transactions executed serially, i.e., sequentiallywithout overlapping in time.

    49. What are Locking parameters?Lock size, Number of locks, Lock timeout

    50. what are levels of Locking?Database level locking: Locking can be implemented at various levels of theDatabase. In its crudest form, the DBMS could lock the entire database for eachtransaction.

    Page level locking:Many DBMS products implement locking at the page level. In this scheme, the

    DBMS locks individual blocks of data ("pages") from the disk as they areaccessed by a transaction.

    Row level locking:Over the last several years, most of the major commercial DBMS systems havemoved beyond page-level locking to row-level locks.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    10/14

     

    50. What is Authorization and Integrity manager?

    It is the program module, which tests for the satisfaction of integrity constraintand checks the authority of user to access data.

    51. What are stand-alone procedures?

    Procedures that are not part of a package are known as stand-alone becausethey independently defined. A good example of a stand-alone procedure is onewritten in a SQL*Forms application. These types of procedures are not availablefor reference from other Oracle tools. Another limitation of stand-aloneprocedures is that they are compiled at run time, which slows execution.

    52. What are cursors give different types of cursors?

    PL/SQL uses cursors for all database information accesses statements. The

    language supports the use two types of cursors1.) Implicit2.) Explicit

    53. What are stored-procedures? And what are the advantages of usingthem?

    Stored procedures are database objects that perform a user defined operation. Astored procedure can have a set of compound SQL statements. A stored

    procedure executes the SQL commands and returns the result to the client.Stored procedures are used to reduce network traffic.

    54. How do you communicate with an RDBMS?

    You communicate with an RDBMS using Structured Query Language (SQL).

    55. Name the sub-systems of a RDBMS.

    I/O, Security, Language Processing, Process Control, Storage Management,Logging and Recovery, Distribution Control, Transaction Control, MemoryManagement, Lock Management.

    56. What is a query?

    A query with respect to DBMS relates to user commands that are used to interactwith a data base. The query language can be classified into data definitionlanguage and data manipulation language.

  • 8/15/2019 DBMS Viva Questions MCA Idol

    11/14

     

    57. What do you mean by Correlated subquery?

    Subqueries, or nested queries, are used to bring back a set of rows to be usedby the parent query. Depending on how the subquery is written, it can beexecuted once for the parent query or it can be executed once for each row

    returned by the parent query. If the subquery is executed for each row of theparent, this is called a correlated subquery.

    A correlated subquery can be easily identified if it contains any references to theparent subquery columns in its WHERE clause. Columns from the subquerycannot be referenced anywhere else in the parent query. The following exampledemonstrates a non-correlated subquery.

    Example: Select * From CUST Where '10/03/1990' IN (Select ODATE FromORDER Where CUST.CNUM = ORDER.CNUM)

    58. What is meant by query optimization?

    The phase that identifies an efficient execution plan for evaluating a query thathas the least estimated cost is referred to as query optimization.

    59. What is durability in DBMS?

    Once the DBMS informs the user that a transaction has successfully completed,its effects should persist even if the system crashes before all its changes arereflected on disk. This property is called durability.

    60. What do you mean by atomicity and aggregation?

    1. Atomicity: Either all actions are carried out or none are. Users should nothave to worry about the effect of incomplete transactions. DBMS ensuresthis by undoing the actions of incomplete transactions.

    2. Aggregation: A concept which is used to model a relationship between acollection of entities and relationships. It is used when we need to expressa relationship among relationships.

    61. What is a Phantom Deadlock?

    In distributed deadlock detection, the delay in propagating local information mightcause the deadlock detection algorithms to identify deadlocks that do not reallyexist. Such situations are called phantom deadlocks and they lead tounnecessary aborts.

    62. What is a checkpoint and When does it occur?

  • 8/15/2019 DBMS Viva Questions MCA Idol

    12/14

     

    A Checkpoint is like a snapshot of the DBMS state. By taking checkpoints, theDBMS can reduce the amount of work to be done during restart in the event ofsubsequent crashes.

    63. What are the different phases of transaction?

    Different phases are1.) Analysis phase,2.) Redo Phase,3.) Undo phase.

    64. What is 4NF?

    A relation schema R is said to be in 4NF if for every Multivalued dependency X Ythat holds over R, one of following is true.1.) X is subset or equal to (or) XY = R.

    2.) X is a super key.

    65. What is 5NF?

    A Relation schema R is said to be 5NF if for every join dependency {R1, R2, ...,Rn} that holds R, one the following is true 1.) Ri = R for some i.2.) The join dependency is implied by the set of FD, over R in which the left sideis key of R.

    66. What is Domain-Key Normal Form?

    A relation is said to be in DKNF if all constraints and dependencies that shouldhold on the the constraint can be enforced by simply enforcing the domainconstraint and key constraint on the relation.

    67. What is indexing and what are the different kinds of indexing?

    Indexing is a technique for determining how quickly specific data can be found.Types:

    1. Binary search style indexing2. B-Tree indexing3. Inverted list indexing4. Memory resident table5. Table indexing

    68. What is system catalog or catalog relation? How is better known as?

  • 8/15/2019 DBMS Viva Questions MCA Idol

    13/14

     

    A RDBMS maintains a description of all the data that it contains, informationabout every relation and index that it contains. This information is stored in acollection of relations maintained by the system called metadata. It is also calleddata dictionary.

    69. What is Lossless join property?

    It guarantees that the spurious tuple generation does not occur with respect torelation schemas after decomposition.

    70. What is normalization?

    It is a process of analysing the given relation schemas based on their FunctionalDependencies (FDs) and primary key to achieve the properties(1).Minimizing redundancy, (2). Minimizing insertion, deletion and updateanomalies.

    71. What is DML Compiler?

    It translates DML statements in a query language into low-level instruction thatthe query evaluation engine can understand.

    72. What is Query evaluation engine?

    It executes low-level instruction generated by compiler.

    73. What is DDL Interpreter?

    It interprets DDL statements and record them in tables containing metadata.

    74. What is Relationship set?

    The collection (or set) of similar relationships.

    75. What is Relationship type?

    Relationship type defines a set of associations or a relationship set among agiven set of entity types.

    76. What is degree of Relationship type?

    It is the number of entity type participating.

    77. What is degree of a Relation?

  • 8/15/2019 DBMS Viva Questions MCA Idol

    14/14

     

    It is the number of attribute of its relation schema.

    78. What is Object Oriented model?

    This model is based on collection of objects. An object contains values stored in

    instance variables with in the object. An object also contains bodies of code thatoperate on the object. These bodies of code are called methods. Objects thatcontain same types of values and the same methods are grouped together intoclasses.