Question: ? ? * * * * Consumes a question and a potential answer, and returns whether or not the answer is valid ( but not
Consumes a question and a potential "answer", and returns whether or not
the "answer" is valid but not necessarily correct For a "shortanswerquestion",
any answer is valid. But for a 'multiplechoicequestion', the "answer" must
be exactly one of the options.
export function isValidquestion: Question, answer: string: boolean
ifquestiontype "shortanswerquestion"
return true;
else ifquestiontype "multiplechoicequestion" && Option
const trimmedAnswer answer.trimtolowerCase;
return Option.mapOption Option.trimtoLowerCase includestrimmedAnswer;
else
return false;
Consumes a question and produces a string representation combining the
id and first characters of the "name". The two strings should be
separated by : So for example, the question with id and the
name My First Question" would become : My First Q
export function toShortFormquestion: Question: string
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
