Consider a stack S is implemented using an array of size SIZE, which has a top pointing to the element inserted in the last to the stack. A function push is implemented and pop as well to insert and to take out elements from the stack. We need to check the condition whether the stack is full or not and empty or not while doing push and pop operations respectively.

Which among the following are the code to check the overflow and underflow conditions?

top == SIZE-1 and top == -1
top == SIZE and top == -1
top == -1 and top == SIZE-1
top == 0 and top == SIZE-1
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Implementing a push operation on stack using linked list is more time efficient than that of implementation using an array: ______
True
False
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66

Consider the following pseudocode that uses a stack

declare a stack of characters

while ( there are more characters in the word to read )

{

read a character

push the character on the stack

}

while ( the stack is not empty )

{

pop a character off the stack

write the character to the screen

}

What is output for input “gate2020”?

gate2020gate2020

0202etag

gate2020

0202etag0202etag

Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A queue is a data structure where you do all insertions and deletions at:
rear and rear
Rear and front
Front and front
front and rear
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
If a circular array is used to implement a queue. What goes wrong if we try to keep all items

At the front of a partially filled array(so that data[0] is always the front)

The insert function would require linear time.
The get_front function would require linear time.
The is_empty function would require linear time
None of the above
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
If the characters ‘z’, ‘y’, ‘x’, ‘w’ are placed in a queue (in the given order), and then removed one at a time, What will be the order after they are removed?
wxyz
zyxw
xyzw
wxyz
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Choose correct option among the following about 1,2,3 and 4 statements

1) A function pointer points to code

2) A function pointer points to data

3) We can allocate &/or deallocate memory using function pointers

4) We can’t allocate &/or deallocate memory using function pointers

1,4
2,3
1,3
2,4
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
What does the following function do for a given Linked List with the first node as head?

struct box

{

int data;

struct Node *next;

};


void fun1(struct box* h)

{

if(h == NULL)

return;

fun1(h->next);

printf("%d ", h->data);

}

Prints all nodes of linked lists
Prints all nodes of linked list in reverse order
Prints alternate nodes of Linked List
Prints alternate nodes in reverse order
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Accessing an element in an Linked list is fast, while array takes linear time, so it is quite a bit slower in case of array. _____
True
False
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Given a linked list having N number of nodes, the following function is called to count the number of nodes in it.

int getCount(struct Node* head)

{

if (head == NULL)

return 0;

return 1 + getCount(head->next);

}

How many times getCount gets called ?

N
N+1
N^2
N-1
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property.

Which one of the following is a valid sequence of elements in an array representing 3-ary max heap?

1, 3, 5, 6, 8, 9
9, 6, 3, 1, 8, 5
9, 3, 6, 8, 5, 1
9, 5, 6, 8, 3, 1
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Delete the key sequence [6,5,4] from the below AVL tree. How many rotations are needed to make it a balanced AVL tree again?

[MSQ]

1
2
3
4
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider a BST which is formed after inserting the elements 34, 27, 10 into an empty BST, in a given sequence. We want to convert this BST, in a given sequence.

We want to convert this BST into a balanced tree, whose balance factor () ranges from -1≤α≤1. Having these assumptions what will be the balance factor of the node 34 at initial step? If the tree is imbalance then which kind of imbalance is present in the tree?

Note: Consider height of child is 1.

2, LL imbalance
1, No imbalance
2, RL imbalance
-1, No imbalance
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the preorder traversal of a BST as follows:

Preorder: 67, 60, 55, 48, 58, 64, 80, 74, 84, 88, 90

What will be the post-order traversal of the above BST?

48 58 55 64 60 74 90 88 84 80 67
48 58 55 60 64 74 90 88 84 80 67
48 55 58 64 60 74 90 88 84 80 67
48 58 55 64 60 74 90 80 84 88 67
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Inserting integers [1,10,2,9,3,8,4,7,5,6] one by one in that order into an initially empty BST will result in a BST of height:
8
The height cannot be determined
10
9
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66