C Sharp (C#) - CollectionsWhich of the following is the correct syntax to remove the first occurrence of "apple" from a List named fruits?Afruits.RemoveAt("apple");Bfruits.Delete("apple");Cfruits.Remove("apple");Dfruits.RemoveItem("apple");Check Answer
Step-by-Step SolutionSolution:Step 1: Identify the correct method nameThe method to remove an item by value is Remove, so fruits.Remove("apple") is correct.Step 2: Check method parameters and usageRemoveAt requires an index, not a string. Delete and RemoveItem are not valid List methods.Final Answer:fruits.Remove("apple"); -> Option CQuick Check:Remove("apple") removes first matching item [OK]Quick Trick: Use Remove with the item value to delete it [OK]Common Mistakes:MISTAKESUsing RemoveAt with a string argumentUsing non-existent methods like Delete or RemoveItemConfusing Remove with Add
Master "Collections" in C Sharp (C#)9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Sharp (C#) Quizzes Classes and Objects - Object instantiation with new - Quiz 15hard File IO - Using statement with file streams - Quiz 8hard Inheritance - Sealed classes and methods - Quiz 3easy Inheritance - Is-a relationship mental model - Quiz 3easy Interfaces - Interface declaration syntax - Quiz 11easy LINQ Fundamentals - Aggregate functions (Count, Sum, Average) - Quiz 3easy LINQ Fundamentals - Select clause projection - Quiz 9hard Properties and Encapsulation - Get and set accessors - Quiz 5medium Strings and StringBuilder - String searching and extraction - Quiz 2easy Strings and StringBuilder - String interpolation and formatting - Quiz 14medium