Code highlighting and randomized answers when importing questions into Question Library via CSV?

Peter.A.8126
Peter.A.8126 Posts: 4 🌱
edited December 5 in Higher Ed / Postsecondary

I want to bulk upload questions for a final programming exam that I have written in the CSV format (referencing the information in this article).

I can use the <code> tag to format the code answer choices, but they render only in monospace font, not using the Java syntax highlighting as when I manually click "Insert Code" in the question editor. Here is an example of the syntax highlighting from the GUI:

I published this sample question to the LOR and essentially copied all the XML into my CSV, and it doesn't render with syntax highlighting. Here are some of the ways I've tried to get that functionality

NewQuestion,MC 
QuestionText, Which of the following methods returns a String array?, HTML
Option,0, <p><pre class="line-numbers d2l-code language-java" data-language="Java"><code class="language-java">public static void returnStringArray()</code></pre></p>, HTML
Option,100, <pre class="line-numbers d2l-code"><code class="language-java">public static String[] returnStringArray()</code></pre>, HTML
Option,0,<p><span>public static void returnStringArray()</span></p> <pre class="line-numbers d2l-code"><code class="language-java">public static void returnString();</code></pre>, HTML
Option,0,<code class="language-java">public String returnStringArray()</code>, HTML
,,,,

Is this possible? It's okay with the monospace, but the highlighting will be better.

Also, is there a way to set render_choice shuffle="yes"using the CSV format? This would provide the "randomize answers" functionality that I only see in the GUI. My problem is that I would have to manually set every question. I would prefer to do this at the Quiz level, or at the question level using the import questions CSV file. It's not in the "Optional entries for your CSV template" section of the article I referenced above, but would be a helpful addition — unless there is a way I am missing.

Thank you!

Answers

  • Hello Peter,

    Thank you for your inquiry regarding the bulk upload of programming exam questions into Brightspace, specifically concerning code syntax highlighting and the randomization of answer choices.

    When importing questions via a CSV file, using the <code> tag will render text in a monospace font but will not apply specific syntax highlighting for languages like Java. The current CSV import functionality does not support advanced HTML attributes or classes necessary for syntax highlighting. To achieve the desired syntax highlighting, you would need to manually edit each question within the Brightspace editor after import, applying the appropriate formatting using the "Insert Code" feature.

    The CSV import template does not include an option to set the "randomize answers" feature for individual questions. This setting must be enabled manually for each question within the Brightspace interface. Alternatively, you can randomize the order of questions at the quiz level by selecting the "Shuffle questions" option in the quiz properties.

    Please note that while these manual steps can be time-consuming, they are currently the available methods to achieve syntax highlighting and answer randomization within Brightspace quizzes.

    If you have any further questions or need additional assistance, feel free to reach out.

    Regards,
    Miguel

  • Peter.A.8126
    Peter.A.8126 Posts: 4 🌱

    Hi Miguel, thanks for your answer. The "shuffle questions" tick box is very helpful at the quiz level.

    Would love to see language-specific code highlighting and randomize answers options supported when importing a CSV for bulk imports, maybe you could pass this along to a product manager. Thanks again!

  • Jennifer.W.973
    Jennifer.W.973 Posts: 381 🎆

    @Peter.A.8126 If you have a lot of questions and don't mind exporting and re-importing them, there is a workaround to bulk randomize the answer choices.

  • Peter.A.8126
    Peter.A.8126 Posts: 4 🌱

    @Jennifer.W.973 thanks for that workaround! Nice site too. I like the HTML tricks, really cool!