Cs 505

A visually engaging infographic depicting various data structures like trees, linked lists, and algorithms. Include educational elements such as flowcharts and code snippets, vibrant colors and modern design aesthetics.

Data Structures Mastery Quiz

Test your knowledge on data structures and algorithms with this comprehensive quiz designed for computer science enthusiasts. Whether you're a student or a professional, this quiz will challenge your understanding and help you learn.

Features of the Quiz:

  • Multiple choice questions covering essential topics.
  • Questions designed to enhance your problem-solving skills.
  • Perfect for exam preparation or self-assessment.
70 Questions18 MinutesCreated by CodingWizard42
Prints all nodes of linked lists
Prints all nodes of linked list in reverse order
Prints alternate nodes in reverse order
Prints alternate nodes of Linked List
The post order traversal of a binary tree is DEBFCA, What is the pre order traversal of the same tree.
ABFCDE
ADBFEC
ABDCEF
ABDECF
In linked lists there are no NULL links in:
Single Linked List
Linear Doubly Linked List
Circular Linked List
All of the above
In Breadth first search a) Scans
A) Single Linked List
B) Linear Doubly Linked List
C) Circular Linked List
D) All of the above
If YYY, XXX and ZZZ are the elements of a lexically ordered binary tree, then in preorder traversal which node will be traverse first
A) ZZZ
B) YYY
C) XXX
D) All of the above
The result of evaluating prefix expression */b+-dacd, where a = 3, b = 6, c = 1, d = 5 is
0
15
5
10
8) In an array representation of binary tree the right child of root will be at location of
2
1
5
3
9) Which of the following applications may use a stack?
A) A parentheses balancing program.
b) Keeping track of local variables at run time.
C) 5 Syntax analyzer for a compiler
D) All of the above
Assume the following tree is a binary search tree even though you cannot see what the keys and values are at the nodes (the letters we write below are just “names” for the nodes for the purpose of answering the questions). What is the maximum number of nodes that could be added to the tree without increasing its height?
Screenshot 2023-06-14 213938
Screenshot 2023-06-14 213938

17
18
19
20
11) What is the minimum and maximum number of nodes in a full tree of height 6?
A) 13,127
B) 14,128
C) 13,128
D) 14,127
13) What are the main applications of tree data structure? 1) Manipulate hierarchical data 2) Make information easy to search (see tree traversal). 3) Manipulate sorted lists of data 4) Router algorithms 5) Form of a multi-stage decision-making, like Chess Game. 6) As a workflow for compositing digital images for visual effects
A) 1, 2, 3, 4 and 6
B) 1, 2, 3, 4 and 5
C) 1, 3, 4, 5 and 6
D) 1, 2, 3, 4, 5 and 6
14) What is the minimum and maximum number of nodes at depth d in a full binary tree? Be sure to list the nodes at depth d. Do not include nodes at depth d-1 or d+1 or other depths. (Hint: the root is at depth 0)
Minimum nodes →2 (if height >=1 otherwise 1) Maximum → 2d
B) Minimum nodes→ 2-1 (if height >=1 otherwise 1) Maximum → 2d+1
C) Minimum nodes →2 Maximum → 2d
D) Minimum nodes →1 (if height >=1 otherwise 1) Maximum →2d
15) The post order traversal of the below tree is
A) ABDHIEJCFGK
B) HIDJEPFKGCA
C) HDIBEJAFCGK
D) None of the above
16) Given the below six trees, Which of them are complete tree
 
Screenshot 2023-06-14 214319
Screenshot 2023-06-14 214319
A) A,B,F
B) A ,D,C
C) A,C,F
D) All of the above
17) The postfix form of the expression A+ B*((C*D)- E)*(F / G) is?
A) AB+ CD*E – FG /**
B) ABCD*E-*FG/*+
C) AB + CD* E – *F *G /
D) AB + CDE * – * F *G /
18) Here is an INCORRECT pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced 
Screenshot 2023-06-14 214749
 
Which of these unbalanced sequences does the above code think is balanced?
A) ())(()
B) ((())
C) (()()))
D) (()))()
19) The average time complexity of Insertion sort is?
A) O(Log(n))
B) O(N)
C) O(N2 )
D) O(1)
20) Find the slowest time.
A) O(Log(n))
B) O(N!)
C) O(N2 )
D) O(1)
21) Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the maximum number of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?
A) 3
B) 4
C) 2
D) 5 or more
Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?
A) 2
B) 3
C) 4
D) 5 or more
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree?
A) 7 5 1 0 3 2 4 6 8 9
B) 0 2 4 3 1 6 5 9 8 7
C) 0 1 2 3 4 5 6 7 8 9
D) 9 8 6 4 2 3 0 1 5 7
Here is an infix expression: 4+3*(6*3-12). Suppose that we are using the usual stack algorithm to convert the expression from infix to postfix notation. What is the maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?
A) 1
B) 2
C) 3
D) 4
Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing.
1
1
 
What does the above function do in general?
A) Prints binary representation of n in reverse order
B) Prints the value of Logn
C) Prints binary representation of n
D) Prints the value of Logn in reverse order
A) *head_ref = current;
B) *head_ref = next;
C) *head_ref = prev;
D) *head_ref = NULL;
A) 1,2,3,4,5,6,7
B) 2,1,4,3,6,5,7
C) 1,3,2,5,4,7,6
D) 2,3,4,5,6,7,1
29) One difference between a queue and a stack is:
A) Queues require dynamic memory, but stacks do not.
B) Stacks require dynamic memory, but queues do not.
C) Queues use two ends of the structure; stacks use only one.
D) Stacks use two ends of the structure; queues use only one.
A) DataStructureExam
B) maxEeerutvurtSataDmaxEeerutvurtSataD
C) maxEerutcurtSataD
D) DataStructureExamDataStructureExam
A) q = NULL; p->next = head; head = p;
B) q->next = NULL; head = p; p->next = head;
C) head = p; p->next = q; q->next = NULL;
Q->next = NULL; p->next = head; head = p;
32) Suppose we have a circular array implementation of the queue class, with ten items in the queue stored at data[2] through data[11]. The CAPACITY is 42. Where does the push member function place the new entry in the array?
A) data[1]
b) data[2]
C) data[11]
D) data[12]
33) If data is a circular array of CAPACITY elements, and last is an index into that array, what is the formula for the index after last?
A) (last % 1) + CAPACITY
B) last % (1 + CAPACITY)
C) (last + 1) % CAPACITY
D) last + (1 % CAPACITY)
34) I have implemented the queue with a circular array, keeping track of first, last, and count (the number of items in the array). Suppose first is zero, and last is CAPACITY-1. What can you tell me about count?
A) count must be zero.
Count could be zero or CAPACITY, but no other values could occur.
C) count must be CAPACITY.
D) None of the above.
35) Suppose cursor points to a node in a linked list (using the node definition with member functions called data and link). What statement changes cursor so that it points to the next node?
A) cursor++;
B) cursor = link( );
C) cursor += link( );
D) cursor = cursor->link( );
36) Suppose cursor points to a node in a linked list (using the node definition with member functions called data and link). What Boolean expression will be true when cursor points to the tail node of the list?
A) (cursor == NULL)
B) (cursor->link( ) == NULL)
C) (cursor->data( ) == NULL)
D) None of the above.
37) Suppose that p is a pointer variable that contains the NULL pointer. What happens if your program tries to read or write *p?
A) The results are unpredictable
B) Will print the current value of the memory pointed to by the pointer variable
C) Will print rubbish
D) All of the above.
A) Node
B) Node*
C) Const Node*
D) None of the above
A) Node*
B) Node&
C) Node*&
D) None of the above
40) Select the one FALSE statement about binary trees:
A) Every binary tree has at least one node.
B) Every non-empty tree has exactly one root node.
C) Every node has at most two children. d
) Every non-root node has exactly one parent.
41) Suppose T is a binary tree with 14 nodes. What is the minimum possible depth of T?
A) 0
b) 3
C) 4
D) 5
A) 0
B) 2
C) 4
D) 8
43) Which of the following is false about a binary search tree?
A) The left child is always lesser than its parentder of elements
B) The right child is always greater than its parent
C) The left and right sub-trees should also be binary search trees
D) In order sequence gives decreasing order of elements
45) The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
A) 10, 20, 15, 23, 25, 35, 42, 39, 30
B) 15, 10, 25, 23, 20, 42, 35, 39, 30
C) 15, 20, 10, 23, 25, 42, 35, 39, 30
D) 15, 10, 23, 25, 20, 35, 42, 39, 30
A) rear node
B) front node
C) not possible with a single pointer
D) node next to front
47) If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed?
A) ABCD
B) DCBA
C) DCAB
D) ABDC
48) A normal queue, if implemented using an array of size MAX_SIZE, gets full when
A)Rear = MAX_SIZE – 1
B)Front = (rear + 1)mod MAX_SIZE
C)Front = rear + 1
D)Rear = front
49) A linear collection of data elements where the linear node is given by means of pointer is called?
A) Linked list
B) Node list
C) Primitive list
D) Unordered list
A) 6, 1
B) 5, 7
C) 3,2
D) 1,5
51) The initial configuration of the queue is a,b,c,d (a is the front end). To get the configuration d,c,b,a one needs a minimum of ?
A) 3 additions and 2 deletions
B) 2 deletions and 3 additions
C) 3 deletions and 4 additions
D) 3 deletions and 3 additions
52) Which one of the following is an application of Stack Data Structure?
A) Managing function calls
B) The stock span problem
C) Arithmetic expression evaluation
D) All of the above
53) What is the value of the postfix expression 6 3 2 4 + – *?
A) 1
B) 40
C) -74
D) -18
54) Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced:
A) ())(()
B) ((())
C) (()()))
D) (()))()
55) What is the time complexity of adding an item in front of a LinkedList?
A) O(Log(n))
B) O(N)
C) O(N2 )
D) O(1)
56) What the time complexity of the linear search algorithm?
A) O(Log(n))
B) O(N)
C) O(N2 )
D) O(1)
57) What is the best case complexity of selection sort?
A) O(nlogn)
B) O(n2)
C) O(logn)
D) O(n)
58) Which of the following sorting algorithms is closely related to shell sort?
A) Selection sort
B) Merge sort
C) Insertion sort
D) Bucket sort
59) Search a binary search tree costs?
A) O(Log(n))
b) O(N)
C) O(N2 )
D) O(1)
60) Element insertion to a Binary Search tree costs?
A) O(Log(n))
B) O(N)
C) O(N2 )
D) O(1)
61) What are the correct intermediate steps of the following data set when it is being sorted with the Insertion sort? 15,20,10,18
A) 10, 20,15,18 -- 10,15,20,18 -- 10,15,18,20
B) 15,20,10,18 -- 10,15,20,18 -- 10,15,18,20 -- 10,15,18,20
C) 15,10,20,18 -- 15,10,18,20 -- 10,15,18,20
D) 15,18,10,20 -- 10,18,15,20 -- 10,15,18,20 -- 10,15,18,20
62) What will be the number of passes to sort the elements using insertion sort? 14, 12,16, 6, 3, 10
A) 1
B) 8
c) 5
D) 7
63) Which of the following options contain the correct feature of an insertion sort algorithm?
A) Stable
B) Dependable
C) 5 Unstable
D) None of the above
64) Consider the following lists of partially sorted numbers. The double bars represent the sort marker. How many comparisons and swaps are needed to sort the next number. [1 3 4 8 9 || 5 2]
A) 2 comparisons, 3 swaps
B) 3 comparisons, 2 swaps
C) 4 comparisons, 3 swaps
D) 3 comparisons, 4 swaps
Page 9 of 10 65) If all the elements in an input array is equal for example {1,1,1,1,1,1}, What would be the running time of the Insertion Algorithm?
A) O(2N)
B) O(n^2)
C) O(N)
D) None of the above
66) What operation does the Insertion Sort use to move numbers from the unsorted section to the sorted section of the list?
A) Finding the minimum value
B) Finding out an pivot value
C) Swapping
D) None of the above
67) In the following scenarios, when will you use selection sort?
A) The input is already sorted
B) A large file has to be sorted
C) Large values need to be sorted with small keys
D) Small values need to be sorted with large keys
68) What is the worst case complexity of selection sort?
A) O(nlogn)
B) O(logn)
C) O(n)
D) O(n2)
70) What is the time complexity of adding elements at the beginning of Array List?
A) O(Log(n))
b) O(N)
C) O(N2 )
D) O(1)
71) What is the time complexity of the recursive Binary Search algorithm?
A) O(Log(n))
B) O(N)
C) O(N2 )
D) O(1)
72) What is the advantage of selection sort over other sorting techniques?
A) It requires no additional storage space
B) b) It is scalable
C) c) It works best for inputs which are already sorted
D) d) It is faster than any other sorting technique
73) What is the average case complexity of selection sort?
A) O(nlogn)
B) O(n2)
C) O(logn)
D) O(n)
74) Given an array of the following elements 81,94,11,96,12,35,17,95,28,58,41,75,15. What will be the sorted order after 5-sort?
A) 11,12,15,17,28,35,41,58,75,81,94,95,96
B) 28,12,11,35,41,58,17,94,75,81,96,95,15
C) 35,17,11,28,12,41,75,15,96,58,81,94,95
D) 12,11,15,17,81,94,85,96,28,35,41,58,75
75) Which of the following statements is the basic for loop for a shell sort algorithm?
A) for(increment=N/2;increment>0;increment/=2)
B) for(i=n/2;i>=0;i- -)
C) for(i=1;i
D) for(i=0;i< n;i++;numelements- -)
{"name":"Cs 505", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Test your knowledge on data structures and algorithms with this comprehensive quiz designed for computer science enthusiasts. Whether you're a student or a professional, this quiz will challenge your understanding and help you learn.Features of the Quiz:Multiple choice questions covering essential topics.Questions designed to enhance your problem-solving skills.Perfect for exam preparation or self-assessment.","img":"https:/images/course5.png"}
Powered by: Quiz Maker