# Is there an easier way

• ### Question

• User-1274246664 posted

I am grading a quiz and finding what answer(s) were missed.  I need to display the question number and the missed answer in lower case as the result.

I have the following:

two sting on is the answers the other is a student selected values there are 54 elements in each string I want to compare the Answer key to the quiz element by element  starting at the 4th element to the  end.

The results should be the quiz (answered value) and the position  or quiz question number so the result  should look  like this  "4x,5a,6b,13b,23b

[position][Quiz Missed Question]

my code is listed below however I was wondering if LINQ .except or .union  or .intersect would be a lot easier, any suggestions?

```void Main()
{
var Answer = "17519,  ,  , ,A,B,D,A,D,B,A,C,B,A,C,D,B,D,B,D,D,B,A,D,D,B,B,A,B,A,D,C,B,C,C,B,A,A,C,A,D,B,C,C,A,D,A,D,A,B,B,B,A,B".Split(',').ToArray();
var Quiz   = "17519,Test,Person,middle,x,A,B,A,D,B,A,C,B,B,C,D,B,D,B,D,D,B,A,B,D,B,B,A,B,A,D,C,B,C,C,B,A,A,C,A,D,B,C,C,A,D,A,D,A,B,B,B,A,B".Split(',').ToArray();

MissedQuestionList.Dump();
}

{
List<string> missedQuestions = new List<string>();

try
{
for( int x = 4; x<=answer.Count()-1;x++)
{
{
}
}

return(missedQuestions);
}
catch (Exception ex)
{
throw;
}

}```

Wednesday, December 20, 2017 11:55 PM

• User2103319870 posted

I was wondering if LINQ .except or .union  or .intersect would be a lot easier, any suggestions

You can try with below code.

``` var Answer = "17519,  ,  , ,A,B,D,A,D,B,A,C,B,A,C,D,B,D,B,D,D,B,A,D,D,B,B,A,B,A,D,C,B,C,C,B,A,A,C,A,D,B,C,C,A,D,A,D,A,B,B,B,A,B".Split(',').ToArray();
var Quiz = "17519,Test,Person,middle,x,A,B,A,D,B,A,C,B,B,C,D,B,D,B,D,D,B,A,B,D,B,B,A,B,A,D,C,B,C,C,B,A,A,C,A,D,B,C,C,A,D,A,D,A,B,B,B,A,B".Split(',').ToArray();

List<string> differentvalues = Answer.Select((item, index) => new { item, index })
.Where(x => x.item != Quiz[x.index])
.Select(x => String.Format("{0}{1},", x.index, Quiz[x.index].ToLower()))
.ToList();