Mascot Previous Years Solved Sample Placement Papers
- Example for infix expression
a) +ab
b) a+b
c) ab+
d) none
Answer: b) a+b - The condition top=-1 in stack indicates
a) stack is full
b) stack has one element
c) stack overflow
d) stack is empty
Answer: d) stack is empty - Which condition indicates queue is empty
a) front=null
b) rear=N
c) front=rear
d) both a and b
Answer: c) front=rear - Which condition indicates only one element in queue
a) front=null
b) rear=N
c) front=rare
d) rear=N-1
Answer: c) front=rare - Inheritance occurs when a class adopts all the traits of ________
A) an object
B) a parent class
C) a variable
D) a function
Ans: B) a parent class - Encapsulation means____________
A) Binding of data and code together
B) To inherit properties of base class
C) To reduce code length
D) To define global variable
Ans: A) Binding of data and code together - To derive new class from existing class is known as ________
A) Inheritance
B) Polymorphism
C) Object
D) None of these
Ans: A) Inheritance - Which of the following statement is correct?
A) Class is an instance of object.
B) Object is an instance of a class.
C) Class is an instance of data type.
D) Object is an instance of data type
Ans: B) Object is an instance of a class. - An object consists of -----
A) State
B) Behavior
C) Both A and B
D) None of these
Ans: C) Both A and B - Which of the following provides a reuse mechanism?
A) Inheritance
B) Polymorphism
C) Abstraction
D) Encapsulation
Ans: A) Inheritance - Which of the following is correct about class and structure?
A) Class can have member functions while structure cannot
B) Class data members are public by default while that of structure are private
C) Pointer to structure or classes cannot be declared.
D) Class data members are private by default while that of structure are public by default.
Ans: D) Class data members are private by default while that of structure are public by default. - The major goal of inheritance in c++ is:
A) To facilitate the conversion of data types.
B) To help modular programming.
C) To extend the capabilities of a class.
D) To hide the details of base class.
Ans: C) To extend the capabilities of a class. - Class is __________
A) Built in data type
B) User defined data type
C) Both a& b
D) None of these
Ans: B) User defined data type -
What would be the Prefix notation for the given equation?
A+(B*C)
(a) +A*CB
(b) *B+AC
(c) +A*BC
(d) *A+CB
Answer: (c)
Explanation: Reverse the equation or scan from right to left. Apply the infix-to-postfix algorithm. Inside the brackets, the result isCB*
, and outside the brackets, it isA+
. Reversing gives+A*BC
. -
What would be the Prefix notation for the given equation?
(A*B)+(C*D)
(a) +*AB*CD
(b) *+AB*CD
(c) **AB+CD
(d) +*BA*CD
Answer: (a)
Explanation: Reverse the equation or scan from right to left. Apply the infix-to-postfix algorithm. Brackets evaluate toDC*
andBA*
, resulting in+*AB*CD
after reversal. -
What would be the Prefix notation for the given equation?
A+B*C^D
(a) +A*B^CD
(b) +A^B*CD
(c) *A+B^CD
(d) ^A*B+CD
Answer: (a)
Explanation: Reverse the equation or scan from right to left. Apply the infix-to-prefix algorithm. The order of precedence is+*
and^
. The reversed expression evaluates to+A*B^CD
. -
Out of the following operators (
^
,*
,+
,&
,$
), the one having the highest priority is?
(a) +
(b) $
(c) ^
(d) &
Answer: (c)
Explanation: According to the infix-to-prefix algorithm, exponentiation (^
) has the highest priority among the given operators. -
Out of the following operators (
|
,*
,+
,&
,$
), the one having the lowest priority is?
(a) +
(b) $
(c) |
(d) &
Answer: (c)
Explanation: Logical OR (|
) has the lowest precedence among the given operators, as defined in the infix-to-prefix algorithm. -
What would be the Prefix notation for the given equation?
A^B^C^D
(a) ^^^ABCD
(b) ^A^B^CD
(c) ABCD^^^
(d) AB^C^D
Answer: (a)
Explanation: Reverse the equation or scan from right to left. The exponentiation operator has right-to-left associativity, so all operators are pushed onto the stack, resulting in^^^ABCD
.