🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: References and Functions: all 10 questions

Quiz: References and Functions · Question 10 of 10

Why is an inline function safer than a function-like macro such as define SQ(x) xx?

Why is an inline function safer than a function-like macro such as #define SQ(x) x*x?

  1. A.inline functions are always faster
  2. B.Arguments are type-checked and evaluated once, as in a normal function call
  3. C.Macros cannot take arguments
  4. D.inline functions are stored in a separate file
Answer & explanation

Correct answer: Arguments are type-checked and evaluated once, as in a normal function call

SQ(a+1) expands to a+1*a+1, and SQ(i++) increments twice; an inline function has neither problem.

Can you get the rest right without peeking?

Take the timed Quiz: References and Functions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →