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

LinkedList usage 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 create a new LinkedList of integers.

C Sharp (C#)
LinkedList<int> numbers = new LinkedList<int>[1];
Drag options to blanks, or click blank then click option'
A()
B[]
C{}
D<>
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of parentheses.
Using curly braces which are for collection initializers.
Using angle brackets which are for generics.
2fill in blank
medium

Complete the code to add the value 10 at the end of the LinkedList.

C Sharp (C#)
numbers.[1](10);
Drag options to blanks, or click blank then click option'
AAddLast
BAddAfter
CAddFirst
DAddBefore
Attempts:
3 left
💡 Hint
Common Mistakes
Using AddFirst which adds at the start.
Using AddAfter or AddBefore without a reference node.
3fill in blank
hard

Fix the error in the code to remove the first element from the LinkedList.

C Sharp (C#)
numbers.[1]();
Drag options to blanks, or click blank then click option'
ADeleteFirst
BRemoveLast
CRemoveAt
DRemoveFirst
Attempts:
3 left
💡 Hint
Common Mistakes
Using RemoveLast which removes the last element.
Using RemoveAt which does not exist for LinkedList.
Using DeleteFirst which is not a valid method.
4fill in blank
hard

Fill both blanks to check if the LinkedList contains the value 5 and then add it if not present.

C Sharp (C#)
if (!numbers.[1](5)) {
    numbers.[2](5);
}
Drag options to blanks, or click blank then click option'
AContains
BAddLast
CAddFirst
DRemove
Attempts:
3 left
💡 Hint
Common Mistakes
Using Remove instead of Contains for checking.
Adding with AddFirst instead of AddLast.
5fill in blank
hard

Fill all three blanks to create a LinkedList of strings, add "hello" at the start, and then remove "world".

C Sharp (C#)
LinkedList<string> words = new LinkedList<string>[1];
words.[2]("hello");
words.[3]("world");
Drag options to blanks, or click blank then click option'
A()
BAddFirst
CRemove
DAddLast
Attempts:
3 left
💡 Hint
Common Mistakes
Using AddLast instead of AddFirst for adding "hello".
Using RemoveFirst or RemoveLast instead of Remove with a value.