Array and Stack Operation MCQs


 Q1. Which of these best describes an array?. 
A. A data structure that shows a hierarchical behavior. 
B. Container of objects of similar types. 
C. Container of objects of mixed types. 
D. All of the mentioned. 
Answer= Container of objects of similar types

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

Q3. How do you instantiate an array in Java?. 
A. int arr[] = new int(3);. 
B. int arr[];. 
C. int arr[] = new int[3];. 
D. int arr() = new int(3);. 
Answer= int arr[] = new int[3];

Q4. Which of the following is a correct way to declare a multidimensional array in Java?. 
A. int[][] arr;. 
B. int arr[][];. 
C. int []arr[];. 
D. All of the mentioned. 
Answer= All of the mentioned

Q5. When does the ArrayIndexOutOfBoundsException occur?. 
A. Compile-time. 
B. Run-time. 
C. Not an error. 
D. None of the mentioned. 
Answer= Run-time

Q6. Which of the following concepts make extensive use of arrays?. 
A. Binary trees. 
B. Scheduling of processes. 
C. Caching. 
D. Spatial locality. 
Answer= Spatial locality

Q7. What are the advantages of arrays?. 
A. Easier to store elements of same data type. 
B. Used to implement other data structures like stack and Que. 
C. Convenient way to represent matrices as a 2D array. 
D. All of the mentioned. 
Answer= All of the mentioned

Q8. What are the disadvantages of arrays?. 
A. We must know before hand how many elements will be there in the array. 
B. There are chances of wastage of memory space if elements inserted in an array are lesser than than the allocated size. 
C. Insertion and deletion becomes tedious. 
D. All of the mentioned. 
Answer= All of the mentioned

Q9. Assuming int is of 4bytes, what is the size of int arr[15];?. 
A. 15. 
B. 19. 
C. 11. 
D. 60. 
Answer= 60

Q10. Process of inserting an element in stack is called ____________. 
A. Create. 
B. Push. 
C. Evaluation. 
D. Pop. 
Answer= Push

Q11. Process of removing an element from stack is called __________. 
A. Create. 
B. Push. 
C. Evaluation. 
D. Pod. 
Answer= Pod

Q12. In a stack, if a user tries to remove an element from empty stack it is called _________. 
A. Underflow. 
B. Empty collection. 
C. Overflow. 
D. Garbage Collection. 
Answer= Underflow

Q13. Pushing an element into stack already having five elements and stack size of 5 , then stack becomes. 
A. Overflow. 
B. Crash. 
C. Underflow. 
D. User flow. 
Answer= Overflow

Q14. Entries in a stack are "ordered". What is the meaning of this statement?. 
A. A collection of stacks is sortable. 
B. Stack entries may be compared with the '<' operation. 
C. The entries are stored in a linked list. 
D. There is a SeQntial entry that is one by one. 
Answer= There is a SeQntial entry that is one by one

Q15. Which of the following applications may use a stack?. 
A. A parentheses balancing program. 
B. Tracking of local variables at run time. 
C. Compiler Syntax Analyzer. 
D. All of the mentioned. 
Answer= All of the mentioned

Q16. Consider the usual algorithm for determining whether a seQnce of parentheses is balanced.The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(())) are:. 
A. 1. 
B. 2. 
C. 3. 
D. 4 or more. 
Answer= 3

Q17. Consider the usual algorithm for determining whether a seQnce of parentheses is balanced.Suppose that you run the algorithm on a seQnce 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. 1. 
B. 2. 
C. 3. 
D. 4 or more. 
Answer= 2

Q18. What is the value of the postfix expression 6 3 2 4 + - *:. 
A. Something between -5 and -15. 
B. Something between 5 and -5. 
C. Something between 5 and 15. 
D. Something between 15 and 100. 
Answer= Something between 15 and 100

Q19. 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?. 
A. 1. 
B. 2. 
C. 3. 
D. 4. 
Answer= 4

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

Q21. The data structure required to check whether an expression contains balanced parenthesis is?. 
A. Stack. 
B. 
Que. 
C. Array. 
D. Tree. 
Answer= Stack

Q22. What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?. 
A. Linked List. 
B. Stack. 
C. 
Que. 
D. Tree. 
Answer= Stack

Q23. The process of accessing data stored in a serial access memory is similar to manipulating data on a ________. 
A. Heap. 
B. Binary Tree. 
C. Array. 
D. Stack. 
Answer= Stack

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

Q25. Which data structure is needed to convert infix notation to postfix notation?. 
A. Branch. 
B. Tree. 
C. 
Que. 
D. Stack. 
Answer= Stack

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

Q27. What is the result of the following operationTop (Push (S, X)). 
A. X. 
B. Null. 
C. S. 
D. None of the mentioned. 
Answer= X

Q28. The prefix form of an infix expression p + q - r * t is?. 
A. "+ pq - *rt". 
B. "- +pqr * t". 
C. "- +pq * rt". 
D. - + * pqrt. 
Answer= "- +pq * rt"

Q29. Which data structure is used for implementing recursion?. 
A. 
Que. 
B. Stack. 
C. Array. 
D. List. 
Answer= Stack

Q30. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?. 
A. 600. 
B. 350. 
C. 650. 
D. 588. 
Answer= 350

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

Q32. 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 are. 
A. 1. 
B. 2. 
C. 3. 
D. 4. 
Answer= 1

Q33. Which of the following is not an inherent application of stack?. 
A. Reversing a string. 
B. Evaluation of postfix expression. 
C. Implementation of recursion. 
D. Job scheduling. 
Answer= Job scheduling

Q34. The type of expression in which operator succeeds its operands is?. 
A. Infix Expression. 
B. Prefix Expression. 
C. Postfix Expression. 
D. None of the mentioned. 
Answer= Postfix Expression

Q35. 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. 
A. abc X+ def ^^ -. 
B. abc X+ de^f^ -. 
C. ab+c Xd - e ^f^. 
D. -+aXbc^ ^def. 
Answer= abc X+ def ^^ -

Q36. 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?. 
A. ABCD. 
B. DCBA. 
C. DCAB. 
D. ABDC. 
Answer= DCBA

Previous Post Next Post