Table of Contents

Class McqData

Namespace
WitShells.McqUI

Data structure containing a multiple choice question with correct and incorrect options

[Serializable]
public class McqData
Inheritance
McqData
Inherited Members

Constructors

McqData()

public McqData()

McqData(string, string, string[], bool?, float)

Create a new MCQ data with question, correct answer, and wrong options

public McqData(string question, string correctAnswer, string[] wrongOptions, bool? shuffleOptions = null, float timeLimit = -1)

Parameters

question string

The question text

correctAnswer string

The correct answer

wrongOptions string[]

Array of incorrect options

shuffleOptions bool?

Whether to shuffle options when displayed (uses global setting if null)

timeLimit float

Time limit in seconds (uses global setting if negative)

Properties

AllOptions

All options combined (correct + wrong) in display order

public List<string> AllOptions { get; }

Property Value

List<string>

CorrectAnswer

The correct answer for this question

public string CorrectAnswer { get; }

Property Value

string

OptionCount

Total number of options available

public int OptionCount { get; }

Property Value

int

Question

The question text to display

public string Question { get; }

Property Value

string

ShuffleOptions

Whether to shuffle the order of options when displaying

public bool ShuffleOptions { get; }

Property Value

bool

TimeLimit

Time limit for answering in seconds (0 = no limit)

public float TimeLimit { get; }

Property Value

float

WrongOptions

Array of incorrect answer options

public string[] WrongOptions { get; }

Property Value

string[]

Methods

IsCorrectAnswer(string)

Check if a given answer is correct

public bool IsCorrectAnswer(string answer)

Parameters

answer string

The answer to check

Returns

bool

True if the answer matches the correct answer

IsValid()

Validate that the MCQ data is properly configured

public bool IsValid()

Returns

bool

True if valid, false otherwise