0
0
C Sharp (C#)programming~10 mins

Named arguments in C Sharp (C#) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to call the method using a named argument for 'age'.

C Sharp (C#)
PrintPersonInfo(name: "Alice", [1]: 30);
Drag options to blanks, or click blank then click option'
Ainfo
Bname
Cage
Dperson
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong parameter name like 'info' or 'person'.
Forgetting to use the parameter name before the value.
2fill in blank
medium

Complete the method call using named arguments for both parameters.

C Sharp (C#)
DisplayMessage([1]: "Hello", [2]: 5);
Drag options to blanks, or click blank then click option'
Atext
Bcount
Cmessage
Dnumber
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping parameter names or using incorrect names.
Omitting parameter names when required.
3fill in blank
hard

Fix the error by using the correct named argument in the method call.

C Sharp (C#)
CalculateArea(width: 10, [1]: 5);
Drag options to blanks, or click blank then click option'
Asize
Bheight
Cdepth
Dlength
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'length' or 'depth' instead of 'height'.
Not matching the parameter names exactly.
4fill in blank
hard

Fill both blanks to call the method with named arguments in any order.

C Sharp (C#)
SetUserDetails([1]: "John", [2]: 25);
Drag options to blanks, or click blank then click option'
Aage
Bname
Cusername
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like 'username' or 'score'.
Mixing up the order without using named arguments.
5fill in blank
hard

Fill all three blanks to call the method with named arguments correctly.

C Sharp (C#)
CreateAccount([1]: "user123", [2]: "pass456", [3]: "user@example.com");
Drag options to blanks, or click blank then click option'
Ausername
Bpassword
Cemail
Daddress
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong parameter names like 'address'.
Forgetting to use named arguments for clarity.