DBMS Interview Questions
A list of top frequently
asked DBMS
interview questions and answers are given below.
1) What is DBMS?
DBMS is a collection of
programs that facilitates users to create and maintain a database.
2) What is a database?
Database is a logical,
consistent and organized collection of data that it can easily be accessed,
managed and updated.
For more information: Click
here
3) What is a database system?
The collection of database and
DBMS software together is known as database system.
4) What are the advantages of DBMS?
- Redundancy control
- Restriction for unauthorized access
- Provides multiple user interfaces
- Provides backup and recovery
- Enforces integrity constraints
For more information: Click here
5) What is checkpoint in DBMS?
A Checkpoint is like a snapshot
of the DBMS state.
6) When does checkpoint occur in DBMS?
By taking checkpoints, the DBMS
can reduce the amount of work to be done during restart in the event of
subsequent crashes.
7) What do you mean by transparent DBMS?
The transparent DBMS is a type
of DBMS which keeps its physical structure hidden from users.
8) What are the unary operations in Relational Algebra?
PROJECTION and SELECTION are
the unary operations in relational algebra.
9) How do you communicate with an RDBMS?
You have to use Structured
Query Language (SQL) to communicate with RDBMS.
10) How many types of database languages are?
There are four types of
database languages:
- Data Definition Language (DDL) e.g.
CREATE, ALTER, DROP etc.
- Data Manipulation Language (DML) e.g.
SELECT, UPDATE, INSERT etc.
- DATA Control Language (DCL) e.g.
GRANT and REVOKE.
- Transaction Control Language (TCL) e.g.
COMMIT and ROLLBACK.
11) What do you understand by Data Model?
Data model is specified as a
collection of conceptual tools for describing data, data relationships data
semantics and constraints.
12) Define a Relation Schema and a Relation.
A Relation Schema is denoted by
R(A1, A2, ..., An) is made up of the relation name R and the list of attributes
Ai that it contains.
A relation is specified as a
set of tuples.
See this example:
Let r be the relation which
contains set tuples (t1, t2, t3, ..., tn). Each tuple is an ordered list of
n-values t=(v1,v2, ..., vn).
13) What is degree of a Relation?
The degree of relation is a
number of attribute of its relation schema.
14) What is Relationship?
Relationship is defined as an
association among two or more entities.
15) What are the disadvantages of file processing systems?
- Inconsistent
- Not secure
- Data redundancy
- Difficult in accessing data
- Data isolation
- Data integrity
- Concurrent access is not possible
16) What is data abstraction in DBMS?
Data abstraction in DBMS is a
process of hiding irrelevant details from users. Because Database systems are
made of complex data structures so, it makes easy the user interaction with
database.
17) What are the three levels of data abstraction?
Following are three levels of
data abstraction:
Physical level: It
is the lowest level of abstraction. It describes how data are stored.
Logical level: It
is the next higher level of abstraction. It describes what data are stored in
database and what relationship among those data.
View level: It
is the highest level of data abstraction. It describes only part of entire
database.
18) What is DDL (Data Definition Language)?
Data Definition Language (DDL)
is a standard for commands which define the different structures in a database.
Most commonly DDL statements are CREATE, ALTER, and DROP.
19) What is DML (Data Manipulation Language)?
Data Manipulation Language
(DML) is a language that enable user to access or manipulate data as organised
by appropriate data model.
There are two type of DML:
Procedural DML or Low
level DML: It requires a user to specify what data are needed and how
to get those data.
Non-Procedural DML or
High level DML: It requires a user to specify what data are needed without
specifying how to get those data.
20) Explain the functionality of DML Compiler.
The DML Compiler translates DML
statements in a query language that the query evaluation engine can understand.
21) What is Relational Algebra?
Relational Algebra is a
Procedural Query Language which contains a set of operations that take one or
two relations as input and produce a new relation.
22) What is Relational Calculus?
Relational Calculus is a
Non-procedural Query Language which uses mathematical predicate calculus
instead of algebra.
23) What do you understand by query optimization?
The term query optimization
specifies an efficient execution plan for evaluating a query that has the least
estimated cost.
24) What do you mean by 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 are reflected on disk. This
property is called durability.
25) What is normalization?
Normalization is a process of
analyzing the given relation schemas according to their functional
dependencies. It is used to minimize redundancy and also minimize insertion,
deletion and update distractions.
26) What is Denormalization?
Denormalization is the process
of boosting up database performance and adding of redundant data which helps to
get rid of complex data.
27) What is functional Dependency?
Functional Dependency is the
starting point of normalization. It exists when a relation between two
attributes allows you to uniquely determine the corresponding attribute's
value.
28) What is E-R model?
E-R model is a short name for
Entity Relationship model. This model is based on real world. It contains basic
objects (known as entities) and relationship among these objects.
29) What is entity?
Entity is a set of attributes
in a database.
30) What is an Entity type?
An entity type is specified as
a collection of entities, having same attributes.
31) What is an Entity set?
The entity set specifies the
collection of all entities of particular entity type in the database.
32) What is an Extension of entity type?
An extension of entity type is
specified as a collection of entities of a particular entity type are grouped
together into an entity set.
33) What is Weak Entity set?
When an entity set doesn't have
sufficient attributes to form a primary key, and its primary key compromises of
its partial key and primary key of its parent entity, then it is called Weak
Entity set.
34) What is an attribute?
An attribute is a particular
property, which describes the entity.
35) What are the integrity rules in DBMS?
There are two integrity rules
in DBMS:
Entity Integrity: It
specifies that "Primary key cannot have NULL value."
Referential Integrity: It
specifies that "Foreign Key can be either a NULL value or should be
Primary Key value of other relation.
36) What do you mean by extension and intension?
Extension: Extension
is the number of tuples present in a table at any instance. This is time
dependent.
Intension: Intension
is a constant value that gives the name, structure of table and the constraints
laid on it.
37) What is System R? How many of its two major subsystems?
System R was designed and
developed over a period of 1974-79 at IBM San Jose Research Center. It is a
prototype which is developed to demonstrate that it is possible to build a
Relational System that can be used in a real life environment to solve real
life problems, with performance at least comparable to that of existing system.
Following are two major
subsystems of System R:
- Research Storage
- System Relational Data System
38) What is Data Independence?
Data independence specifies
that "the application is independent of the storage structure and access
strategy of data".
It makes you able to modify the
schema definition in one level should not affect the schema definition in the
next higher level.
There are two types of Data
Independence:
Physical Data
Independence: Modification in physical level should not affect the logical
level.
Logical Data
Independence: Modification in logical level should affect the view level.
NOTE: Logical Data Independence is more difficult to achieve.
39) What are the three levels of data abstraction?
Physical level: It
is the lowest level of abstraction. It describes how data are stored.
Logical level: It
is the next higher level of abstraction. It describes what data are stored in
database and what relationship among those data.
View level: It
is the highest level of abstraction. It describes only part of entire database.
40) What is stored procedure?
A stored procedure is a named
group of SQL statements that have been previously created and stored in the
server database.
41) What is 1NF?
1NF is
the First Normal
Form. It is the simplest type of normalization that you can
implement in a database. The main objectives of 1NF are to:
- Remove duplicate columns from the same
table
- Create separate tables for each group
of related data and identify each row with a unique column
42) What is 2NF?
2NF is
the Second Normal
Form. A table is said to be 2NF, if it follows the following
conditions:
- The table is in 1NF.
- Every non-prime attribute is fully functionally
dependent on primary key.
43) What is 3NF?
3NF stands
for Third Normal
Form. A database is called in 3NF if satisfies the following
conditions:
- It is in second normal form.
- There is no transitive functional
dependency.
44) What is BCNF?
BCMF stands
for Boyce-Codd
Normal Form. It is an advance version of 3NF so it is also
referred as 3.5NF. BCNF is stricter than 3NF.
A table complies with BCNF if
it satisfies the following conditions:
- It is in 3NF.
- For every functional dependency
X->Y, X should be the super key of the table.
SQL Interview Questions
There is given sql interview
questions and answers that has been asked in many companies. For PL/SQL
interview questions, visit our next page.
1) What is SQL?
SQL stands for structured query
language. It is a database language used for database creation, deletion,
fetching rows and modifying rows etc. sometimes it is pronounced as se-qwell.
2) When SQL appeared?
It appeared in 1974.
3) What are the usages of SQL?
- To execute queries against a database
- To retrieve data from a database
- To inserts records in a database
- To updates records in a database
- To delete records from a database
- To create new databases
- To create new tables in a database
- To create views in a database
4) Does SQL support programming?
No, SQL doesn't have loop or
Conditional statement. It is used like commanding language to access databases.
5) What are the subsets of SQL?
1. Data
definition language (DDL)
2. Data
manipulation language (DML)
3. Data
control language (DCL)
6) What is data definition language?
Data definition language(DDL)
allows you to CREATE, ALTER and DELETE database objects such as schema, tables,
view, sequence etc.
7) What is data manipulation language?
Data manipulation language
makes user able to access and manipulate data. It is used to perform following
operations.
- Insert data into database
- Retrieve data from the database
- Update data in the database
- Delete data from the database
8) What is data control language?
Data control language allows
you to control access to the database. It includes two commands GRANT and
REVOKE.
GRANT: to
grant specific user to perform specific task.
REVOKE: to
cancel previously denied or granted permissions.
9) What are tables and fields in database?
A table is a set of organized data.
It has columns and rows. Columns can be categorized as vertical, and Rows are
horizontal.
A table contains specified
number of column called fields but can have any number of rows which is known
as record.
10) What is a primary key?
A primary key is a combination
of fields which uniquely specify a row. This is a special kind of unique key.
Primary key values cannot be NULL.
11) What is a foreign key?
A foreign key is specified as a
key which is related to the primary key of another table. Relationship needs to
be created between two tables by referencing foreign key with the primary key
of another table.
12) What is a unique key?
A Unique key constraint
uniquely identifies each record in the database. This provides uniqueness for
the column or set of columns.
13) What are the type of operators available in SQL?
1. Arithmetic
operators
2. Logical
operators
3. Comparison
operator
14) What is view in SQL?
A view is a virtual table which
contains a subset of data within a table. Views are not virtually present, and
it takes less space to store. View can have data of one or more tables
combined, and it is depending on the relationship.
15) What is an Index in SQL?
Index is used to increase the
performance and allow faster retrieval of records from the table. An index
creates an entry for each value and it will be faster to retrieve data.
16) Which are the different types of indexes in SQL?
There are three types of
Indexes in SQL:
- Unique Index
- Clustered Index
- NonClustered Index
17) What is Unique Index?
Unique Index:
This indexing does not allow
the field to have duplicate values if the column is unique indexed. Unique
index can be applied automatically when primary key is defined.
18) What is Clustered Index in SQl?
Clustered Index:
The clustered index is used to
reorder the physical order of the table and search based on the key values.
Each table can have only one clustered index.
19) What is NonClustered Index in SQL?
NonClustered Index:
NonClustered Index does not
alter the physical order of the table and maintains logical order of data. Each
table can have 999 non-clustered indexes.
20) What is the difference between SQL, MySQL and SQL
Server?
SQL or Structured Query
Language is a language which is used to communicate with a relational database.
It provides a way to manipulate and create databases. On the other hand, MySQL
and Microsoft's SQL Server both are relational database management systems that
use SQL as their standard relational database language.
21) What is the difference between SQL and PL/SQL?
SQL or Structured Query
Language is a language which is used to communicate with a relational database.
It provides a way to manipulate and create databases. On the other hand, PL/SQL
is a dialect of SQL which is used to enhance the capabilities of SQL. It was
developed by Oracle Corporation in the early 90's. It adds procedural features
of programming languages in SQL.
22) Is it possible to sort a column using a column alias?
Yes. You can use column alias
in the ORDER BY clause for sorting.
23) What is the difference between clustered and non
clustered index in SQL?
There are mainly two type of
indexes in SQL, Clustered index and non clustered index. The differences
between these two indexes is very important from SQL performance perspective.
1. One
table can have only one clustered index but it can have many non clustered
index.(approximately 250).
2. clustered
index determines how data is stored physically in table. Actually clustered
index stores data in cluster, related data is stored together so it makes
simple to retrieve data.
3. reading
from a clustered index is much faster than reading from non clustered index
from the same table.
4. clustered
index sort and store data rows in the table or view based on their key value,
while non cluster have a structure separate from the data row.
24) What is the SQL query to display current date?
There is a built in function in
SQL called GetDate() which is used to return current timestamp.
25) Which are the most commonly used SQL joins?
Most commonly used SQL joins
are INNER JOIN and (left/right) OUTER JOIN.
26) What are the different types of joins in SQL?
Joins are used to merge two
tables or retrieve data from tables. It depends on the relationship between
tables.
Following are the most commonly
used joins in SQL:
- Inner Join
- Right Join
- Left Join
- Full Join
27) What is Inner Join in SQL?
Inner join:
Inner join returns rows when
there is at least one match of rows between the tables.
28) What is Right Join in SQL?
Right Join:
Right join is used to retrieve
rows which are common between the tables and all rows of Right hand side table.
It returns all the rows from the right hand side table even though there are no
matches in the left hand side table.
29) What is Left Join in SQL?
Left Join:
Left join is used to retrieve
rows which are common between the tables and all rows of Left hand side table.
It returns all the rows from Left hand side table even though there are no
matches in the Right hand side table.
30) What is Full Join in SQL?
Full Join:
Full join return rows when
there are matching rows in any one of the tables. This means, it returns all
the rows from the left hand side table and all the rows from the right hand
side table.
31) What is "TRIGGER" in SQL?
Trigger allows you to execute a
batch of SQL code when an insert, update or delete command is executed against
a specific table.
Actually triggers are special
type of stored procedures that are defined to execute automatically in place or
after data modifications.
32) What is self join and what is the requirement of self
join?
Self join is often very useful
to convert a hierarchical structure to a flat structure. It is used to join a
table to itself as like if that is the second table.
33) What are set operators in SQL?
Union, Intersect or Minus operators
are called set operators.
34) What is the difference between BETWEEN and IN condition
operators?
The BETWEEN operator is used to
display rows based on a range of values. The IN condition operator is used to
check for values contained in a specific set of values.
35) What is a constraint? Tell me about its various levels.
Constraints are representators
of a column to enforce data entity and consistency. There are two levels :
1. column
level constraint
2. table
level constraint
36) Write an SQL query to find names of employee start with
'A'?
1.
SELECT * FROM Employees WHERE EmpName like 'A%'
37) Write an SQL query to get third maximum salary of an
employee from a table named employee_table.
1.
SELECT TOP 1 salary
2.
FROM (
3.
SELECT TOP 3 salary
4.
FROM employee_table
5.
ORDER BY salary DESC ) AS emp
6.
ORDER BY salary ASC;
38) What is the difference between DELETE and TRUNCATE
statement in SQL?
The main differences between
SQL DELETE and TRUNCATE statements are given below:
No.
|
DELETE
|
TRUNCATE
|
1)
|
DELETE is a DML command.
|
TRUNCATE is a DDL command.
|
2)
|
We can use WHERE clause in DELETE command.
|
We cannot use WHERE clause with TRUNCATE
|
3)
|
DELETE statement is used to delete a row from a
table
|
TRUNCATE statement is used to remove all the rows from
a table.
|
4)
|
DELETE is slower than TRUNCATE statement.
|
TRUNCATE statement is faster than DELETE
statement.
|
5)
|
You can rollback data after using DELETE
statement.
|
It is not possible to rollback after using
TRUNCATE statement.
|
39) What is ACID property in database?
ACID property is used to ensure
that the data transactions are processed reliably in a database system.
A single logical operation of a
data is called transaction.
ACID is an acronym for
Atomicity, Consistency, Isolation, Durability.
Atomicity: it
requires that each transaction is all or nothing. It means if one part of the
transaction fails, the entire transaction fails and the database state is left
unchanged.
Consistency: the
consistency property ensure that the data must meet all validation rules. In
simple words you can say that your transaction never leaves your database
without completing its state.
Isolation: this
property ensure that the concurrent property of execution should not be met.
The main goal of providing isolation is concurrency control.
Durability: durability
simply means that once a transaction has been committed, it will remain so,
come what may even power loss, crashes or errors.
40) What is the difference among NULL value, zero and blank
space?
Ans: A NULL value is not
same as zero or a blank space. A NULL value is a value which is 'unavailable,
unassigned, unknown or not applicable'. On the other hand, zero is a number and
blank space is treated as a character.
41) What is the usage of SQL functions?
SQL functions are used for
following purpose:
- To perform calculations on data.
- To modify individual data items.
- To manipulate the output.
- To format dates and numbers.
- To convert data types.
42) Which are the different case manipulation functions in
SQL?
There are three case
manipulation functions in SQL:
- LOWER
- UPPER
- INITCAP
43) What is the usage of NVL function?
The NVL function is used to
convert NULL value to a actual value.
44) Which function is used to return remainder in a
division operator in SQL?
The MOD function returns the
remainder in a division operation.
45) What is the syntax and use of the COALESCE function?
The syntax of COALESCE
function:
1.
COALESCE(exp1, exp2, ... expn)
The COALESCE function is used
to return the first non-null expression given in the parameter list.
46) What is the usage of DISTINCT keyword?
The DISTINCT keyword is used to
ensure that the fetched value is only a non-duplicate value.
PL/SQL Interview Questions
PL/SQL is an advance version of
SQL. There are given top list of PL/SQL interview questions with answer.
1) What is PL/SQL?
PL/SQL stands for procedural
language extension to SQL. It supports procedural features of programming
language and SQL both. It was developed by Oracle Corporation in early of 90's
to enhance the capabilities of SQL.
2) What is the purpose of using PL/SQL?
PL/SQL is an extension of SQL.
While SQL is non-procedural, PL/SQL is a procedural language designed by
Oracle. It is invented to overcome the limitations of SQL.
3) What are the most important characteristics of PL/SQL?
A list of some notable
characteristics:
- PL/SQL is a block-structured language.
- It is portable to all environments
that support Oracle.
- PL/SQL is integrated with the Oracle
data dictionary.
- Stored procedures help better sharing
of application.
4) What is PL/SQL table? Why it is used?
Objects of type tables are
called PL/SQL tables that are modeled as database table. We can also say that
PL/SQL tables are a way to providing arrays. Arrays are like temporary tables
in memory that are processed very quickly. PL/SQL tables are used to move bulk
data. They simplifies moving collections of data.
5) What are the datatypes available in PL/SQL?
There are two types of
datatypes in PL/SQL:
1. Scalar datatypes Example
are NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN etc.
2. Composite
datatypes Example are RECORD, TABLE etc.
6) What is the basic structure of PL/SQL?
PL/SQL uses BLOCK structure as
its basic structure. Each PL/SQL program consists of SQL and PL/SQL statement
which form a PL/SQL block.
PL/SQL block contains 3
sections.
1. The
Declaration Section (optional)
2. The
Execution Section (mandatory)
3. The
Exception handling Section (optional)
7) What is the difference between FUNCTION, PROCEDURE AND
PACKAGE in PL/SQL?
Function: The
main purpose of a PL/SQL function is generally to compute and return a single
value. A function has a return type in its specification and must return a
value specified in that type.
Procedure: A
procedure does not have a return type and should not return any value but it
can have a return statement that simply stops its execution and returns to the
caller. A procedure is used to return multiple values otherwise it is generally
similar to a function.
Package: A
package is schema object which groups logically related PL/SQL types , items
and subprograms. You can also say that it is a group of functions, procedure,
variables and record type statement. It provides modularity, due to this
facility it aids application development. It is used to hide information from
unauthorized users.
8) What is exception? What are the types of exceptions?
Exception is an error handling
part of PL/SQL. There are two type of exceptions: pre_defined exception and
user_defined exception.
9) How to write a single statement that concatenates the
words ?Hello? and ?World? and assign it in a variable named Greeting?
Greeting := 'Hello' || 'World';
10) Does PL/SQL support CREATE command?
No. PL/SQL doesn't support the
data definition commands like CREATE.
11) Write a unique difference between a function and a
stored procedure.
A function returns a value
while a stored procedure doesn?t return a value.
12) How exception is different from error?
Whenever an Error occurs
Exception arises. Error is a bug whereas exception is a warning or error condition.
13) What is the main reason behind using an index?
Faster access of data blocks in
the table.
14) What are PL/SQL exceptions? Tell me any three.
1. Too_many_rows
2. No_Data_Found
3. Value_error
4. Zero_error
etc.
15) How do you declare a user-defined exception?
You can declare the User
defined exceptions under the DECLARE section, with the keyword EXCEPTION.
Syntax:
1.
<exception_name> EXCEPTION;
16) What are some predefined exceptions in PL/SQL?
A list of predefined exceptions
in PL/SQL:
- DUP_VAL_ON_INDEX
- ZERO_DIVIDE
- NO_DATA_FOUND
- TOO_MANY_ROWS
- CURSOR_ALREADY_OPEN
- INVALID_NUMBER
- INVALID_CURSOR
- PROGRAM_ERROR
- TIMEOUT _ON_RESOURCE
- STORAGE_ERROR
- LOGON_DENIED
- VALUE_ERROR
- etc.
17) What is a trigger in PL/SQL?
A trigger is a PL/SQL program
which is stored in the database. It is executed immediately before or after the
execution of INSERT, UPDATE, and DELETE commands.
18) What is the maximum number of triggers, you can apply
on a single table?
12 triggers.
19) How many types of triggers exist in PL/SQL?
There are 12 types of triggers
in PL/SQL that contains the combination of BEFORE, AFTER, ROW, TABLE, INSERT,
UPDATE, DELETE and ALL keywords.
- BEFORE ALL ROW INSERT
- AFTER ALL ROW INSERT
- BEFORE INSERT
- AFTER INSERT etc.
20) What is the difference between execution of triggers
and stored procedures?
A trigger is automatically
executed without any action required by the user, while, a stored procedure is
explicitly invoked by the user.
21) What happens when a trigger is associated to a view?
When a trigger is associated to
a view, the base table triggers are normally enabled.
22) What is the usage of WHEN clause in trigger?
A WHEN clause specifies the
condition that must be true for the trigger to be triggered.
23) How to disable a trigger name update_salary?
ALTER TRIGGER update_salary
DISABLE;
24) Which command is used to delete a trigger?
DROP TRIGGER command.
25) what are the two virtual tables available at the time
of database trigger execution?
Table columns are referred as
THEN.column_name and NOW.column_name.
For INSERT related triggers,
NOW.column_name values are available only.
For DELETE related triggers,
THEN.column_name values are available only.
For UPDATE related triggers,
both Table columns are available.
26) What is stored Procedure?
A stored procedure is a
sequence of statement or a named PL/SQL block which performs one or more
specific functions. It is similar to a procedure in other programming
languages. It is stored in the database and can be repeatedly executed. It is
stored as schema object. It can be nested, invoked and parameterized.
27) What are the different schemas objects that can be
created using PL/SQL?
- Stored procedures and functions
- Packages
- Triggers
- Cursors
28) What do you know by PL/SQL Cursors?
Oracle uses workspaces to
execute the SQL commands. When Oracle processes a SQL command, it opens an area
in the memory called Private SQL Area. This area is identified by the cursor.
It allows programmers to name this area and access it?s information.
29) What is the difference between the implicit and
explicit cursors?
Implicit cursor is implicitly
declared by Oracle. This is a cursor to all the DDL and DML commands that
return only one row.
Explicit cursor is created for
queries returning multiple rows.
30) What will you get by the cursor attribute SQL%ROWCOUNT?
The cursor attribute
SQL%ROWCOUNT will return the number of rows that are processed by a SQL
statement.
31) What will you get by the cursor attribute SQL%FOUND?
It returns the Boolean value
TRUE if at least one row was processed.
32) What will you get by the cursor attribute SQL%NOTFOUND?
It returns the Boolean value
TRUE if no rows were processed.
33) What do you understand by PL/SQL packages?
A PL/SQL package can be
specified as a file that groups functions, cursors, stored procedures, and
variables in one place.
34) What are the two different parts of the PL/SQL
packages?
PL/SQL packages have the
following two parts:
Specification part: It
specifies the part where the interface to the application is defined.
Body part: This
part specifies where the implementation of the specification is defined.
35) Which command is used to delete a package?
The DROP PACKAGE command is
used to delete a package.
36) How to execute a stored procedure?
There are two way to execute a
stored procedure.
From the SQL prompt, write
EXECUTE or EXEC followed by procedure_name.
1.
EXECUTE or [EXEC] procedure_name;
Simply use the procedure name
1.
procedure_name;
37) What are the advantages of stored procedure?
Modularity, extensibility,
reusability, Maintainability and one time compilation.
38) What are the cursor attributes used in PL/SQL?
%ISOPEN: it
checks whether the cursor is open or not.
%ROWCOUNT:
returns the number of rows affected by DML operations: INSERT,DELETE,UPDATE,SELECT.
%FOUND: it
checks whether cursor has fetched any row. If yes - TRUE.
%NOTFOUND: it
checks whether cursor has fetched any row. If no - TRUE.
39) What is the difference between syntax error and runtime
error?
A syntax error can be easily
detected by a PL/SQL compiler. For example: incorrect spelling etc. while, a
runtime error is handled with the help of exception-handling section in a
PL/SQL block. For example: SELECT INTO statement, which does not return any
rows.
40) Explain the Commit statement.
Following conditions are true
for the Commit statement:
- Other users can see the data changes
made by the transaction.
- The locks acquired by the transaction
are released.
- The work done by the transaction
becomes permanent.
41) Explain the Rollback statement?
The Rollback statement is
issued when the transaction ends. Following conditions are true for a Rollback
statement:
- The work done in a transition is
undone as if it was never issued.
- All locks acquired by transaction are
released.
42) Explain the SAVEPOINT statement.
With SAVEPOINT, only part of
transaction can be undone.
43) What is mutating table error?
Mutating table error is
occurred when a trigger tries to update a row that it is currently using. It is
fixed by using views or temporary tables.
44) What is consistency?
Consistency simply means that
each user sees the consistent view of the data.
Consider an example: there are
two users A and B. A transfers money to B's account. Here the changes are
updated in A's account (debit) but until it will be updated to B's account
(credit), till then other users can't see the debit of A's account. After the
debit of A and credit of B, one can see the updates. That?s consistency.
45) What is cursor and why it is required?
A cursor is a temporary
work area created in a system memory when an SQL statement is
executed.
A cursor contains information
on a select statement and the row of data accessed by it. This temporary work
area stores the data retrieved from the database and manipulate this data. A cursor
can hold more than one row, but can process only one row at a time. Cursor are
required to process rows individually for queries.
46) How many types of cursors are available in PL/SQL?
There are two types of cursors
in PL/SQL.
1. Implicit
cursor, and
2. explicit
cursor
Data Structure Interview Questions
A list of top frequently
asked Data
Structure interview questions and answers are given below.
1) What is Data Structure? Explain.
Data structure is a way that
specifies how to organize and manipulate the data. It also specifies the
relationship between them. It provides some algorithms to make data access more
efficient and easy.
2) In which areas data structures are applied extensively?
Data structures are applied
extensively in the following areas of computer science:
- Compiler Design,
- Operating System,
- Database Management System,
- Statistical analysis package,
- Numerical Analysis,
- Graphics,
- Artificial Intelligence,
- Simulation
3) What is the difference between file structure and
storage structure?
Difference between file
structure and storage structure:
The main difference between
file structure and storage structure is based on memory area that is being
accessed.
Storage structure: When
we deal with the structure that resides in the main memory of the computer
system, known as the storage structure.
File structure: When
we deal with an auxiliary structure then it is referred as file structures.
4) Which data structures are used with the following areas:
RDBMS, Network data model and hierarchical data model?
- RDBMS uses Array data structure
- Network data model uses Graph
- Hierarchal data model uses Trees
5) What are Binary trees?
A Binary Tree is a type of data
structure that has two nodes: A left node and a right node. In programming,
binary trees are actually an extension of the linked list structures.
6) What is a Stack?
A stack is a data structure in
which only the top element can be accessed. As data is stored in the stack,
each data is pushed downward, leaving the most recently added data on top.
7) What is a multidimensional array?
A multidimensional array stores
data in multiple indexes. It is used when the storing data that cannot be
represented using a single dimensional indexing, such as data representation in
a board game, tables with data stored in more than one column.
8) What is a linked list in data structure?
A linked list is a sequence of
nodes in which each node is connected to the node following it. It makes a
chain like link of data storage.
9) If you are using C language to implement the
heterogeneous linked list, what pointer type should be used?
The heterogeneous linked list
contains different data types, so it is not possible to use ordinary pointers
for this. For this work, you have to use a generic pointer type like void pointer
because void pointer is capable of storing pointer to any type.
10) How many minimum numbers of queues are needed to
implement the priority queue?
Two queues are needed. One
queue is used for actual storing of data and another for storing priorities.
11) Which data structure is used to perform recursion?
Stack is used to perform
recursion because of its LIFO (Last In First Out) property. It knows whom to
return when the function has to return.
12) When should you use binary search engine?
A binary search algorithm is
used to search a list when the elements are already in order or sorted. The
list starts searching in the middle, if the middle value is not the target
search key, it will check to see if it will continue the search on the lower
half of the list or the higher half. The split and search will then continue in
the same manner.
Example:
13) How to reference all the elements in a one-dimension
array?
It can be done by using an
indexed loop such that the counter runs from 0 to the array size minus one. By
this manner, you can reference all the elements in sequence by using the loop
counter as the array subscript.
14) Which notations are used in Evaluation of Arithmetic
Expressions using prefix and postfix forms?
Polish and Reverse Polish
notations.
15) Give some example of the application of Tree-data
structure?
Application of Tree- data
structure:
- The manipulation of Arithmetic
expression,
- Symbol Table construction,
- Syntax analysis
16) Give the example of some applications that make use of
Multilinked Structures?
- Sparse matrix,
- Index generation.
17) Are linked lists considered linear or non-linear data
structures?
A linked list is considered
both linear and non-linear data structure depending on the situation.
- On the basis of data storage, it is
considered as non-linear data structure.
- On the basis of access strategy, it is
considered as linear data-structure.
18) What is the difference between NULL and VOID?
- Null is actually a value, whereas Void
is a data type identifier.
- A null variable simply indicates an
empty value, whereas void is used to identify pointers as having no
initial size.
19) What is the difference between PUSH and POP?
PUSH and POP operations specify
how data is stored and retrieved in a stack.
PUSH: PUSH
specifies that data is being "pushed" into the stack.
POP: POP
specifies data retrieval, and in particular refers to the topmost data being
accessed.
20) What is a postfix expression?
An expression which each
operator follows its operand is known as postfix expression. The main benefit
of this form is that there is no need to group sub-expressions in parentheses
or to consider operator precedence.
Linux Interview Questions
A list of top frequently
asked Linux
interview questions and answers are given below.
1) What is Linux?
Linux is a UNIX based operating
system. It was first introduced by Linus
Torvalds. It is an open source operating system that was designed
to provide free and a low cost operating system for the computer users.
2) What is the difference between UNIX and Linux?
UNIX was originally started as
a propriety operating system for Bell laboratories, which later release their
commercial version while Linux is a free, open source and a non propriety
operating system for the mass uses.
3) What is Linux Kernel?
Linux Kernel is low level
system software. It is used to manage the hardware resources for the users. It
provides an interface for user-level interaction.
4) Is it legal to edit Linux Kernel?
Yes. You can edit Linux Kernel
because it is released under General Public License (GPL) and any one can edit
it. It comes under the category of free and open source software.
5) What is LILO?
LILO is a boot loader for
Linux. It is used to load the Linux operating system into the main memory to
begin its operations.
6) What is the advantage of open source?
Open source facilitates you to
distribute your software, including source codes freely to anyone who is
interested. So, you can add features and even debug and correct errors of the
source code.
7) What are the basic components of Linux?
Just like other operating
systems, Linux has all components like kernel, shells, GUIs, system utilities
and application programs.
8) What is the advantage of Linux?
Every aspect comes with
additional features and it provides a free downloading facility for all codes.
9) What is Swap Space?
Swap space is used to specify a
space which is used by Linux to hold some concurrent running program
temporarily. It is used when RAM does not have enough space to hold all programs
that are executing.
10) What is BASH?
BASH is a short form of Bourne
Again SHell. It was a replacement to the original Bourne shell, written bu
Steve Bourne.
11) What is the basic difference between BASH and DOS?
- BASH commands are case sensitive while
DOS commands are not case sensitive.
- DOS follows a convention in naming
files. In DOS, 8 character file name is followed by a dot and 3 characters
for the extension. BASH doesn't follow such convention.
12) What is a root account?
The root account is like a
system administrator account. It provides you full control of the system. You
can create and maintain user accounts, assign different permission for each
account etc.
13) What is CLI?
CLI stands for Command Line
Interface. It is an interface that allows users to type declarative commands to
instruct the computer to perform operations.
14) What is GUI?
GUI stands for Graphical User
Interface. It uses the images and the icons which are clicked by the users to
communicate with the system. It is more attractive and user-friendly because
the use of the images and icons.
15) Which popular office suite is available free for both
Microsoft and Linux?
Open Office Suite is available
free for both Microsoft and Linux. You can install it on both of them.
16) Suppose your company is recently switched from
Microsoft to Linux and you have some MS Word document to save and work in
Linux, what will you do?
Install Open Office Suite on
Linux. It facilitates you to work with Microsoft documents.
17) What is SMTP?
SMTP stands for Simple Mail
Transfer Protocol. It is an internet standard for mail transmission.
18) What is Samba? Why is it used?
Samba service is used to
connect Linux machines to Microsoft network resources by providing Microsoft
SMB support.
19) What are the basic commands for user management?
- last,
- chage,
- chsh,
- lsof,
- chown,
- chmod,
- useradd,
- userdel,
- newusers etc.
20) What is the maximum length for a file name in Linux?
255 characters.
21) Is Linux Operating system virus free?
No, There is no operating
system till date that is virus free but Linux is known to have less number of
viruses.
22) Which partition stores the system configuration files
in Linux system?
/stc partition.
23) Which command is used to uncompress gzip files?
gunzip command is used to
uncompress gzip files.
24) Why do developers use MD5 options on passwords?
MD5 is an encryption method so
it is used to encrypt the passwords before saving.
25) What is a virtual desktop?
The virtual desktop is used as
an alternative to minimizing and maximizing different windows on the current
desktop. Virtual desktop facilitates you to open one or more programs on a
clean slate rather than minimizing or restoring all the needed programs.
26) What is the difference between soft and hard mounting
points?
In the soft mount, if the
client fails to connect the server, it gives an error report and closes the
connection whereas in hard mount, if the client fails to access the server, the
connection hangs; and once the system is up, it again accesses the server.
27) Does the Alt+Ctrl+Del key combination work in Linux?
Yes, it works like windows.
28) What are the file permissions in Linux?
There are 3 types of
permissions in Linux OS that are given below:
Read: User can re
Comments
Post a Comment