gpoore/text2qti

Response type

Closed this issue · 2 comments

The following quiz:

tion must specify a response type
GROUP
pick: 3
points per question: 1

1. What is the primary purpose of the `#define` directive in C?
   a) To include a header file.
   b) To declare a function.
   *c) To define a macro or constant.
   d) To create a new data type.
   e) To initiate conditional compilation.

2. Which preprocessor directive is used to test whether a macro is not defined?
   a) #if
   b) #ifdef
   *c) #ifndef
   d) #elif
   e) #else

3. If you have the following code:
   ~~~
   #define FLAG
   #ifdef FLAG
    printf("FLAG is defined.");
   #else
      printf("FLAG is not defined.");
   #endif
   ~~~
   What will be the output?
   a) No output, there will be a compilation error.
   b) "FLAG is not defined."
   *c) "FLAG is defined."
   d) "FLAG"
   e) "FLAG

generates an error when running text2qti:

Traceback (most recent call last):
  File "/Users/erlebach/src/2023/text2qti/text2qti/quiz.py", line 725, in __init__
    parse_actions[action](text)
  File "/Users/erlebach/src/2023/text2qti/text2qti/quiz.py", line 970, in append_question
    last_question_or_delim.finalize()
  File "/Users/erlebach/src/2023/text2qti/text2qti/quiz.py", line 444, in finalize
    raise Text2qtiError('Question must specify a response type')
text2qti.err.Text2qtiError: Question must specify a response type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/erlebach/opt/miniconda3/bin/text2qti", line 33, in <module>
    sys.exit(load_entry_point('text2qti', 'console_scripts', 'text2qti')())
  File "/Users/erlebach/src/2023/text2qti/text2qti/cmdline.py", line 125, in main
    quiz = Quiz(text, config=config, source_name=file_path.as_posix())
  File "/Users/erlebach/src/2023/text2qti/text2qti/quiz.py", line 728, in __init__
    raise Text2qtiError(f'In {self.source_name} on line {n}:\n{e}')
text2qti.err.Text2qtiError: In "preprocess_1-3.txt" on line 19:
Question must specify a response type

I do not understand what is meant by "response type". Thanks for any clarification.

Gordon

gpoore commented

The possible choices (response types) a), b), etc. aren't being recognized (are "missing") because they are indented. You want something like this:

1. What is the primary purpose of the `#define` directive in C?
a) To include a header file.
b) To declare a function.
*c) To define a macro or constant.
d) To create a new data type.
e) To initiate conditional compilation.

Thank you!