Compilers Questions and Answers – Implementation of Increment and Decrement – 2

This set of Compilers Questions and Answers for Aptitude test focuses on “Implementation of Increment and Decrement – 2”.

1. In C programming language, which of the following type of operators have the highest precedence?
a) Relational Operators
b) Equality Operators
c) Logical Operators
d) Arithmetic Operators
View Answer

Answer: d
Explanation: No other operator has higher precedence than arithmetic operator.

2. Which of the following operators has the highest precedence?
a) Unary +
b) *
c) >=
d) ==
View Answer

Answer: a
Explanation: Unary operators have max precedence in over all other arithmetic operators.

3. If i=1 j=2,k=3, then what is the value of the following expression?

advertisement
advertisement
!((j + k) > (i + 5))

a) 6
b) 5
c) 1
d) 0
View Answer

Answer: c
Explanation: !((2+3)>(1+5))
!(5>6)
Since the condition is false hence !(0)
And complement of 0 is 1.

4. The expression 5 – 2 – 3 * 5 – 2 will evaluate to 18, if – is left associative and _____________
a) * has precedence over *
b) * has precedence over –
c) – has precedence over *
d) – has precedence over –
View Answer

Answer: c
Explanation: if – has precedence over* and if it associates from the right.

5. Coercion _____________
a) Takes place over an assignment operator
b) Operator has operands of various types
c) None of the mentioned
d) Takes place over an assignment operator & Operator has operands of various types
View Answer

Answer: d
Explanation: Conversion between compatible types.
advertisement

6. Choose the correct statement.
a) Expressions evaluated at compile time
b) String constants concatenated at compile time
c) None of the mentioned
d) Both of the mentioned
View Answer

Answer: d
Explanation: The statements are true.

7. Which of the following operators takes only integer operands?
a) +
b) *
c) /
d) %
View Answer

Answer: d
Explanation: Two integers are taken to be input.
advertisement

8. Pick the operators that associate from the left.
a) +
b) ,
c) <
d) All of the mentioned
View Answer

Answer: d
Explanation: They are left associative.

9. Pick the operators that associate from the right.
a) ?:
b) +=
c) =
d) All of the mentioned
View Answer

Answer: d
Explanation: They are right associative.

10. Pick the operators that associate from left to right.
a) &&
b) ?:
c) ,
d) All of the mentioned
View Answer

Answer: d
Explanation: They left to right associative.

Sanfoundry Global Education & Learning Series – Compilers.

To practice all areas of Compilers for Aptitude test, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.