Download Data structure - E

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Lattice model (finance) wikipedia , lookup

Array data structure wikipedia , lookup

Red–black tree wikipedia , lookup

Quadtree wikipedia , lookup

Interval tree wikipedia , lookup

Binary tree wikipedia , lookup

B-tree wikipedia , lookup

Binary search tree wikipedia , lookup

Linked list wikipedia , lookup

Transcript
1
DATA STRUCTURES
QUESTION BANK
UNIT I
SECTION A
1.
2.
3.
4.
5.
6.
7.
Algorithm is __________ number of steps
a. Ans: finite
Flowchart is __________ representation
a. Ans: Pictorial
A ____________is a term, which refers to the kinds of data that variables
may “hold” in a programming language.
Ans: data type
A __________is a term referring to a set of elements
Ans: data object
Verification _____________consists of distinct aspects
a. Ans: three
8.
If a function or procedure calls by itself is called as ___________
a. Ans: recursion.
9. Any polynomials can be represented in a called terms ___________
a. Ans: global array
10. A matrix which contains more number of zero entries are called
__________matrices
a. Ans: sparse
11. An array is a set of __________memory locations
a. Ans: consecutive
b.
10.Transpose of matrix is nothing but interchanging
________________
c.
Ans: rows and columns
d.
11.Name the matrix that has a large number of zeroes
and few non-zero values
Ans: sparse
12. The study of computer science has ______distinct areas.
Ans: four
13. algorithm performs a particular __________
Ans: function.
14. Definiteness means each instruction must be clear and _______________
Ans: unambiguous
15. _________ represents the facts and figures in raw form.
Ans: Data
16. A ______________ is a set of objects and set of operations
Ans: data structure
17. __________ is needed to determine what went wrong and how to correct
it.
Ans: Debugging
Unit 1
DSA
2
18. Examples for the ordered list is _________
Ans: Days of the week
19. Any polynomials can be
represented in a global array called
___________
Ans: terms
20. What is an algorithm?
21. What is an ordered list?
22. Precisely write down the mathematical relationship that should hold
between the functions f(n) and g(n) where f(n)=O(g(n)).
23. How many elements are present in the array A[0:21,5:25,10:20]
24. What is a datatype.
25. What is a data object.
26. Define data structure.
27. Define an array.
28. Define frequency count.
29. Mention the operations that can be performed in an ordered list.
30. Mention the difference between an algorithm and flowchart.
31. Every algorithm must be _________________ (ie) each instruction must
be clear and unambiguous.
32. If we have the declaration of the array A(4:5,2:4,1:2,3:4) then we have a
total of _______elements
33. Name the matrix that has a large number of zeroes and few non-zero
values.
SECTION B
1. 1.What are the informations required to determine how much time it
takes to
2. execute a command?
3. What are the criteria upon which evaluative judgements may be made?
4. Explain the criteria that an algorithm must satisfy.
5. What is an ordered list? List out the operations that can be performed
on
6. ordered lists.
7. 5. What is a sparse matrix ? Why a special structure is needed to store
them?
8. 6. Explain structure of an array.
9. 7Given two polynomials A and B having m and n terms respectively,
write an
10.algorithm for getting A+B.
11. Explain the different phases in the process of creating programs.
12. With clear examples illustrate that algorithmic speed up is more
powerful than machine speed up.
Unit 1
DSA
3
13. Explain with examples the idea of frequency count to estimate program
complexity.
14.What is a sparse matrix? Write an algorithm to find the transpose of this
matrix.
15. Derive an expression for addressing the elements of an array.
16. Discuss the structure of an array. How elements are inserted and
deleted in an array?
17. hat do you mean by time complexity of an algorithm? Discuss.
18. Explain how multiple stacks are defined and initialized on a 1
dimensional array.
SECTION C
1.What factors can be used to judge a program? Discuss them by giving
examples.
2.Write a procedure for adding two polynomials representing the polynomials as
an ordered list of coefficients.
3. Write and explain the formula for finding the location of the element
A (i,j) in row- major representation of the two dimensional array A.
4. Explain how to analyse programs with examples.
UNIT – II
SECTION- A
Objective type questions.
1. The postfix notation of X=((A/(B*C)) +(D*E))-(A*C) is _____________.
2. Stacks are sometimes referred to as _____.
3. The elements of a structure are called _____.
4. A Queue is a ________ structure.
5. ____ operation retrieves the value at the top of the stack.
6. A function calls itself is phenomenon known as ______.
7. AB*C/ is a _____ notation.
8. Last in first out technique is used in _____.
9. First in first out technique is used in _____.
10. A list in which insertions are done at one end and deletions are done at
other end is a ______.
11. ______ operation is used to add an item onto the stack.
12.______ operation is used to delete an item from the stack.
13. FCFS stands for ______.
14.FCFS strategy is used in ______.
15.A node in a doubly linked list has atleast _______ fields.
16.State the differences between an one dimensional array and a singly linked
list.
17.In a linked list each element contains _______ and _____ parts.
Unit 1
DSA
4
18.In a circular linked list the link of the last node is _____.
19.In a linked list a node is defined as a collection of _______.
20. A node in a doubly linked list has at least _____ fields.
Explain linked list.
21. Generally collection of nodes called _____
(1) stack (2) heap (3) linked list (4) pointers.
2 2. Sparse matrix have ?
(1) many zero entries (2) many non-zero entries (3) higher dimension (4) none
of above
23 Linked lists are suitable for which of the following problems ?
(1) Insertion sort (2) Binary search (3) Radix sort (4) Polynomial manipulation
24 Generally a collection of nodes is called as
(1) stack (2) heap (3) linked list (4) none of the above
25 A linear collection of data element given by the mean of pointer is called
(1) Linked list (2) Stacks (3) Queues (4) None of the above
26 Linked list is generally considered as an example of __________ type of
memory location
(1) dynamic (2) static (3) compile time (4) None of the above
27 Which of the following is not a type of Linked List
(1) Singly linked list (2) Doubly linked list (3) Hybrid linked list (4) Circular
linked list
28 Each node contains minimum 2 fields one fields called data field to store
data.Another field is of type
(1) Pointer to node (2) Pointer to Integer (3) Pointer to class (4) None of these
29 Which of the following points is/are true about Linked List data structure
when it is compared with array
(1) Arrays have better cache locality that can make them better in terms of
performance. (2) It is easy to insert and delete elements in Linked List (3)
Random access is not allowed in a typical implementation of Linked Lists (4) All
of the above
30 You are given pointers to first and last nodes of a singly linked list, which of
the following operations are dependent on the length of the linked list? (1) (2) t
(3) (4)
(1) Delete the first element (2) Insert a new element as a first elemen (3) Delete
the last element of the list (4) Add a new element at the end of the list
31 Given pointer to a node X in a singly linked list. Only one pointer is given,
pointer to head node is not given, can we delete the node X from given linked
list?
(1) Possible if X is not last node. Use following two steps (a) Copy the data of
next of X to X. (b) Delete next of X. (2) Possible if size of linked list is even. (3)
Possible if size of linked list is odd (4) Possible if X is not first node. Use
following two steps (a) Copy the data of next of X to X. (b) Delete next of X.
32 The situation in linked list START=NULL is called ?
(1) Overflow (2) Underflow (3) Both of above (4) None of the above
33 The value of first linked list address is ?
(1) -1 (2) 1 (3) 0 (4) 2
34 The terms PUSH and POP are related to ?
Unit 1
DSA
5
(1) Arrays (2) Stacks (3) Linked List (4) Linked List
35 A linked list whose last node points back to the list node instead of containing
the null pointer________.
(1) circular list (2) circular doubly linked list (3) linke list (4) doubly linked list
36 Which of the following is two way lists?
(1) Grounded header list. (2) Circular header list. (3) linked list with header, left
pointer and right pointer nodes (4) Singly linked list.
37 Which of the following statement is false?
(1) Arrays are dense lists and static data structure (2) data elements in linked list
need not be stored in adjecent space in memory (3) pointers store the next data
element of a list (4) linked lists are collection of the nodes that contain
information part and next pointer
38 What are the time complexities of finding 8th element from beginning and 8th
element from end in a singly linked list? Let n be the number of nodes in linked
list, you may assume that n > 8.
(1) O(1) and O(n) (2) O(1) and O(1) (3) O(n) and O(1) (4) O(n) and O(n)
39 In Linked list implementation,a node carries information
regarding__________
(1) Data & Link (2) Link (3) Data (4) None of the above
40 What does the following function do for a given Linked List with first node as
head? void fun1(struct node* head) { if(head == NULL) return; fun1(head>next); printf("%d ", head->data); }
(1) Prints all nodes of linked lists (2) Prints all nodes of linked list in reverse
order (3) Prints alternate nodes of Linked List (4) Prints alternate nodes in
reverse order
41 A doubly linked list performs traversal in _______
(1) either direction (2) one direction (3) Both a & B (4) None of these
42 Linked list data structure usage offers considerable saving
(1) Space utilization & Computational time (2) Computational time (3) Space
utilization (4) None of the above
43 Which data structure allows deleting data elements from front and inserting at
rear?
(1) Stacks (2) Queues (3) None of the above (4) Both of these
44 Consider linked list is used to implement the stack then which of the
following node is considered as top of the stack?
(1) First node (2) Last node (3) Middle node (4) None of the above
45 Which function is used to insert a new element at the end of the list.
(1) Insert (2) Delete (3) Find (4) Print
SECTION B
1.
2.
3.
4.
5.
6.
Unit 1
Give the structure of stack.
How stack can be used for the evaluation of expression?
Explain the operations on a Queue structure.
Explain a stack.
Give the structure of queue.
Explain the operations that can be performed on a stack.
DSA
6
7. Explain the procedures to add and delete an item from the stack.
8. Explain the procedures to add and delete an item from the queue.
9. Explain the procedures to add and delete an item from the circular queue.
10.Mention the rules for FCFS strategy in time sharing application.
11. Explain how two stacks can be represented in memory.
12.Write the postfix form of the following expressions.
a)
b)
c)
d)
e)
A**B**C
–A+B-C+D
A** -B +C
(A+B)* D + E/(F+A*D)+C
A/(B**C)+(D*E)-A*C
13.Convert the given infix expression to postfix expression.
a) A * B/C
b) A/B**C+D*E-A*C
c) A*(B+C)/D-G
14.Write short note on multiple stack.
15.Define circular queue. Discuss the operations and limitations on a circular
queue.
16.Given an Infix arithmetic expression, convert postfix expression with a
suitable algorithm.
17.Give an algorithm to add and delete elements in a queue.
18.Give an algorithm to push and pop elements in a stack.
19.Write a procedure to evaluate an expression.
20.Give one simplest way of representing stack. Using this representation
write procedures for create, add, delete operations on a stack.
21. Design a data representation sequentially mapping n queues into an array
V(1:m). Represent each queue as a circular queue within V. Write
procedure addq and deleteq and queue-full.
22. Compare array and linked lists.
23.Explain how deletions are performed in a doubly linked list.
24.Give an algorithm to delete a node in a linked list.
25.Write short note on Doubly linked list.
26.Explain how a singly linked list is formed.
27.Write procedure for finding the number of elements in a circular list.
28.Distinguish between singly linked list and doubly linked list.
29.What are singly linked list? Where are they used?
30.Write an algorithm to create a linked stack.
Unit 1
DSA
7
31.What are the merits and demerits of linked lists over arrays?
32.Write a procedure to invert a singly linked list.
SECTION C
1. Write a procedure to convert an infix expression into postfix expression.
Explain your algorithm with an example.
2. Explain time –sharing with an example.
3. Write a procedure to evaluate postfix expression using stack.
UNIT – III
SECTION A
1. A tree has ___ number of nodes
2. Binary tree consist nodes which is either empty or ________.
3. The two disjoint binary trees are ________ & ___________
4. A full binary of K depth has ______ number of nodes.
5. What are the two types of graphs?
6. An n number of undirected graphs with exactly ___ edges in said to be
complete.
7. If <v1, v2> is direct edge then the vertex v1 is adjacent to ______.
8. A simple path is a path in which all vertex except the ______ and _____ are
distinct.
9. Define the degree of vertex?
10. G=(V,E) to represent __________
11. if (v1, v2) are adjacent then the edge (v1,v2) is incident an vertex v1 & ___
12. Define adjacent list.
13. Define adjacent matrix.
14. Define adjacent multilist.
15. What are three types of binary traversal.
16. Define directed graph.
17. Define graph
18. The adjacent list node has two link __________ and ________.
19. What are two types of binary tree?
20. What is a graph?
21. A graph consist of number of __________ & _________.
22. Define spanning tree.
23. Define tree.
24. The pair (v1, v2) and (v2, v1) represent _________ edge.
25. What are the two types of graph?
SECTION B
Unit 1
DSA
8
1. Explain basic terminology of binary tree.
2. How can you represent a binary tree by using linked list.
3. Explain about find out the shortest path using algorithm
4. Write about more on binary tree.
5. Explain Graphics terminology and representation.
SECTION C
1. Explain binary tree traversal.
2. Explain binary tree representation of trees.
3. Briefly explain about the Adjacent matrix and adjacent list.
UNIT – IV
SECTION A
1. Magnetics tape devices for computer input and _________
(1) Output (2) display (3) storage (4) all of these
2. The data is recorded on magnetic tape approximately ____ width
(1) 1/2n (2) 1/2 (3) 1/3 (4) ¼
3. The tape is wound round a ________
(1) Spool (2) magnetic coil (3) coil (4) none of these
4. A new reel of tape is normally __________ ft long
(1) 1200 (2) 2400 (3) 2100 (4) 2000
5. Tape having 7 to __ tracks across its width
(1) 5 (2) 6 (3) 7 (4) 9
6. The number of bits that can be written per inch of track is is refered
to as tape ________
(1) Density (2) availability (3) byte (4) none
7. 7Tape consist of _______ spindle a)2 b) 3 c) 1 d) 4
(1) 2 (2) 3 (3) 1 (4) 4
8. In between blocks of data is an interblock gap normally about
______ inches long
(1) 1/5 (2) 2/4 (3) ¼ (4) ¾
9. The input and output areas in memory will be referred to as ____
(1) Buffer (2) cache (3) hash (4) memory
10. A disk pack consists of several _____
(1) Tracks (2) platters (3) platters (4) platters
11. Platters are similar to __________ records
Memory (2) storage c (3) photograph (4) photograph
12. A disk has _____and write head for each surface
(1) Read (2) input (3) splindle (4) none
13. The disk area that can be read from or written onto by a single
stationary head is referred to as ________
(1) Track (2) platter (3) read/write head (4) none of these
Unit 1
DSA
9
14. In disk all platters are called as ____
(1) Cylinder (2) circle (3) tracks (4) header
15. __________ Is a small addressable segment of a track.
(1) Segment (2) block (3) byte (4) bits
16. _________ time taken to position the read/write head to the correct
cyclinder
(1) Seek (2) latency (3) transmission (4) leak
17. Sorting the external storage device is called ________ sort a) b) c)
d)
(1) Output (2) external sort (3) o/p sort (4) merge
18. A selection tree is a binary tree where each node represents the
smaller of its___ children
(1) Two (2) three (3) single (4) zero
19.19A K-way merge required the use of _______ buffers a) b) c) d)
(1) 2k+2 (2) 2k+1 (3) 2k (4) 1k
20. The symbol table is set of _________ pairs
(1) Name- type (2) name-value (3) name-properties (4) name-null
21. In a binary search tree, all identifiers in the right subtree of T are
_______than the identifiers in the root note of T
a)Greater b) less c) equl d) not equal
22. The hash table is partitioned into ______
(1) Memory (2) buckets (3) areas (4) none
23. Each bucket is consist of _________
(1) Records (2) memory (3) data (4) slots
24 In hash table different parts are added together, this method is
known as ______ folding
(1) Shift (2) control (3) add (4) none
22.25A search in a hash table with n identifiers may take _--------time.
(1) O(n+1) (2) O(n) (3) O(n*n) (4) O(n+3)
23.A disk drive consist of __________n which the disk may be
mounded.
24.The collection of tracks immediately under a read and write head on
the surface of all platter is called __________
25.Tracker are divvied into _______.
26.______time is taken to place the read and write header to the
cylinder.
27.________time until the right sector of the track is under the
read/write header.
28.__________ time to transmit the blck of data to/from the disk.
29.The sorting of external devices is called as _________ sort.
30.The sort segment on the external devices are known as _______.
31.A file consists collecton of ___________.
32.Nodes that have degree zero are called ______ nodes.
33.The method of maintaining a file and index is referred to as ____.
34.In ______ method the identifier X is partitioned into several parts,
all but the last being of the same length. These parts are then added
together to obtain the hash address for X.
35.Binary search is possible only when data is _____.
Unit 1
DSA
10
36.State the difference between sorting and merging.
37.Binary trees are trees in which each node has ____
38.The worst and average-case complexities of merge sort are __.
39.The time taken to sort records using INSERTION sort is ____
40.____ sort is one in which two records are interchanged
immediately upon discovering that they are out of order.
41.Children of same parent are said to be _____.
42.The time taken to sort a file of n records using quick sort is ___.
43.What is a height balanced binary tree?
44.What is the average case complexity of heap sort?
45.In a static tree ______.
46.Explain uniform hashing function.
47.State the difference between sorting and searching.
SECTION B
1. Compare internal and external sorting.
2. Give an algorithm for binary search.
3. What is a file? Discuss.
4. Explain fibonacci series based searching.
5. Discuss hashing methods.
6. What is a hash table?
7. Compare searching and sorting. What is sequential search?
8. What is Balanced merge ? Discuss.
9. Write a short node on symbol tables.
10.Write an algorithm for merge sort.
11.Write short notes on static tree and dynamic tree.
12.Explain the k-way merging using disks.
13.Give a procedure for searching file using Fibonacci method.
14.Explain polyphase merge with examples.
15.Explain 2-way polyphase merge with 3 tapes.
16.Explain 3-way polyphase merge with 4 tapes.
17.Explain sorting with disks with an example.
18.Explain overflow handling with an example.
19.Explain chaining with an example.
20.Explain different hashing functions with an example.
1.
2.
3.
4.
5.
6.
Unit 1
SECTION C
Discuss any two internal sorting techniques.
What is Hashing? Discuss any one Hashing techniques in detail.
Discuss the radix sort method with suitable example.
Discuss insertion sort method and quick sort method and compare these
two methods.
Explain heap sort with an example.
Explain the issues in external sorting.
DSA
11
7. What are the limitations in using a tape for sorting files? Develop an
algorithm for merge sorting in tapes. Analyse the performance of the
algorithm you have developed.
UNIT – V
SECTION A
1. The computing time of insertion sort is ____________
(1) O((k+1)n) (2) O(k+1) (3) (k+1)
2. The worst case of insertion sort is ____________
(1) O(n^2) (2) O(n) (3) O(n^n)
3. The computing time of quick sort is
(1) O(n log n) (2) O(n log2 n) (3) O(n log2 )
4. The divide and conquer method is
(1) insertion sort (2) merge sort (3) heap sort
5. The total computing time of merge sort is
(1) O( log n) (2) O(n log n) (3) O(n log )
6. The total computing time of heap sort is
(1) O(n log n) (2) O( log n) (3) O(n log )
7. The tree like representation of sorting is
(1) heap sort (2) quick sort (3) merge sort
8. _____________ is a collection of records
(1) file (2) record (3) tree
9. the primary objective of file organization is
(1) insert (2) retrieval, update (3) delete
10. A combination of key values is called___________
(1) file (2) query (3) tree
11. DASD
(1) Direct access storage devices (2) Direct access system devices (3)
Direct access storage development
12. in which query the single key is specified
(1) simple (2) range (3) functional
13. In which query the range of value is
(1) simple (2) range (3) functional
14.In which query the key value contains function
(1) simple (2) functional (3) range
15. A Boolean combination is used in _________ query
(1) range (2) boolean (3) simple
16.The mode of retrival
(1) master file (2) real time or batch (3) transaction
17. How many files are updated in batched process
(1) 2 (2) 3 (3) 4
18. The physical sequence of record is accessed using ____ key
(1) primary (2) candidate (3) master
19. Sequential organization file are accessed using________
(1) access (2) sequence (3) random
20. Cylinder contain _____ and ____
Unit 1
DSA
12
(1) index and value (2) surface and index (3) surface and track
21. ___________ is a collection of indexes
(1) directory (2) file (3) index
22. Iindex consist of ___ and ____
(1) Cylinder and surface (2) surface and track (3) track and cylinder
23. SAM
(1) Indexed sequential access method (2) In sequential access method
(3) Indexed system access method
24. bucket is used in ________ index
(1) hashed (2) cylinder surface (3) none of these
25.Which one is index technique
(1) Cylinder (2) tree (3) binary
26.The method of maintaining a file and index is referred to as __
27.Name an application that makes use of an inverted file.
28.Define Query.
29.Define cellular partitions.
30.What is meant by Random Organization?
31.If the biscuits packed in a cylindrical paper pack is to be taken out from
one end, then the arrangement of the biscuits is _____.
32.Indexing methods are generally used for files stored in _____.
SECTION B
1. What is a file ? Discuss.
2. Discuss on inverted files.
3. Explain the advantages of sequential file organizations.
4. Explain any five file based operations.
5. Explain sequential file.
6. Write down various index techniques.
7. Explain different types of query with examples.
8. How do linked organization differ from sequential organization?
9. What are factors that affect the I/O time for disks?
10.Discuss on indexed techniques.
11.Describe random file organization.
12.Discuss cellular partitioned structures.
13.Explain linked organization with an example.
14.Explain inverted file structures.
15.SECTION D
1. Develop an algorithm to create a sequential file for sorting the given
records . Each record contains name and age of persons,along with
monthly income,number of dependents and their names.
2. Define and discuss the advantages of Random file organization.
3. Explain the structure and processing of indexed sequential files.
4. Explain random access file organization and discuss the technique for
deleting and inserting records.
5. Compare and contrast sequential,indexed sequential and random access
file organization.
1. Explain with an example where an inverted file organization is
preferred over
an indexed sequential file.
Unit 1
DSA
13
2. Explain how specific file organizations can favour certain types of
request for
data.
8. Define an m-way search tree and write a procedure for searching a key
value.
Unit 1
DSA
14
Unit 1
DSA