我如何设计测验问题papaer [英] How I can design the quiz question papaer

查看:79
本文介绍了我如何设计测验问题papaer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要这个代码在c#

我需要设计测验测试。

其中我可以从DataBase中回答问题,其中总共有500个问题,但是我想每次随机抽取500个问题500个&每次都会显示新问题



我尝试过:



我的问题表包含以下列:

qid表示问题ID

sid表示主题ID

问题

ans1表示选项1

ans2表示选项2

ans3表示选项3

ans4表示选项4

罐表示正确的ans

I need this code in c#
I need the designing of quiz test .
in which i can retrive the questions from DataBase where total 500 questions are present, but i want to retrive 60 question out of 500 randomly each time & also new questions display each time

What I have tried:

My Questions table contains the following columns:
qid mean question id
sid mean subject id
question
ans1 means option1
ans2 means option2
ans3 means option3
ans4 means option4
cans means correct ans

推荐答案

这很复杂,因为这里存在两个相互矛盾的约束:随机性和缺乏重复。

你可以从数据库中做随机性:

That's complex, because there are two conflicting constraints here: randomness and lack of repetition.
You can do randomness from a DB:
SELECT TOP 60 * FROM MyTable
ORDER BY NEWID()



缺少重复这是一个问题。

我的方式它是一个使用国家t每行显示一个问题,并从C#中更新它。然后按使用次数使用SELECT to ORDER,然后使用NEWID:


It's the lack of repetition that's a problem.
The way I'd do it is to keep a usage count with each row, and UPDATE it from your C# each time you display a question. Then use the SELECT to ORDER by the usage count and then NEWID:

SELECT TOP 60 * FROM MyTable
ORDER BY UseCount, NEWID()

这样,最老的问题以随机顺序返回。

That way, the oldest question are returned, in a random order.


这篇关于我如何设计测验问题papaer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆