CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE

advertisement
CUSTOMER_CODE
SMUDE
DIVISION_CODE
SMUDE
EVENT_CODE
OCTOBER15
ASSESSMENT_CODE MCA2020_OCTOBER15
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
73333
QUESTION_TEXT
Explain the array implementation of stack.
SCHEME OF
EVALUATION
Push operation:
5 Marks
PUSH (STACK, TOP, MAXSTK, ITEM)
1. [STACK ALREADY FULL?]
If TOP=MAXSTK, THEN PRINT ‘OVERFLOW’ AND
RETURN;
2. SET TOP=TOP+1
3. SET STACK[TOP]=ITEM
4. RETURN
Pop operation:
5 Marks
POP (STACK, TOP, ITEM)
1. [STACK IS EMPTY?]
IF TOP=-1, THEN PRINT ‘STACK EMPTY’ AND
RETURN
2. SET ITEM = STACK[TOP]
3. SET TOP=TOP-1
4. RETURN
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120229
QUESTION_TEXT
Write an algorithm to insert an element into a queue using arrays
and explain.
SCHEME OF
EVALUATION
QINSERT(QUEUE,N,FRONT,REAR,ITEM)
1. If FRONT=1 and REAR=N or FRONT=REAR+1 then
Write OVERFLOW and return
2. [Find new value of REAR]
If FRONT:=NULL then
Set FRONT:=1 and REAR:=1
Else if REAR=N then
Else if REAR=N then
Set REAR:=1
Else
Set REAR:=REAR+1
3.
4.
Set QUEUE[REAR]:=ITEM
Return
(5 marks)
Explanation (5 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)
QUESTION_TYPE DESCRIPTIVE_QUESTION
QUESTION_ID
120233
QUESTION_TEXT Define linked list. Explain the types of linked lists.
Linked list is a linear collection of data elements called nodes. Each node is
divided into two parts: The first part is called data field where the data are
stored and the second part is called the link field or next field, contains the
address of the next node in the list. (2 Marks)
1.
Doubly linked list
In some situation we need to traverse both forward and backward of a linked
list (1 Mark)
He linked list with this property needs two link field one point to the next node
is called next link field and the another to point the previous node is called
previous link field (1 Mark)
Here first nodes previous link field and last nodes
Next link field are marked as null (1 Mark)
SCHEME OF
EVALUATION
The following fig. shows the structure of Doubly linked list (1 Marks)
2.
Circularly linked list
Circularly linked list is the one where the null pointer in the last node is
replaced with the address of the first node so that it forms a circle. (1 Marks)
The advantage to this circular linked list is easy accessibility of node is
accessible from a given node (1 Marks)
The following fig. shows a singly circular list where the link at the last node is
points to the first node (1 Marks)
The following fig. shows a Doubly circular list where the last nodes Next link
points to the first node and first node previous link point to the last node and
makes a circle (1 Marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120236
Explain the control structure in detail
QUESTION_TEXT
SCHEME OF
EVALUATION
Selection logic consists of number of condition which leads to selection of
one out of several alternative modules.
The structure used to implement this is called conditional (1 mark)
Structure or if Structure
Types
1.
Single alternative (Explain 3)
2
Double alternative (Explain 3)
3.
Multiple alternative (Explain 3)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
120237
Define binary tree. Explain the different types of binary tree.
QUESTION_TEXT
Define (1 mark)
Types
SCHEME OF EVALUATION
1.
Skewed binary tree (Explain 3)
2.
Full binary tree (Explain 3)
3.
Complete binary tree (Explain 3)
Download