1. The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
1.AB+ CD*E � FG /**
2.AB + CD* E � F **G /
3.AB + CD* E � *F *G /
4.AB + CDE * � * F *G /
1. The result of evaluating the postfix expression 5 4 6 + * 4 9 3 / + * is?
1.600
2.350
3.650
4.588
1. Which of these best describes an array?
1.A data structure that shows a hierarchical behavior
2.Container of objects of similar types
3.Arrays are immutable once initialised
4.Array is not a data structure
A linear collection of data elements where the linear node is given by means of pointer is called?
1. Linked list
2.Node list
3.Primitive list
4.Unordered list
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 _____________
1.Queue
2.Stack
3.Tree
4.Linked 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) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list a) b) c) I II and III d) I II and IV
1.I and II
2.I and III
3.I II and III
4.I and III
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.1
2.2
3.3
4.4 or more
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.1
2.2
3.3
4.4
How do you instantiate an array in Java?
1.int arr[] = new int(3)
2.int arr[]
3.int arr[] = new int[3]
4. int arr() = new int(3)
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?
1.ABCD
2.DCBA
3.DCAB
4.ABDC
In a stack if a user tries to remove an element from an empty stack it is called _________
1.Underflow
2.Empty collection
3.Overflow
4.Garbage Collection
In general the index of the first element in an array is __________
1.0
2.-1
3.2
4.1
In Linked List implementation a node carries information regarding ___________
1.Data
2.Link
3.Data and Link
4.Node
Linked list data structure offers considerable saving in _____________
1.Computational Time
2. Space Utilization
3.Space Utilization and Computational Time
4.Speed Utilization
Linked list is considered as an example of ___________ type of memory allocation.
1.Dynamic
2.Static
3.Compile time
4.Heap
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?
1.Singly linked list
2.Doubly linked list
3.Circular doubly linked list
4.Array implementation of list
The data structure required for Breadth First Traversal on a graph is?
1.Stack
2.Array
3.Queue
4.Tree
The data structure required to check whether an expression contains a balanced parenthesis is?
1.Stack
2.Queue
3.Array
4.Tree
What are the advantages of arrays?
1.Objects of mixed data types can be stored
2.Elements in an array cannot be sorted
3.Index of first element of an array is 1
4. Easier to store elements of same data type
What data structure would you mostly likely see in non recursive implementation of a recursive algorithm?
1.Linked List
2.Stack
3.Queue
4.Tree
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
What is the output of the following Java code? public class array { public static void main(String args[]) { int []arr = {1 2 3 4 5} System.out.println(arr[2]) System.out.println(arr[4]) } }
1.3 and 5
2.5 and 3
3.2 and 4
4.4 and 2
What kind of linked list is best to answer questions like What is the item at position n?
1.Singly linked list
2.Doubly linked list
3.Circular linked list
4.Array implementation of linked list
What would be the asymptotic time complexity to find an element in the linked list?
1.O(1)
2.O(n)
3.O(n2)
4.O(n4)
Which data structure is needed to convert infix notation to postfix notation?
1.Branch
2.Tree
3.Queue
4.Stack
Which of the following is not the type of queue?
1. Ordinary queue
2. Single ended queue
3. Circular queue
4.Priority queue
A data structure in which elements can be inserted or deleted at/from both ends but not in the middle is?
1.Queue
2.Circular queue
3.Dequeue
4.Priority queue
A normal queue if implemented using an array of size MAX_SIZE gets full when?
1. Rear = MAX_SIZE � 1
2.Front = (rear + 1)mod MAX_SIZE
3.Front = rear + 1
4.Rear = front
A queue follows __________
1.FIFO (First In First Out) principle
2.LIFO (Last In First Out) principle
3.Ordered array
4.Linear tree
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?
1.abc X+ def ^^ �
2.abc X+ de^f^ �
3.ab+c Xd � e ^f^
4.-+aXbc^ ^def
Assuming int is of 4bytes what is the size of int arr[15] ?
1.15
2.19
3.11
4.60
Circular Queue is also known as ________
1.Ring Buffer
2.Square Buffer
3.Rectangle Buffer
4. Curve Buffer
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) Insertion at the front of the linked list ii) Insertion at the end of the linked list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list a)
1.I and II
2. I and III
3.I II and III
4.I II and IV
Consider the following definition in c programming language. struct node { int data struct node * next } typedef struct node NODE NODE *ptr Which of the following c code is used to create new node?
1.ptr = (NODE*)malloc(sizeof(NODE))
2.ptr = (NODE*)malloc(NODE)
3.ptr = (NODE*)malloc(sizeof(NODE*))
4.ptr = (NODE)malloc(sizeof(NODE))
Consider the following operation performed on a stack of size 5. Push(1) Pop() Push(2) Push(3) Pop() Push(4) Pop() Pop() Push(5) After the completion of all operation the number of elements present in stack is?
1.1
2.2
3.3
4.4
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.1
2.2
3.3
4.4 or more
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.
1.xyz*+pq*r+s*+
2.xyz*+pq*r+s+*
3.xyz+*pq*r+s*+
4. xyzp+**qr+s*+
Convert the following infix expressions into its equivalent postfix expressions. (A + B ?D)/(E � F)+G
1. (A B D ? + E F � / G +)
2.(A B D +? E F � / G +)
3.(A B D ? + E F/- G +)
4. (A B D E F + ? / � G +)
Elements in an array are accessed _____________
1.randomly
2.sequentially
3.exponentially
4.logarithmically
Entries in a stack are ordered . What is the meaning of this statement?
1.A collection of stacks is sortable
2.Stack entries may be compared with the < operation
3.The entries are stored in a linked list
4.There is a Sequential entry that is one by one
How do you initialize an array in C?
1. int arr[3] = (1 2 3)
2.int arr(3) = {1 2 3}
3.int arr[3] = {1 2 3}
4.int arr(3) = (1 2 3)
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?
1.ABCD
2.DCBA
3.DCAB
4.ABDC
In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?
1.Pointer to character
2.Pointer to integer
3.Pointer to node
4.Node
In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?
1.Pointer to character
2.Pointer to integer
3.Pointer to node
4.None
Linked lists are not suitable for the implementation of ___________
1. Insertion sort
2.Radix sort
3.Polynomial manipulation
4. Binary search
Process of removing an element from stack is called __________
1.Create
2.Push
3.Evaluation
4.Pop
Pushing an element into stack already having five elements and stack size of 5 then stack becomes ___________
1.Overflow
2.Crash
3.Underflow
4.User flow
Queues serve major role in ______________
1.Simulation of recursion
2.Simulation of arbitrary linked list
3.Simulation of limited resource allocation
4.Simulation of heap sort
The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?
1.Singly linked list
2.Doubly linked list
3. Circular doubly linked list
4.Array implementation of list
The postfix form of A*B+C/D is?
1.*AB/CD+
2.AB*CD/+
3.A*BC+/D
4.ABCD+/*
The prefix form of A-B/ (C * D ^ E) is?
1.-/*^ACBDE
2. -ABCD*^DE
3.-A/B*C^DE
4.-A/BC*^DE
The prefix form of an infix expression (p + q) � (r * t) is?
1. + pq � *rt
2.� +pqr * t
3. � +pq * rt
4.� + * pqrt
The process of accessing data stored in a serial access memory is similar to manipulating data on a ________
1.Heap
2. Binary Tree
3.Array
4.Stack
The type of expression in which operator succeeds its operands is?
1.Infix Expression
2.Prefix Expression
3.Postfix Expression
4.Both Prefix and Postfix Expressions
This set of Data Structure Interview Questions & Answers focuses on Singly Linked List Operations � 1 . 1. A linear collection of data elements where the linear node is given by means of pointer is called?
1.Linked list
2.Node list
3.Primitive list
4.Unordered list
This set of Data Structure Multiple Choice Questions & Answers (MCQs) focuses on Stack Operations � 1 . 1. Process of inserting an element in stack is called ____________
1.Create
2.Push
3.Evaluation
4.Pop
What are the disadvantages of arrays?
1.Data structure like queue or stack cannot be implemented
2.There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
3.Index value of an array can be negative
4.Elements are sequentially accessed
What is the output of the following Java code? public class array { public static void main(String args[]) { int []arr = {1 2 3 4 5} System.out.println(arr[5]) } }
1.4
2.5
3.ArrayIndexOutOfBoundsException
4. InavlidInputException
What is the result of the following operation? Top (Push (S X))
1.X
2.X+S
3.S
4.XS
What is the value of the postfix expression 6 3 2 4 + � *?
1.1
2.40
3.74
4.-18
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?
1.O(1)
2.O(n)
3.?(n)
4.?(1)
What would be the asymptotic time complexity to find an element in the linked list?
1.O(1)
2.O(n)
3.O(n2)
4.O(n4)
What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)?
1.O(1)
2.O(n)
3.O(n2)
4.O(n3)
When does the ArrayIndexOutOfBoundsException occur?
1. Compile-time
2.Run-time
3.Not an error
4.Not an exception at all
Which data structure is used for implementing recursion?
1.Queue
2.Stack
3.Array
4.List
Which of the following c code is used to create new node?
1.ptr = (NODE*)malloc(sizeof(NODE))
2.ptr = (NODE*)malloc(NODE)
3.ptr = (NODE*)malloc(sizeof(NODE*))
4.ptr = (NODE)malloc(sizeof(NODE))
Which of the following concepts make extensive use of arrays?
1.Binary trees
2.Scheduling of processes
3.Caching
4.Spatial locality
Which of the following is not an inherent application of stack?
1.Reversing a string
2.Evaluation of postfix expression
3.Implementation of recursion
4.Job scheduling
Which of the following is not the application of stack?
1.A parentheses balancing program
2.Tracking of local variables at run time
3.Compiler Syntax Analyzer
4.Data Transfer between two asynchronous process
Which of the following is the correct way to declare a multidimensional array in Java?
1. int[] arr
2.int arr[[]]
3.int[][]arr
4.int[[]] arr
Which of the following points is/are not true about Linked List data structure when it is compared with an 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.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?
1.Insertion Sort
2.Quick Sort
3.Heap Sort
4.Merge Sort
Which of the following statement(s) about stack data structure is/are NOT correct?
1.Linked List are used for implementing Stacks
2.Top of the Stack always contain the new node
3.Stack is the FIFO data structure
4.Null link is present in the last node at the bottom of the stack