option
Questions
ayuda
daypo
search.php

CS505

COMMENTS STATISTICS RECORDS
TAKE THE TEST
Title of test:
CS505

Description:
Data Structure and Algorism

Creation Date: 2023/01/06

Category: Others

Number of questions: 122

Rating:(1)
Share the Test:
Nuevo ComentarioNuevo Comentario
New Comment
NO RECORDS
Content:

Which of this best describes an array?. A data structure that shows a hierarchical behavior. Container of objects of similar types. Arrays are immutable once initialized. Array is not a data structure.

How do you initialize an array in C?. int arr[3] = (1,2,3);. int arr(3) = {1,2,3};. int arr[3] = {1,2,3};. int arr(3) = (1,2,3);.

When does the Array Index Out Of Bounds Exception occur?. Compile-time. Run-time. Not an error. Not an exception at all.

Which of the following concepts make extensive use of arrays?. Binary trees. Scheduling of processes. Caching. Spatial locality.

What are the advantages of arrays?. Objects of mixed data types can be stored. Elements in an array cannot be sorted. Index of first element of an array is 1. Easier to store elements of same data type.

What are the disadvantages of arrays?. Data structure like queue or stack cannot be implemented. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size. Index value of an array can be negative. Elements are sequentially accessed.

Assuming int is of 4 bytes, what is the size of int arr[15];?. 15. 19. 11. 60.

In general, the index of the first element in an array is __________. 0. -1. 2. 1.

Elements in an array are accessed _____________. randomly. sequentially. exponentially. logarithmically.

The process of inserting an element in a stack is called. Create. Push. Evaluation. Pop.

Process of removing an element from stack is called. Create. Push. Evaluation. Pop.

In a stack, if a user tries to remove an element from an empty stack it is called. Underflow. Empty collection. Overflow. Garbage Collection.

Pushing an element into stack already having five elements and stack size of 5, then stack becomes. Overflow. Crash. Underflow. User flow.

Entries in a stack are “ordered”. What is the meaning of this statement?. A collection of stacks is sortable. Stack entries may be compared with the ‘<‘ operation. The entries are stored in a linked list. There is a Sequential entry that is one by one.

Which of the following is not the application of stack?. A parentheses balancing program. Tracking of local variables at run time. Compiler Syntax Analyzer. Data Transfer between two asynchronous processes.

16. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?. 1. 2. 3. 4 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?. 1. 2. 3. 4 or more.

What is the value of the postfix expression 6 3 2 4 + – *?. 1. 40. 74. -18.

Process of inserting an element in stack is called ____________. Create. Push. Evaluation. Pop.

Process of removing an element from stack is called __________. Create. Push. Evaluation. Pop.

In a stack, if a user tries to remove an element from an empty stack it is called ___. Underflow. Empty collection. Overflow. Garbage Collection.

Pushing an element into stack already having five elements and stack size of 5, then stack becomes ___________. Overflow. Crash. Underflow. User flow.

Which of the following is not the application of stack?. A parentheses balancing program. Tracking of local variables at run time. Compiler Syntax Analyzer. Data Transfer between two asynchronous process.

26. Consider the usual algorithm for determining whether a sequence of parentheses is balanced. The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?. 1. 2. 3. 4 or more.

27. 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?. 1. 2. 3. 4 or more.

What is the value of the postfix expression 6 3 2 4 + – *?. 1. 40. 74. -18.

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. The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this expression?. 1. 2. 3. 4.

The postfix form of the expression (A+ B)*(C*D- E)*F / G is?. AB+ CD*E – FG /**. AB + CD* E – F **G /. AB + CD* E – *F *G /. AB + CDE * – * F *G /.

The data structure required to check whether an expression contains a balanced parenthesis is?. Stack. Queue. Array. Tree.

What data structure would you mostly likely see in non recursive implementation of a recursive algorithm?. Linked List. Stack. Queue. Tree.

The process of accessing data stored in a serial access memory is similar to manipulating data on a ________. Heap. Binary Tree. Array. Stack.

The postfix form of A*B+C/D is?. *AB/CD+. AB*CD/+. A*BC+/D. ABCD+/*.

Which data structure is needed to convert infix notation to postfix notation?. Branch. Tree. Queue. Stack.

The prefix form of A-B/ (C * D ^ E) is?. -/*^ACBDE. -ABCD*^DE. -A/B*C^DE. -A/BC*^DE.

What is the result of the following operation? Top (Push (S, X)). X. X+S. S. XS.

The prefix form of an infix expression (p + q) – (r * t) is?. + pq – *rt. – +pqr * t. – +pq * rt. – + * pqrt.

Which data structure is used for implementing recursion?. Queue. Stack. Array. List.

The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?. 600. 350. 650. 588.

41. Convert the following infix expressions into its equivalent postfix expressions. (A + B ⋀D)/(E – F)+G. (A B D ⋀ + E F – / G +). (A B D +⋀ E F – / G +). (A B D ⋀ + E F/- G +). (A B D E F + ⋀ / – G +).

Convert the following Infix expression to Postfix form using a stack. x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal. xyz*+pq*r+s*+. xyz*+pq*r+s+*. xyz+*pq*r+s*+. xyzp+**qr+s*+.

Which of the following statement(s) about stack data structure is/are NOT correct?. Linked List are used for implementing Stacks. Top of the Stack always contain the new node. Stack is the FIFO data structure. Null link is present in the last node at the bottom of the stack.

Which of the following is not an inherent application of stack?. Reversing a string. Evaluation of postfix expression. Implementation of recursion. Job scheduling.

The type of expression in which operator succeeds its operands is?. Infix Expression. Prefix Expression. Postfix Expression. Both Prefix and Postfix Expressions.

46. Assume that the operators +,-, X are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^, X, +, -. The postfix expression for the infix expression a + b X c – d ^ e ^ f is?. abc X+ def ^^ –. abc X+ de^f^ –. ab+c Xd – e ^f^. -+aXbc^ ^def.

If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, what is the order of removal?. ABCD. DCBA. DCAB. ABDC.

A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as _____________. Queue. Stack. Tree. Linked list.

The data structure required for Breadth First Traversal on a graph is?. Stack. Array. Queue. Tree.

A queue follows __________. FIFO (First In First Out) principle. LIFO (Last In First Out) principle. Ordered array. Linear tree.

Circular Queue is also known as ________. Ring Buffer. Square Buffer. Rectangle Buffer. Curve Buffer.

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?. ABCD. DCBA. DCAB. ABDC.

A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?. Queue. Circular queue. Dequeue. Priority queue.

A normal queue, if implemented using an array of size MAX_SIZE, gets full when?. Rear = MAX_SIZE – 1. Front = (rear + 1)mod MAX_SIZE. Front = rear + 1. Rear = front.

Queues serve major role in ______________. Simulation of recursion. Simulation of arbitrary linked list. Simulation of limited resource allocation. Simulation of heap sort.

Which of the following is not the type of queue?. Ordinary queue. Single ended queue. Circular queue. Priority queue.

A linear collection of data elements where the linear node is given by means of pointer is called?. Linked list. Node list. Primitive list. Unordered list.

Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time?. I and II. I and III. I, II and III. I, II and IV.

In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?. Pointer to character. Pointer to integer. Pointer to node. Node.

What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?. O(1). O(n). θ(n). θ(1).

What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?. O(1). O(n). O(n2). O(n3).

What would be the asymptotic time complexity to find an element in the linked list?. O(1). O(n). O(n2). O(n4).

What would be the asymptotic time complexity to insert an element at the second position in the linked list?. O(1). O(n). O(n2). O(n3).

The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?. Singly linked list. Doubly linked list. Circular doubly linked list. Array implementation of list.

Which of the following c code is used to create new node?. ptr = (NODE*)malloc(sizeof(NODE));. ptr = (NODE*)malloc(NODE);. ptr = (NODE*)malloc(sizeof(NODE*));. ptr = (NODE)malloc(sizeof(NODE));.

What kind of linked list is best to answer questions like “What is the item at position n?”. Singly linked list. Doubly linked list. Circular linked list. Array implementation of linked list.

Linked lists are not suitable for the implementation of ___________. Insertion sort. Radix sort. Polynomial manipulation. Binary search.

Linked list is considered as an example of ___________ type of memory allocation. Dynamic. Static. Compile time. Heap.

In Linked List implementation, a node carries information regarding ___________. Data. Link. Data and Link. Node.

Linked list data structure offers considerable saving in _____________. Computational Time. Space Utilization. Space Utilization and Computational Time. Speed Utilization.

Which of the following points is/are not true about Linked List data structure when it is compared with an array?. Arrays have better cache locality that can make them better in terms of performance. It is easy to insert and delete elements in Linked List. Random access is not allowed in a typical implementation of Linked Lists. Access of elements in linked list takes less time than compared to arrays.

Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?. Insertion Sort. Quick Sort. Heap Sort. Merge Sort.

What should be added in place of “/*ADD A STATEMENT HERE*/”, so that the function correctly reverses a linked list. *head_ref = prev;. *head_ref = current;. *head_ref = next;. *head_ref = NULL;.

88. The following C function takes a simply-linked list as an input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. Choose the correct alternative to replace the blank line typedef struct node { int value; struct node *next; }Node; Node *move_to_front(Node *head) { Node *p, *q; if ((head == NULL: || (head->next == NULL)) return head; q = NULL; p = head; while (p-> next !=NULL) { q = p; p = p->next; } _______________________________ return head; }. q = NULL; p->next = head; head = p;. q->next = NULL; head = p; p->next = head;. head = p; p->next = q; q->next = NULL;. q->next = NULL; p->next = head; head = p;.

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is?. log 2 n. n⁄2. log 2 n – 1. n.

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?. Possible if X is not last node. Possible if size of linked list is even. Possible if size of linked list is odd. Possible if X is not first node.

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?. Delete the first element. Insert a new element as a first element. Delete the last element of the list. Add a new element at the end of the list.

Which of the following is not a disadvantage to the usage of array?. Fixed size. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size. Insertion based on position. Accessing elements at specified positions.

What is the time complexity of inserting at the end in dynamic arrays?. O(1). O(n). O(logn). Either O(1) or O(n).

What is the time complexity to count the number of elements in the linked list?. O(1). O(n). O(logn). O(n2).

What is the space complexity for deleting a linked list?. O(1). O(n). Either O(1) or O(n). O(logn).

Which of these is not an application of a linked list?. To implement file systems. For separate chaining in hash-tables. To implement non-binary trees. Random Access of elements.

What is the postfix expression of A+ B*((C*D)- E)*(F / G) ? (Answer using stack – show your answer step by step). A B C D * E - * F G / * +. A B C D * E - *G F / +*. A B C D * E - * / +* G F. A B C *D E - * F G / * +.

While evaluating a prefix expression, the string is read from?. left to right. right to left. center to right. center to left to right.

How many stacks are required for evaluation of prefix expression?. one. two. three. four.

Minimum number of fields in each node of a doubly linked list is. 2. 3. 4. None of the above.

The elements of a linked list are stored. In a structure. In an array. Anywhere the computer has space for them. In contiguous memory locations.

A parentheses checker program would be best implemented using. List. Queue. Stack. Any of the above.

To perform levelorder traversal on a binary tree, which of following data structure will be required?. Hash table. Queue. Binary search tree. Stack.

the Which of the following data structure is required to convert arithmetic expression in infix to its equivalent postfix notation?. Queue. Linked list. Binary search tree. None of above.

A binary tree in which all its levels except the last, have maximum numbers of nodes, and all the nodes in the last level have only one child it will be its left child. Name the tree. Threaded tree. Complete binary tree. Binary search tree. Full binary tree.

Which of following data structure is more appropriate for implementing quick sort iteratively?. Deque. Queue. Stack. Priority queue.

The …… of a binary tree equals (number of edges + 1) from the root node to the deepest leaf is the tree. height. depth. length. width.

What is a full binary tree?. Each node has zero or two children. Each node has exactly two children. Each node has exactly one or two children.

Internal nodes are the nodes that have …… children. At most one. At least one. One or more. Exactly one.

a tree with 255 nodes has …... edge. 256. 255. 254. 200.

Having a complete binary tree, a node with index 9 should have a parent with index ……. 5. 4. 18. 19.

Which of the following is not an advantage of trees?. Hierarchical structure. Faster search. Undo/Redo operations in a notepad.

In a full binary tree if number of internal nodes is I, then number of leaves L are?. L = 2*I. L = I + 1. L = I – 1. L = 2*I – 1.

Given a binary search tree, which traversal type would print the values in the nodes in sorted order?. Preorder. Postorder. Inorder. None of the above.

Which of the following statements about binary trees is NOT true?. Every binary tree has at least one node. Every non-empty tree has exactly one root node. Every node has at most two children. Every non-root node has exactly one parent.

Which of the following is a valid binary search tree. A. B. C.

Which of the following is false about a binary search tree?. The left child is always less than its parent. The right child is always greater than its parent. The left and right sub-trees should also be binary search trees. In order sequence gives decreasing order of elements.

What is the specialty about the inorder traversal of a binary search tree?. It traverses in a non increasing order. It traverses in an increasing order. It traverses in a random fashion. It traverses based on priority of the node.

Construct a binary search tree with the following sequence 10, 4, 3, 5,11, 12. A. B. C. D.

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?. 7 5 1 0 3 2 4 6 8 9. 0 2 4 3 1 6 5 9 8 7. 0 1 2 3 4 5 6 7 8 9. 9 8 6 4 2 3 0 1 5 7.

The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree?. 2. 3. 4. 6.

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?. 10, 20, 15, 23, 25, 35, 42, 39, 30. 15, 10, 25, 23, 20, 42, 35, 39, 30. 15, 20, 10, 23, 25, 42, 35, 39, 30. 15, 10, 23, 25, 20, 35, 42, 39, 30.

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is …... 65. 67. 69. 83.

Simple selection sort performs better for partially sorted lists than for random lists. True. False.

Bubble sort performs better for partially sorted lists than for random lists. True. false.

What is the worst-case complexity of selection sort?. O(nlogn). O(logn). O(n). O(n2).

Select the appropriate code that performs selection sort. int smallpos , smallest ; for (int i =0; i<size;i++) { smallpos = i; smallest = x[smallpos]; for(int j = i+1;j<size;j++) { if (x[j]<smallest) { smallpos = j; smallest = x[j]; } } x[smallpos]=x[i]; x[i] = smallest; }. int temp; for (int i=1;i<size;i++) { temp = x[i]; int j = i-1; while((temp<x[j])&&(j>=0)) { x[j+1]=x[j]; j= j-1; } x[j+1]= temp; }. bool flag; int temp; do { flag = false; for(int i=0;i<size-1;i++) { if(x[i]>x[i+1]) { temp = x[i]; x[i]= x[i+1]; x[i+1]=temp; flag = true; } } }while(flag==true);. int i, j, k, temp; for(i = size/2; i > 0; i = i/2) { for(j = i; j < size; j++) { for(k = j-i; k >= 0; k = k-i) { if(a[k+i] >= a[k]) break; else { temp = a[k]; a[k] = a[k+i]; a[k+i] = temp; } } } }.

The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sort respectively are __. 5 and 4. 4 and 5. 2 and 4. 2 and 5.

What is the best-case complexity of selection sort?. O(nlogn). O(logn). O(n). O(n^2).

What is the worst case complexity of bubble sort?. O(nlogn). O(logn). O(n). O(n^2).

How many passes does an insertion sort algorithm consist of (if an array of N elements given)?. N. N-1. N+1. N^2.

Any algorithm that sorts by exchanging adjacent elements require O(N2) on average. True. False.

What will be the number of passes to sort the elements using insertion sort? 14, 12,16, 6, 3, 10. 6. 5. 7. 1.

Which of the following examples represent the worst-case input for an insertion sort?. array in sorted order. array sorted in reverse order. normal unsorted array. large array.

Insertion sort is an example of an incremental algorithm. True. False.

consider the code given below, which runs insertion sort void insertionSort(int arr[], int array_size) { int i, j, value; for (i = 1; i < array_size; i++) { value = arr[i]; j = i; while (________ ) { arr[j] = arr[j − 1]; j = j − 1; } arr[j] = value; } } Which condition will correctly implement the while loop?. (j > 0) || (arr[j − 1] > value). (j > 0) && (arr[j − 1] > value). (j > 0) && (arr[j + 1] > value). (j > 0) && (arr[j + 1] < value).

Consider an array of length 5, arr[5] = {9,7,4,2,1}. What are the steps of insertions done while running insertion sort on the array?. 7 9 4 2 1 4 7 9 2 1 2 4 7 9 1 1 2 4 7 9. 9 7 4 1 2 9 7 1 2 4 9 1 2 4 7 1 2 4 7 9. 7 4 2 1 9 4 2 1 9 7 2 1 9 7 4 1 9 7 4 2. 7 9 4 2 1 2 4 7 9 1 4 7 9 2 1 1 2 4 7 9.

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element will be. O(log N). O(n). O(1). None of the above.

Report abuse