using System.Collections.Generic;
public string[] answers = new string[4];
public class TriviaProgram
public static void Main(string[] args)
Console.WriteLine("Enter you name: ");
string name = Console.ReadLine();
Console.WriteLine($"Greetings, {name} we are going to play a Trivia game today!Are you excited? \n\nThere will be 5 questions. Please provide answer for each question by entering a / b / c / d and pressing 'Enter' key.\nLet's go!");
string pathToFile = @"questions.txt";
if (File.Exists(pathToFile))
string[] lines = File.ReadAllLines(pathToFile);
List<Question> questions = new List<Question>();
for (int i = 0; i < lines.Length; i = i + 5)
Question ques = new Question();
ques.question = lines[i];
for (int j = 0; j < 4; j++)
ques.answers[j] = lines[i + j + 1];
Console.WriteLine("Could not find file " + pathToFile);
private static void SaveFile()
var text = @"Which of the following keyword is used for including the namespaces in the program in C#?
What is not a loop operator?
How does Array differ from List<>?
Array is resizable and List<> is not
Array can contain objects of different types while List<> can't
Array is a value type while List<> is a reference type
How many iterations will the following code produce? for(int i = -1; i <= i; i++) { i = 0; }
Class can have multiple constructors
depends if class inherits another class
A Visual Studio is required to compile a C# program
Visual Studio or Visual Studio code
it depends on the program
A method name must be unique
Object Oriented Programming
Object Omitting Programming
This is a correct relative path
Custom exception class must inherit base exception class named
File.WriteAllText("questions.txt", text);