# Cpp Programming 20

IT Interview Exam Questions: Cpp Programming 20 (IT Interview Exam Question, IT Campus Placement)

Subject: Cpp Programming 20

Part 20: List for questions and answers of C ++ Language

Q1. The data structure required to evaluate a postfix expression is

a) Queue

b) Stack

c) Array

Q2. The postfix form of the expression (A+B)*(C*D-E)*F/G is

a) AB+CD * EFG/**

b) AB+CD * EF**G/

c) AB+CD * E*F*G/

d) AB+CDE* *F*G/

Q3. What is the postfix form of the following prefix expression -A/B*C\$DE

a) ABCDE\$*/-

b) A-BCDE\$*/-

c) ABC\$ED*/-

d) A-BCDE\$*/

Q4. The data structure required to check whether an expression contains balanced parenthesis is

a) Stack

b) Queue

c) Tree

d) Array

Q5. The postfix form of A*B+C/D is

a) *AB/CD+

b) AB*CD/+

c) A*BC+/D

d) ABCD+/ *

Q6. Which of the following types of expressions does not require precedence rule when evaluated?

a) Full parenthesized infix expression

b) Prefix expression

c) Partially parenthesized infix expression

d) More than one of these

Q7. The five items:A,B,C,D, and E are pushed in a stack, one after the other starting from A.The stack is popped four times and each element is inserted in a queue.Then two elements are deleted from the queue and pushed back on the stack.Now one item is popped from the stack. The popped item is

a) E

b) B

c) C

d) D

Q8. If memory for the run-time stack is only 150 cells(words), how big can N be in Factorial(N) before encounterring stack overflow?

a) 24

b) 12

c) 26

d) 50

Q9. Following sequence of operations is performed on a stack push(1),push(2),pop, push(1),push(2)pop,pop,pop,push(2),pop.The sequence of poped out values are

a) 2,2,1,1,2

b) 2,2,1,2,2

c) 2,1,2,2,1

d) 2,1,2,2,2

Q10. In eveluating the arithmetic expression 2*3-(4+5),using stacks to evaluate its equivalent postfix form, which of the following stack configuration is not possible?

a) 4 6

b) 5 4 6

c) 9 6

d) 9 3 2

Q11. Stack A has the entries a,b,c(with a on top).Stack B is empty.An entry popped out of stack A can be printed immediately or pushed to stack B.An entry popped out of the stack B can only be printed. In this arrangement, which of the following permutations of a,b,c are not possible?

a) b a c

b) b c a

c) c a b

d) c b a

Q12. The expression which accesses the (ij)th entry of am x n matrix stored in column majorform is

a) n x (i-1)+j

b) m x (j-1)+i

c) vm x (n-j)+j

d) n x (m-i)+j

Q13. Stack can’t be used to

a) Evaluate an arithmetic expression in postfix form

b) Implement recursion

c) Convert a given arithmetic expression in infix form to its evaluate postfix form

d) Allocate resources(like CPU)by the operating system

Q14. Which of the following permutations can be obtained in the output(in the same order),using a stack assuming that the input is the sequence 1,2,3,4,5 in that order?

a) 3,4,5,1,2

b) 3,4,5,2,1

c) 1,5,2,3,4

d) none of these

Q15. Stack is useful for implementing

c) Recursion

d) None of these

Q16. 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 sequenceof popped out values are

a) 2, 2, 1, 1, 2

b) 2, 2, 1, 2, 2

c) 2, 1, 2, 2, 1

d) 2, 1, 2, 2, 2

Q17. Stack A has the eintries a, b, c (with a on top), Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of stack B can only be printed. In the arrangement, which of the following permutations of a, b, c is not possible?

a) b a c

b) b c a

c) c a b

d) a b c

Q18. Which of the following is not a type of constructor?

a) Copy constructor

b) Friend constructor

c) Default constructor

d) Parameterized constructor

Q19. Which of the following concepts means determining at runtime what method to invoke?

a) Data hiding

b) Dynamic Typing

c) Dynamic binding

Q20. The postfix equivalent of the prefix * + a b – c d is

a) ab+cd-*

b) ab cd + – *

c) ab + cd * –

d) ab + – cd *

Part 20: List for questions and answers of C ++ Language