--:--









Quiz for Macros with arguments

Course: C Language | Subject: Unit 9 | Topic: Preprocessor Directives



Logo

Q1: What is the correct way to define a macro with arguments?

Logo

Q2: How does the macro #define MAX(a,b) ((a) > (b) ? (a) : (b)) work?

Logo

Q3: Which operator is used in macros to concatenate two tokens?

Logo

Q4: What happens if you use a macro argument without parentheses?

Logo

Q5: Can macros with arguments be recursive?

Logo

Q6: What is the output of this macro call: #define INC(x) ((x)+1) INC(2*3)?

Logo

Q7: Why is it important to put parentheses around macro arguments?

Logo

Q8: How do you stringify a macro argument?

Logo

Q9: Which directive is used to create macros that generate string literals from arguments?

Logo

Q10: What will happen if you call a macro with fewer arguments than defined?

Logo

Q11: Can you use macros with arguments in conditional compilation?

Logo

Q12: What is the effect of using the ## operator in macros?

Logo

Q13: How would you correctly define a macro to swap two variables?

Logo

Q14: What is a disadvantage of using macros with arguments?

Logo

Q15: What happens when you use side-effects in macro arguments, e.g., INC(i++)?

Logo

Q16: Can macros with arguments replace functions?

Logo

Q17: Which is better: macros with arguments or inline functions?

Logo

Q18: How do you prevent multiple evaluations of macro arguments?

Logo

Q19: What will be the result of the macro expansion: #define ADD(a,b) a+b; ADD(2,3)*4

Are you ready to start test? Set your time limit