qformat/csv

From MoodleDocs
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The CSV format is a very simple way of creating multiple choice questions using a CSV (Comma separated value) file. The first line of CSV file must contain the headers separated with commas.
Now, There can be two types of CSV files that can be used : ( Simple CSV and Extended CSV ).
Only diffrenece between Simple and Extended CSV files is, number of fields/columns
1. Simple CSV :
This one will have same fields what we used to have(only addition is question name in the field) All the other (except Header) rows/lines contain details about the one question ie. question name, question text, four option, and answer1 , answer2.

  • Each line will contain the details about the one question.
  • The simple CSV file used for import should have the following structure : -

A simple CSV file with all questions in comma separated value form with a .csv extension

  1. The first line contains the headers separated with commas for example questionname,questiontext,A,B,C,D,Answer 1,Answer 2
  2. Next lines contain the details of the question, each of the line contain one question name, question text, four option, and either one or two answers again all separated by commas.
  3. Each line contains all the details regarding the one question ie. question name, question text, options, and answer.
  4. You can also download the sample CSV(sample.csv) file for your reference

questionname,questiontext,A,B,C,D,Answer 1,Answer 2 question1,Which command is used to print a file,print,ptr,lpr,none of the mentioned,C, question2,The command “mknod myfifo b 4 16”,Will create a block device if user is root,Will create a block device for all users,Will create a FIFO if user is not root,"None ,of the mentioned",A,B question3,"3, 4, 7, 8, 11, 12, ... What number should come next?",7,10,14,15,D,

You can also see that the 'Answer 2' is optional as the first and third questions have only one answer, whereas the second question has two answers.

2. Extended CSV :
This CSV file will have extra fields like answernumbering, correctfeedback, partiallycorrectfeedback, incorrectfeedback and defaultmark.
All the other (except Header) rows/lines contain details about the one question ie. question name, question text, four option, answer1, answer2, answernumbering, correctfeedback, partiallycorrectfeedback, incorrectfeedback and defaultmark. file with many other options
The CSV file used for import should have the following structure : -

  • A CSV file with all questions in comma separated value form with a .csv extension.
  • The first line contains the headers separated with commas for example questionname,questiontext,A,B,C,D,Answer 1,Answer 2,answernumbering,correctfeedback,partiallycorrectfeedback,incorrectfeedback,defaultmark
  • Next lines contain the details of the question, each of line contain one question name, question text, four option, answer1, answer2, answernumbering, correctfeedback, partiallycorrectfeedback, incorrectfeedback and defaultmark, again all separated by commas.
  • Each line contains all the details regarding the one question ie. question name, question text, four option, answer1, answer2, answernumbering, correctfeedback, partiallycorrectfeedback, incorrectfeedback and defaultmark.
  • You can also download the Extended Sample CSV(extended_sample.csv) file for your reference.

questionname,questiontext,A,B,C,D,Answer 1,Answer 2,answernumbering,correctfeedback,partiallycorrectfeedback,incorrectfeedback, defaultmark Question1,The dmesg command,Shows user login logoff attempts,Shows the syslog file for info messages,kernel log messages,Shows the daemon log messages,C,,123,Your answer is correct.,Your answer is partially correct.,Your answer is incorrect.,1 Question2,The command “mknod myfifo b 4 16”,Will create a block device if user is root,Will create a block device for all users,Will create a FIFO if user is not root,"None ,of the mentioned",A,B,ABCD,Your answer is correct.,Your answer is partially correct.,Your answer is incorrect.,1 Question3,Which command is used to set terminal IO characteristic?,tty,ctty,ptty,stty,D,,iii,Your answer is correct.,Your answer is partially correct.,Your answer is incorrect.,1

IMPORTANT NOTES:

  • You have to save the file in a CSV format. Don't save it as an Excel document or anything like that.
  • Non-ASCII characters like 'quotes' can cause import errors. To avoid this, always save your text file in UTF-8 encoding (most text editors, even Libre Office, will ask you).
  • The Header must be as it is shown in the example below. Everything is case sensitive as shown below; otherwise, the import will fail.
  • "Answer 2" is optional, as of now there can be a maximum of two right answers for one question.
  • If you want to have a comma character (,) inside the question text or in options text, then you must enclose that text between double quotes (") like the example below in the 3rd question, where the entire question is enclosed between double quotes like this "3, 4, 7, 8, 11, 12, ... What number should come next?"

Export:

  • You can also export questions from question bank into a CSV file.
  • Only multiple choice questions having one or two answers can be exported to a CSV file.
  • Exported CSV file will be Extended CSV with all the 13 fields/columns.
  • Make sure you uncheck the checkbox "Write category to file" and "Write context to file".

exportquestions.png

See also

Import questions

Export questions