/// <summary>
        /// It evaluates the responses provided by the student with the responses given by a instructor to grade a test using two separate XMLs.
        /// MCQs and Fill in the blanks type of questions are graded by comparing the responses, while Essay question is graded based on the 
        /// number of keywords or their synonyms used, grammatical errors, spellcheck, word limit and paragraphs.
        /// </summary>
        private void CalculateMarks()
        {
            XmlSerializer ser = new XmlSerializer(typeof(Test));

            finalTest = ser.Deserialize(new FileStream("D:\\test.xml", FileMode.Open)) as Test;
            totalQuestions = test.Question.Count();

            ser = new XmlSerializer(typeof(TestAnswers));

            finalTestAnswer = ser.Deserialize(new FileStream("D:\\StudentResponse.xml", FileMode.Open)) as TestAnswers;
            List<TestQuestion> quesList = new List<TestQuestion>();
            for (int i = 0; i < totalQuestions; i++)
            {
                quesList.Add(finalTest.Question[i]);
            }

            int j = 0;
            double essayMarks = 100.0f;
            foreach (var question in quesList)
            {
                if (question.Type == QuesTypeVal.MCQ.ToString())
                {
                    if (question.Option1.Answer == "Yes" && question.Option1.Value == finalTestAnswer.Answer[j].Value)
                    {
                        marks += 5;
                    }
                    else if (question.Option2.Answer == "Yes" && question.Option2.Value == finalTestAnswer.Answer[j].Value)
                    {
                        marks += 5;
                    }
                    else if (question.Option3.Answer == "Yes" && question.Option3.Value == finalTestAnswer.Answer[j].Value)
                    {
                        marks += 5;
                    }
                    else if (question.Option4.Answer == "Yes" && question.Option4.Value == finalTestAnswer.Answer[j].Value)
                    {
                        marks += 5;
                    }
                    j++;
                }
                else if (question.Type == QuesTypeVal.Text.ToString())
                {
                    if (question.Answer.Text == finalTestAnswer.Answer[j].Value)
                    {
                        marks += 5;
                    }
                    j++;
                }
                else if (question.Type == QuesTypeVal.EssayText.ToString())
                {
                    string essayResponse = finalTestAnswer.Answer[j].Value;
                    int nKeyword = question.Answer.Keyword.Count();                    
                    double keywordMark = 40.0 / (double)nKeyword;
                    int checkSynonym = 0;
                    double wordMarks = 0.0f;
                    List<string> essayList = new List<string>();
                    var essayString = Regex.Split(essayResponse, @"[\n]+");
                    int noParagraphs = essayString.Count();
                    bool nParaCorrect = false;
                    for (int i = 0; i < noParagraphs; i++)
                    {
                        if (essayString[i] != string.Empty)
                            essayList.Add(essayString[i]);
                    }
                    if (essayList.Count() != question.NumberOfParagraphs)
                    {
                        essayMarks = 20;
                    }
                    else
                    {
                        List<string> wordList = new List<string>();
                        foreach (string essayPara in essayList)
                        {
                            var s = Regex.Split(essayPara, @"[,\s\n]+");
                            foreach (string k in s)
                            {
                                wordList.Add(k);
                            }
                        }
                        if (wordList.Count >= question.TotalNumberOfWords)
                        {
                            essayMarks = 20;
                        }
                        else
                        {
                            bool grammarCheck = true;
                            Microsoft.Office.Interop.Word.Application myWord = new Microsoft.Office.Interop.Word.Application();
                            foreach (string essay in essayList)
                            {
                                grammarCheck = myWord.CheckGrammar(essay);
                                if (!grammarCheck)
                                {
                                    essayMarks -= 5;
                                }
                            }

                            wordMarks = 40.0 / (double)wordList.Count();
                            foreach (string word in wordList)
                            {
                                using (Hunspell hunspell = new Hunspell("en_us.aff", "en_us.dic"))
                                {
                                    if (!hunspell.Spell(word))
                                    {
                                        essayMarks -= wordMarks;
                                    }
                                }
                            }

                            bool keyPresent = false;
                            for (int i = 0; i < nKeyword; i++)
                            {
                                if (!essayResponse.Contains(question.Answer.Keyword[i]))
                                {
                                    List<string> stringArr = new List<string>();
                                    stringArr.Add(question.Answer.Keyword[i]);
                                    SynonymInfo theSynonyms = myWord.SynonymInfo[question.Answer.Keyword[i]];
                                    foreach (var Meaning in theSynonyms.MeaningList as Array)
                                    {
                                        if (stringArr.Contains(Meaning) == false) stringArr.Add((string)Meaning);
                                    }
                                    for (int ii = 0; ii < stringArr.Count; ii++)
                                    {
                                        theSynonyms = myWord.SynonymInfo[stringArr[ii]];
                                        foreach (string Meaning in theSynonyms.MeaningList as Array)
                                        {
                                            if (stringArr.Contains(Meaning)) continue;
                                            stringArr.Add(Meaning);
                                        }
                                        if (stringArr.Count >= 10)
                                        {
                                            stringArr.ToArray();
                                            break;
                                        }
                                    }
                                    foreach (string key in stringArr)
                                    {
                                        if (essayResponse.Contains(key))
                                        {
                                            keyPresent = true;
                                        }
                                    }
                                    if (!keyPresent)
                                    {
                                        essayMarks -= keywordMark;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            marks += essayMarks;
        }