0

I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong.

Questions are multiple choice questions

Difficulty scale of question is 1-10, 1 being the easiest and 10 being the hardest.

If two continuous questions are answered wrong, decrease the difficulty by 1 and if two questions answered right increase the difficulty by 1.

Test starts with a question of difficulty level of 4.

Question carries marks equal to its difficulty.

My question is Which the data structure should I use to store the questions, and best algorithms to fetch the question by its difficulty, etc. ?

Currently what I'm thinking is I'll be having a double link-list

struct node {

int data;

node *prev;

node *next;

int n

int MAX;

};

here 2 n's we need to store... one is MAX (actual size) and n is possible random size to pick questions from n - MAX we selected already for each double linked list you can add extra int data where u can store prev link, next link, pointer to array, int Maxdata(MAX size), int n(current size)

Each node is a pointer to array where list of questions for each level.if answer correct it moves next node and pick the random questions from that list else move to previous node and pick question

For eg- lets an array is having 10 questions 1 - 10. so array size is n = 10 you know that .now you selected a random question rand() % 10 = 6 th questions .now swap the question number 6 & 10, make n-- and return the 6th question .now n = 9 so next time 10th will not be considered .random will return 1 - 9 only

Is there any better way of doing it?

0

0

Browse other questions tagged or ask your own question.