Class Test Solution What is the postfix form of the infix expression ((+)*C (-E))^(F+G)?. ^-*+C EF+G. ^-*+C E+FG C. -^*+C E+FG. -^*+C EFG+ Which of the following shows the number of disk moves for the six disk towers of Hanoi problem?. 32. 64 C. 63. 31 C Which of the following operation can be easily performed on array as compare to linked list?. Insert. elete C. Traverse. Fetch an element from a given position Recursion is memory-intensive because:. Recursive functions tend to declare many local variables.. Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack. C. Many copies of the function code are created.. It requires large data values.
Which of the following data structure is linear data structure?. Tree. Graph C. linked list C n array [2:10, -1:15] is stored in column major order having base address 5115 and each element of array occupies 4 bytes. Find the address of an element [4,4].. 5256. 5303 C. 5208. 5202 If the address of [1][1] and [2][1] are 1000 and 1010 respectively and each element occupies 2 bytes then the array has been stored in order.. row major. matrix major C. column major What is the postfix form of the prefix expression *+ab cd?. abcd+*. ab+cd * C. ab+*cd. ab*+cd
The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is. 600. 650 C. 350. 588 C How many values can be held by an array (-1:n, 1:n)?. (n-1)*(n+1). n*(n+2) C. n*n. n*(n+1) What would be returned by the following recursive function after we call test(0, 3)? int test (int a, int b) if (a==b) return (1); else if (a>b) return(0); else return (a+test(a+1, b));. 1. 2 C. 3. 4
Recursive solution takes more or equal execution time compared to iterative solution for a given problem.. True. False If the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack, the sequence of popped out values are?. 2, 2, 1, 1, 2. 2, 2, 1, 2, 2 C. 2, 1, 2, 2, 1. 2, 1, 2, 2, 2 Suggest an appropriate data structure for the following cases-"when a key of keyboard is pressed, the character is printed on the monitor screen".. Linked list. Stack C. Queue. Priority queue C Suppose you have opened a notepad, a music player, an excel sheet,and also you are doing your data structure programming simultaneously. Your OS implements which data structure for it?. Stack. Graph C. Tree. Queue
In a linked list with n nodes, the time taken to insert an element after an element pointed by some pointer is. O(1). O(logn) C. O(n). O(nlogn) Which of the following lines of code will delete two successive nodes of a singly linked list? (assume that the list contains more than 2 nodes). current->link = current->link->link;. current = current->link->link; C. current->link->link = current;. current->link = current->link->link->link; Suppose a circular queue of capacity (n 1) elements is implemented with an array of n elements. ssume that the insertion and deletion operation are carried out using RER and FRONT as array index variables, respectively. Initially, RER = FRONT = 0. The conditions to detect queue full and queue empty are. Full: (RER+1) mod n == FRONT, empty: RER == FRONT. Full: (RER+1) mod n == FRONT, empty: (FRONT+1) mod n == RER C. Full: RER == FRONT, empty: (RER+1) mod n == FRONT. Full: (FRONT+1) mod n == RER, empty: RER == FRONT Which one of the following permutations can be obtained as an output using stack assuming that the input is the sequence 1,2,3,4,5 in that order?. 3,4,5,1,2. 3,4,5,2,1 C. 1,5,2,3,4
. 5,4,3,1,2 What does the following function do for a given Linked List with first node as head? void fun(struct Node* head) if(head == NULL) return; fun(head->next); printf("%d", head->data);. Prints all nodes of linked lists. Prints all nodes of linked list in reverse order C. Prints alternate nodes of Linked List. Prints alternate nodes in reverse order Which of the following is true about linked list implementation of stack?. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning. C. oth are correct. None is correct The following postfix expression with single digit operands is evaluated using a stack:
8 2 3 ^ / 2 3 * + 5 1 * - Which are the two top elements of the stack after evaluation of first *?. 6, 1. 5, 7 C. 3, 2. 7, 5 single array [1..MXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl< top2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for stack full is.. (top1 = MXSIZE/2) and (top2 = MXSIZE/2+1). top1 + top2 = MXSIZE C. (top1= MXSIZE/2) or (top2 = MXSIZE). top1= top2-1 Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are: i. isempty (Q) returns true if the queue is empty, false otherwise. ii. delete (Q) deletes the element at the front of the queue and returns its value. iii. insert (Q, i) inserts the integer i at the rear of the queue. Consider the following function: void f(queue Q) int i ; if (!isempty(q)) i = delete(q);
f(q); insert(q, i);. Leaves the queue Q unchanged. Reverses the order of the elements in the queue Q C. eletes the element at the front of the queue Q and inserts it at the rear keeping the other elements in the same order Consider the following function to traverse a linked list. Head is a pointer pointing to the first node of the list. void traverse(struct Node *head) while (head->next!= NULL) printf("%d", head->data); head = head->next; Which of the following is FLSE about above function?. The function may return segmentation fault when the linked list is empty.. The function doesn't print data of the last node when the linked list is not empty C. The function prints data of all the nodes of the link list when the list is not empty. C