Skip to content
CodeKruPro

*args, **kwargs and keyword-only parameters

QuizEasy-MediumPython onlyAsked in: TCS

Given this function, which statements are true? Pick all that apply.

def f(a, b=2, *args, c, d=4, **kwargs):
    return (a, b, args, c, d, kwargs)
  • f(1, c=3) returns (1, 2, (), 3, 4, {})
  • f(1, 5, 6, 7, c=8, e=9) returns (1, 5, (6, 7), 8, 4, {'e': 9})
  • f(1, 2, 3) sets c to 3
  • args is a list

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in