CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE

advertisement
CUSTOMER_CODE
SMUDE
DIVISION_CODE
SMUDE
EVENT_CODE
SMUAPR15
ASSESSMENT_CODE MCA2020_SMUAPR15
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
12135
QUESTION_TEXT
Explain different types of graphs.
1. Undirected graphs (Exp n 1 mark)
2. Directed graphs (Exp n 1 mark)
3. Weighted graphs (Exp n 1 mark)
4. Multigraph (Exp n 1 mark)
5. Sparse graph (Exp n 1 mark)
SCHEME OF EVALUATION
6. Acyclic graph (Exp n 1 mark)
7. Graph with isolated vertices (Exp n 1 mark)
8. NULL graph (Exp n 1 mark)
9. Strongly connected graph (Exp n 1 mark)
10. Uniaterally connected graph (Exp n 1 mark)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
12137
QUESTION_TEXT
What do you mean by direct file? Explain its structure.
SCHEME OF
EVALUATION
A direct file is one whose records are stored in such a way that
access to any one of them is direct, i.e, without going through a lot
of records to get one particular record (1 Mark)
Records in a direct tile are not placed one after the other
A technique known as “ hashing” uses a key to produce the location
on the disk for each of the records and through this individual
records can be accessed directly (2 Marks)
Structure of direct files:
To access record directly a relationship is used to translate the key
value into a physical address. (1 Mark)
This is called the mapping function R.R ( key value) address (1
Mark)
A hash function is a function h (k) that transactions a key into an
address. An address space is chosen beforehand. (1 Mark)
Two different keys may be sent to the same address generating a
collision. These keys are called as synonyms. (1 Mark)
We can reduces the collision by selecting the good hash function (1
Mark)
Direct files are stored on DASD
A calculation it performed on the key value to get an address. This
address calculation technique is often termed as hashing. The
calculation applied is called a hash function. (1 Mark)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
12138
QUESTION_TEXT
What is data structure? Discuss briefly on types of data structures.
SCHEME OF
EVALUATION
The data structure represents the logical relationship of the
particular data sets (1 mark)
2 types
1. linear data structures
2. Non linear data structures (2 marks)
Linear data structure
When the data is stored in the memory in linear or sequential form
is called linear data structure (1 mark)
Examples of linear data structures include. Array, stack, queue,
linked list
Array Expn
Stack Expn
Queue Expn
Linked list Expn (any 3=3 marks)
Non linear data structure:
When the data is stored in the memory in dispersed or non
sequential order is called non linear data structure
(1 mark)
Example:
Tress Expn (1 mark)
Graphs Expn (1 mark)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
73334
QUESTION_TEXT
Give the recursive functions for the binary tree traversals.
A binary tree is a special case of tree where no node of a tree can
have a degree of more than two. Therefore, a binary tree is a set of
zero or more nodes such that:
There is a specially designated node called the root of the tree
SCHEME OF
EVALUATION
The remaining nodes are partitioned into two disjointed sets, T1 and
T2, each of which is a binary tree. T1 is called the left sub tree and
T2 is called right sub tree.
Binary tree traversals:
Inorder traversal:
3 Marks
Void print_inorder(tree_node *p)
{
If (p!=NULL)
{
Print_inorder(pleft);
Cout< < p- >data< < endl;
Print_inorder(pright);
}
}
Postorder traversal:
3.5 Marks
Void print_postorder(tree_node *p)
{
If (p!=NULL)
{
Print_postorder(pleft);
Print_postorder(pright);
Cout< < p- >data< < endl;
}
}
Preorder traversal:
Void print_preorder(tree_node *p)
3.5 Marks
{
If (p!=NULL)
{
Cout< < p- >data< < endl;
Print_preorder(pleft);
Print_preorder(pright);
}
}
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
73336
QUESTION_TEXT
Explain Binary Search algorithm. Apply the binary search algorithm
to search key 11 in the array: 10, 11, 12, 16, 34, 37, 54, 65.
SCHEME OF
EVALUATION
Binary Search Algorithm:
Binary_Search(A, n, key)
Low  1 (or 0 if index starts at 0)
High  n (or n-1 if index starts at 0)
While low ≤ high
Do
Mid  (low+high)/2;
If A[mid] = x
Then return mid
05 Marks
Else if A[mid]< x then
Lowmid+1
Else
High  mid – 1
Return key not found
Apply the binary search algorithm to search key 11 in the above
array.
05 Marks
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120231
QUESTION_TEXT What is static hashing? Explain linear hashing.
SCHEME OF
EVALUATION
Static hashing
Static hashing is a simple form of hashing, where hashing is the technique
use mathematical functions to sort incoming data in a speedy and
organized fashion. Hashing involves a hashing function, which accepts a
piece of incoming data and assigns to that data a specific value; based on
that value the data is stored away in a table. Static hashing is a simple form
of hashing often used for a temporary solution, until a better form of
hashing such as linear hashing or extendible hashing can be used. Its
advantage is its relative simplicity compared to other types of hashing.
Here hashing is called static because the number of buckets is static,
meaning that the number is determined first and remains constant
throughout the assembly and use of hash.
A simple example of hash function is h(x)=xmod N. this means that the
remainder of x divided by N is what is returned. Once this hash value has
been determined, the whole piece of data is then sorted into a bucket with
a number of other data entries with the same hash value. These buckets
usually have a static size as well and they each have overflow buckets in
case the first bucket gets full.
To locate a particular item, the search information provided is passed
through the hash function again, so the search is quickly narrowed down
to roughly 1/N of the total pieces of data that might otherwise be
searched. The defect in static hashing is the fact that the number of
buckets remain static. This means that if all the values tend to produce one
particular hash value, all of the data records will go to one bucket, not
saving much time. Other methods of hashing allow for the creation of new
buckets on the fly, which can be assigned more specific hash values to
break down a clump of data. Static hashing is good for speedy data. (5
marks)
Linear hashing
Linear Hashing is a dynamically updateable disk-based index
structure which implements a hashing scheme and which grows or
shrinks one bucket at a time. The index is used to support exact
match queries, i.e. find the record with a given key. Linear hashing
does not use a bucket directory, and when an overflow occurs it is not
always the overflow bucket that is split. The name linear hashing is
used because the number of buckets grows or shrinks in a linear
fashion. Overflows are handled by creating a chain of pages under the
overflow bucket. The hashing function changes dynamically and at
any given instant there can be at most two hashing functions used by
the scheme. Some of the main points that summarize linear hashing
are; Full buckets are not necessarily split, and buckets split are not
necessarily full. Every bucket will be split sooner or later and so all
Overflows will be reclaimed and rehashed. Split points s decides
which bucket to split and s is independent to overflowing bucket and
at level i , s is between 0 and 2i. s will be incremented at each point if
it reaches end it will be reset to 0. (5 marks)
Download