DBMS Interview Questions-DBMS Interview Questions: Dr. Anil Kumar Dubey (9783934206)
DBMS Interview Questions-DBMS Interview Questions: Dr. Anil Kumar Dubey (9783934206)
1. What is database?
A database is a collection of information that is organized. So that it can easily be accessed,
managed, and updated.
2. What is DBMS?
DBMS stands for Database Management System. It is a collection of programs that enables user
to create and maintain a database.
5. What is normalization?
It is a process of analyzing the given relation schemas based on their Functional Dependencies
(FDs) and primary key to achieve the properties
(1).Minimizing redundancy, (2). Minimizing insertion, deletion and update anomalies.
9. What is an Entity?
An entity is a thing or object of importance about which data must be captured.
41. Describe the difference between homogeneous and heterogeneous distributed database?
A homogenous database is one that uses the same DBMS at each node. A heterogeneous
database is one that may have a different DBMS at each node.
61. What are the primitive operations common to all record management System?
Addition, deletion and modification.
62. Explain the differences between structured data and unstructured data.
Structured data are facts concerning objects and events. The most important structured data are
numeric, character, and dates.
Structured data are stored in tabular form. Unstructured data are multimedia data such as
documents, photographs, maps, images, sound, and video clips. Unstructured data are most
commonly found on Web servers and Web-enabled databases.
65. Explain the difference between an exclusive lock and a shared lock?
An exclusive lock prohibits other users from reading the locked resource; a shared lock allows
other users to read the locked resource, but they cannot update it.
66. Explain the "paradigm mismatch" between SQL and application programming
languages.
SQL statements return a set of rows, while an application program works on one row at a time.
To resolve this mismatch the results of SQL statements are processed as pseudo files, using a
cursor or pointer to specify which row is being processed.
70. What is Enterprise Resource Planning (ERP), and what kind of a database is used in an
ERP application?
Enterprise Resource Planning (ERP) is an information system used in manufacturing companies
and includes sales, inventory, production planning, purchasing and other business functions. An
ERP system typically uses a multiuser database.
76. Explain what needs to happen to convert a relation to third normal form.
First you must verify that a relation is in both first normal form and second normal form. If the
relation is not, you must convert into second normal form. After a relation is in second normal
form, you must remove all transitive dependencies.
79. What is deadlock? How can it be avoided? How can it be resolved once it occurs?
Deadlock occurs when two transactions are each waiting on a resource that the other transaction
holds. Deadlock can be prevented by requiring transactions to acquire all locks at the same time;
once it occurs, the only way to cure it is to abort one of the transactions and back out of partially
completed work.
Redundant array of inexpensive (or independent) disks. The main goal of raid technology is to
even out the widely different rates of performance improvement of disks against those in
memory and microprocessor. Raid technology employs the technique of data striping to achieve
higher transfer rates.
OS Interview Questions
1. What is an operating system?
An operating system is a program that acts as an intermediary between the user and the computer
hardware. The purpose of an OS is to provide a convenient environment in which user can
execute programs in a convenient and efficient manner.
4. What is kernel?
Kernel is the core and essential part of computer operating system that provides basic services
for all parts of OS.
7. What is a process?
A program in execution is called a process.
Processes are of two types:
1. Operating system processes
2. User processes
1. What is JVM?
The Java interpreter along with the runtime environment required to run the Java application in
called as Java virtual machine (JVM)
17. What is a layout manager and what are different types of layout managers available in
java AWT?
A layout manager is an object that is used to organize components in a container. The different
layouts are available are FlowLayout, BorderLayout, CardLayout, GridLayout and
GridBagLayout
37. What is the difference between preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead
states or a higher priority task comes into existence. Under time slicing, a task executes for a
predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines
which task should execute next, based on priority and other factors.
50. What is the difference between the prefix and postfix forms of the ++ operator?
The prefix form performs the increment operation and returns the value of the increment
operation. The postfix form returns the current value all of the expression and then performs the
increment operation on that value.
52. What will happen to the Exception object after exception handling?
Exception object will be garbage collected.
64. How many objects are created in the following piece of code?
MyClass c1, c2, c3;
c1 = new MyClass ();
c3 = new MyClass ();
Answer: Only 2 objects are created, c1 and c3. The reference c2 is only declared and not
initialized.
Networking Advanced
1. How many numbers of addresses are usable for addressing in a Class C network?
a. 256
Dr. Anil Kumar Dubey [9783934206] Page 21
b. 255
c. 254
d. 258
Answer: c. 254
The number of addresses usable for addressing specific hosts in each network is always 2 power
N - 2 (where N is the number of rest field bits, and the subtraction of 2 adjusts for the use of the
all-bits-zero host portion for network address and the all-bits-one host portion as a broadcast
address. Thus, for a Class C address with 8 bits available in the host field, the number of hosts is
254
The data unit created at the application layer is called a message, at the transport layer the data
unit created is called either a segment or an user datagram, at the network layer the data unit
created is called the datagram, at the data link layer the datagram is encapsulated in to a frame
and finally transmitted as signals along the transmission media
Routers are machines that direct a packet through the maze of networks that stand between its
source and destination. Normally a router is used for internal networks while a gateway acts a
door for the packet to reach the outside of the internal network
30. What are the different Ways of doing Black Box testing?
There are five methodologies most frequently used:
A)Top down according to budget
B)WBS (Work Breakdown Structure)
C)Guess and gut feeling
D)Early project data
E)TPA (Test Point Analysis)
34. What is the difference between interoperability and compatibility testing with some
examples?
Interoperatability:-To check if the software can co exist with other supporting softwares in the
system
Compatibility:-To check if the software runs on different types of operating systems according to
customer requirements.
35. Which testing method is used to check the software in abnormal condition?
1) Stress testing
2) Security testing
3) Recovery testing
4) Beta testing
2. Two linked lists L1 and L2 intersects at a particular node N1 and from there all other
nodes till the end are common. The length of the lists are not same. What are the
possibilities to find N1?.
a. Solution exist for certain cases only
b. No linear solution exist
c. Linear solution is possible
d. Only Non-linear solution exist.
Have two pointers say P1 pointing to the first node of L1 and P2 to that of L2. Traverse through
both the lists. If P1 reaches L1s last node, point it to the first node of L2 and continue traversing.
Do the same thing for P2 when it reaches L2s last node. (By doing this, we are balancing the
difference in the length between the linked lists. The shorter one will get over soon and by
redirecting to longer lists head, it will traverse the extra nodes also.) Finally they will Meet at
the Intersection node.
4. Given a Binary Search Tree (BST), print its values in ascending order.
a. Perform Depth first traversal
b. Perform Breadth first traversal
c. Perform Postorder traversal
d. Perform Inorder traversal
Solution: d. Perform Inorder traversal
It is the properfy of BST and Inorder traversal.
5. Is it possible to implement a queue using Linked List ?. Enqueue & Dequeue should be
O(1).
a. Not possible to implement.
b. Only Enqueue is possible at O(1).
c. Only Dequeue is possible at O(1).
d. Both Enqueue and Dequeue is possible at O(1)
Solution: d. Both Enqueue and Dequeue is possible at O(1)
Have two pointers H pointing to the Head and T pointing to the Tail of the linked list. Perform
enqueue at T and perform dequeue at H. Update the pointers after each operations accordingly.
6. Given a Tree, is it possible to find the greatest and least among leaves in linear time?.
a. Solution depends on the tree structure
b.Linear solution exist
c. Only Non-linear solution exist.
d. No linear solution exist
Have two variables Min and Max. Perform any tree traversal.Assign the first traversed leaf
element to Min and Max for all other leaf elements check with these variables and update it
accordingly. If a current element is < Min then update Min with that element. If it is > Min then
check with Max.
Note: If you want to find the greatest and least among all nodes perform the checks for each node
traversed.
As per BST property, the left most node should be the least one and the rightmost node should be
the greatest. In other words, the first and last node of an Inorder traversal are the least and
greatest among the nodes respectively.
Start 1st stack from left (1st position of an array) and 2nd from right (last position say n). Move
1st stack towards right( i.e 1,2,3 ...n) and 2nd towards left (i.e n,n-1,n-2...1).
9. Given two keys K1 & K2, write an algorithm to print all the elements between them with
K1<=K2 in a BST.
a. Solution need 2 extra spaces
b. Linear solution is possible without using any extra space
c No linear solution exist
d Solution need 1 extra space
Solution:b. Linear solution is possible without using any extra space
Perform an inorder traversal. Once you find K1 print it and continue traversal now, print all other
traversed elements until you reach K2.
Note: If K1 == K2 stop once you find K1.
Solution:b Two
2. Two linked lists L1 and L2 intersects at a particular node N1 and from there all other
nodes till the end are common. The length of the lists are not same. What are the
possibilities to find N1?.
a. Solution exist for certain cases only
b. No linear solution exist
c. Linear solution is possible
d Only Non-linear solution exist.
Solution: a. Inorder
Inorder:
void PrintTree (Tree T)
{
if (T != NULL)
{
PrintTree (T-> Left);
PrintElement (T-> Element);
4. Given a Binary Search Tree (BST), print its values in ascending order.
a. Perform Depth first traversal
b. Perform Breadth first traversal
c. Perform Postorder traversal
d. Perform Inorder traversal
5. Is it possible to implement a queue using Linked List ?. Enqueue & Dequeue should be
O(1).
a. Not possible to implement.
b Only Enqueue is possible at O(1).
c. Only Dequeue is possible at O(1).
d. Both Enqueue and Dequeue is possible at O(1)
6. Given a Tree, is it possible to find the greatest and least among leaves in linear time?.
a. Solution depends on the tree structure
b.Linear solution exist
c. Only Non-linear solution exist.
d. No linear solution exist
7. Is it possible to find find the greatest and least value among the nodes in a given BST
without using any extra variables?
Dr. Anil Kumar Dubey [9783934206] Page 31
a. No solution exist.
b. Solution need 2 extra variables
c. Solution exist without any extra variables
d Solution need 1 extra variable
9. Given two keys K1 & K2, write an algorithm to print all the elements between them with
K1<=K2 in a BST.
a. Solution need 2 extra spaces
b. Linear solution is possible without using any extra space
c No linear solution exist
d Solution need 1 extra space
Solution:b Two
Have two stacks S1 and S2.
For Enqueue, perform push on S1.
For Dequeue, if S2 is empty pop all the elements from S1 and push it to S2. The last
element you popped from S1 is an element to be dequeued. If S2 is not empty, then pop
the top element in it.
5. Define and describe an iterative process with general steps of flow chart?
There are four parts in the iterative process they are
Initialization: -The decision parameter is used to determine when to exit from the loop.
Decision: -The decision parameter is used to determine whether to remain in the loop or not.
Computation: - The required computation is performed in this part.
Update: - The decision parameter is updated and a transfer to the next iteration results.
7. Define and state the importance of sub algorithm in computation and its relation ship
with main algorithm?
A sub algorithm is an independent component of an algorithm and for this reason is defined
separately from the main algorithm. The purpose of a sub algorithm is to perform some
computation when required, under control of the main algorithm. This computation may be
performed on zero or more parameters passed by the calling routine.
8. Name any three skills which are very important in order to work with generating
functions.
The three most important skills which are used extensively while working with generating
functions are
1) Manipulate summation expressions and their indices.
2) Solve algebraic equations and manipulate algebraic expressions, including partial function
decompositions.
Dr. Anil Kumar Dubey [9783934206] Page 33
3) Identify sequences with their generating functions
18. What is a greedy algorithm? Give examples of problems solved using greedy
algorithms.
A greedy algorithm is any algorithm that makes the local optimal choice at each stage with the
hope of finding the global optimum. A classical problem which can be solved using a greedy
Dr. Anil Kumar Dubey [9783934206] Page 34
strategy is the traveling salesman problem. Another problems that can be solved using greedy
algorithms are the graph coloring problem and all the NP-complete problems.
20. What is the difference between a backtracking algorithm and a brute-force one?
Due to the fact that a backtracking algorithm takes all the possible outcomes for a decision, it is
similar from this point of view with the brute force algorithm. The difference consists in the fact
that sometimes a backtracking algorithm can detect that an exhaustive search is unnecessary and,
therefore, it can perform much better.
2) Some coders debug their programs by placing comment symbols on some codes instead
of deleting it. How does this aid in debugging?
Answer: Placing comment symbols /* */ around a code, also referred to as commenting out, is
a way of isolating some codes that you think maybe causing errors in the program, without
deleting the code. The idea is that if the code is in fact correct, you simply remove the comment
Dr. Anil Kumar Dubey [9783934206] Page 36
symbols and continue on. It also saves you time and effort on having to retype the codes if you
have deleted it in the first place.
3) What is the equivalent code of the following statement in WHILE LOOP format?
[c]
for (a=1; a<=100; a++)
printf ("%d\n", a * a);
[/c]
Answer:[c]
a=1;
while (a<=100) {
printf ("%d\n", a * a);
a++;
}
[/c]
5) In C programming, how do you insert quote characters ( and ) into the output screen?
Answer: This is a common problem for beginners because quotes are normally part of a printf
statement. To insert the quote character as part of the output, use the format specifiers \ (for
single quote), and \ (for double quote).
8) Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Answer: <> is incorrect. While this operator is correctly interpreted as not equal to in writing
conditional statements, it is not the proper operator to be used in C programming. Instead, the
operator != must be used to indicate not equal to condition.
10) What are header files and what are its uses in C programming?
Answer: Header files are also known as library files. They contain two essential things: the
definitions and prototypes of functions being used in a program. Simply put, commands that you
use in C programming are actually functions that are defined from within each header files. Each
11) Can I use int data type to store the value 32768? Why?
Answer: No. int data type is capable of storing values from -32768 to 32767. To store 32768,
you can use long int instead. You can also use unsigned int, assuming you dont intend to
store negative values.
12) Can two or more operators such as \n and \t be combined in a single line of program
code
Answer: Yes, its perfectly valid to combine operators, especially if the need arises. For
example: you can have a code like printf (Hello\n\n\World\) to output the text Hello on
the first line and World enclosed in single quotes to appear on the next two lines.
13) Why is it that not all header files are declared in every C program?
Answer: The choice of declaring a header file at the top of each C program would depend on
what commands/functions you will be using in that program. Since each header file contains
different function definitions and prototype, you would be using only those header files that
would contain the functions you will need. Declaring all header files in every program would
only increase the overall file size and load of the program, and is not considered a good
programming style.
16) Write a loop statement that will show the following output:
1
12
123
1234
12345
Answer:[c]
for (a=1; a<=5; i++) {
for (b=1; b<=a; b++)
printf("%d",b);
printf("\n");
}
[/c]
19) What could possibly be the problem if a valid function name such as tolower() is being
reported by the C compiler as undefined?
The most probable reason behind this error is that the header file for that function was not
indicated at the top of the program. Header files contain the definition and prototype for
functions and commands used in a C program. In the case of tolower(), the code #include
must be present at the beginning of the program.
20) What does the format %10.2 mean when included in a printf statement?
Answer: This format is used for two things: to set the number of spaces allotted for the output
number and to set the number of decimal places. The number before the decimal point is for the
allotted space, in this case it would allot 10 spaces for the output number. If the number of space
occupied by the output number is less than 10, addition space characters will be inserted before
the actual output number. The number after the decimal point sets the number of decimal places,
in this case, its 2 decimal spaces.
22) How do you determine the length of a string value that was stored in a variable?
Answer: To get the length of a string value, use the function strlen(). For example, if you have a
variable named FullName, you can get the length of the stored string value by using this
statement: I = strlen(FullName); the variable I will now have the character length of the string
value.
24) What are the different file extensions involved when programming in C?
Answer: Source codes in C are saved with .C file extension. Header files or library files have the
.H file extension. Every time a program source code is successfully compiled, it creates an .OBJ
object file, and an executable .EXE file.
28) Not all reserved words are written in lowercase. TRUE or FALSE?
Answer: FALSE. All reserved words must be written in lowercase; otherwise the C compiler
would interpret this as unidentified and invalid.
34) Write a simple code fragment that will check if a number is positive or negative.
Answer:[c]
If (num>=0)
printf("number is positive");
else
printf ("number is negative");
[/c]
37) Dothese two program statements perform the same output? 1) scanf(%c, &letter); 2)
letter=getchar()
Answer: Yes, they both do the exact same thing, which is to accept the next key pressed by the
user and assign it to variable named letter.
38) What is the difference between text files and binary files?
Answer: Text files contain data that can easily be understood by humans. It includes letters,
numbers and other characters. On the other hand, binary files contain 1s and 0s that only
computers can interpret.
41) The % symbol has a special use in a printf statement. How would you place this
character as part of the output on the screen?
Answer: You can do this by using %% in the printf statement. For example, you can write
printf(10%%) to have the output appear as 10% on the screen.