Question Listing

Logic Problem

This module defines the logic problem question.

class questioned.questions.logic_problem.LogicProblem(exam_spec: dict, question: str, answer: str, *, question_data: dict = {}, **kwargs)[source]

Bases: questioned.questions.question.Question

Defines a question that requires the student to solve a logical problem.

The student is provided with a boolean logic expressions and a set of initial values. The student is then required to evaluate the expression and provide the resulting value in the form of a boolean (True or False)

These logical problems are fully randomly generated and require no input through the exam_spec.

classmethod generate(exam_spec, count: int = 5, section_data=None)[source]

Generates an amount of manually input questions.

render_blackboard()[source]

Renders the question for blackboard. Uses the True/False type.

class questioned.questions.logic_problem.LogicTreeNode(variables, depth=0)[source]

Bases: object

Node of a tree for a logical expression.

solution

Returns the solution of the logical expression.

Manual Multiple Choice Question

This module defines the manual open question.

class questioned.questions.manual_multiple_choice_question.ManualMultipleChoiceQuestion(exam_spec: dict, question: str, raw_answers: list, *, question_data: dict = {}, **kwargs)[source]

Bases: questioned.questions.question.Question

Defines a question that is input manually using the exam_spec file.

This question type requires the student to select an answer from a given group of answers. Only one of these answers is correct.

The question text is passed through the question parameter.

The possible answers is provided as a list through the answers parameter.

This list contains the answers, as well as whether or not they are correct.

This list can arbitrarily long, but be aware that blackboard does not support more than 255 total answers, including the correct answer.

Though, creating a list of options this long may have other practical implication.

By default, the list is shuffled by the software, but the list can be ordered manually by setting the randomize_order parameter to False. In that case, answers are stated in the order they are provided.

Supports the inclusion of images above the question text, similar to ManualOpenQuestion.

The order of choices is randomized.

Exam Spec example:

manual_multiple_choice_questions:
- question: "What is the Answer to the Ultimate Question of Life, the Universe, and Everything?"
  randomize_order: False
  answers:
    - "-1": False
    - "12": False
    - "24": False
    - "42": True
answer

Gives the string representation of the correct answer.

correct_answers

Returns a list of all answers deemed correct by the question.

classmethod generate(exam_spec, count: int = 5, section_data=None) → list[source]

Generates an amount of manually input questions.

incorrect_answers

Returns a list of all answers deemed incorrect by the question.

process_answers(raw_answers)[source]

Formats the raw answer input into something more usable.

render_blackboard() → str[source]

Renders the blackboard question.

render_markdown() → str[source]

Renders the markdown output for this question.

Manual Open Question

This module defines the manual open question.

class questioned.questions.manual_open_question.ManualOpenQuestion(exam_spec: dict, question: str, answer: str, *, question_data: dict = {}, **kwargs)[source]

Bases: questioned.questions.question.Question

Defines a question that is input manually using the exam_spec file.

This question type requires the student to fill in a specific answer.

It is generally advised to keep these answers short and simple, so as to avoid errors with automatic grading systems. It is also advised to be specific as to how the answer is to be filled in in the question text.

For example: What is the atomic symbol for gold? Provide your answer in capital letters (e.g. HE).

Optionally the question support the inclusion of images above the image text using the image property. A valid path must be entered or the program will fail.

Exam Spec example:

manual_open_questions:
- question: "Does this graph look cool?"
  answer: 'Yes'
  image: "testimage.png"
- question: "Do you like computers?"
  answer: 'Yes'
classmethod generate(exam_spec, count: int = 5, section_data=None)[source]

Generates an amount of manually input questions.

Parsons Problem

This module defines the manual entry question.

class questioned.questions.parsons_problem.ParsonsProblem(exam_spec: dict, question: str, answer: str, *, question_data: dict = {}, **kwargs)[source]

Bases: questioned.questions.question.Question

Defines a parsons problem that is input manually using the exam_spec file.

This question type is based on a paper by Paul Denny, Andrex Luxton-Reilly and Beth Simon. The paper can be found at https://cseweb.ucsd.edu/classes/fa08/cse599/denny.pdf

Though the basic structure of this question type is similar to the one described in the paper. It does not support the more complex rubrics that would require a human to correct the exam.

Instead, it is best to focus on shorter code snippets where ordering is the main focus of the problem.

The parsons problem requires additional information through the exam_spec.

For example:

parsons_problems:
- description: "Pyramid printing function."
  code: |
    #include<stdio.h>
    int main() {
        int i, j, rows;
        printf("Enter number of rows: ");
        scanf("%d", &rows);
        for (i=1; i<=rows; ++i) {
            for (j=1; j<=i; ++j)
            { printf("* "); }
            printf("\n");}
        return 0;}

All parsons problems require at least a description and a code segment.

The code segment is automatically broken up into lines and jumbled for the assignment. As such it must be entered in the correct form.

classmethod generate(exam_spec, count: int = 1, section_data=None)[source]

Generates an amount of manually input questions.

render_blackboard()[source]

Render the parsons problem for blackboard. Uses the JUMBLED_SENTENCE type.

render_markdown()[source]

Render the parsons problem to markdown.

Question

Superclass for all question objects.

class questioned.questions.question.Question(exam_spec: dict, question: str, answer: str, *, question_data: dict = {}, **kwargs)[source]

Bases: object

Superclass for all questions in the program.

Can be extended to create different types of question.

classmethod generate(exam_spec, count: int = 5, section_data=None)[source]

Returns an amount of this object.

image

Returns the image encapsulated in an html img tag in its base64 encoded form.

Requires that the image_path attribute be set.

Images can be resized by specifying image_size_percent.

render(output_format, *args, **kwargs) → str[source]

Delegates to the applicable render format based on the output_format.

Renderer is selected based on function name, for example: render(‘markdown’) will call the render_markdown method. render(‘blackboard’) will call the render_blackboard method. etc.

This functionality should probably be left alone when implementing your own question classes.

render_blackboard()[source]

Renders the question for blackboard.

render_markdown()[source]

Renders the question to markdown.

Radix Conversion Question

This module defines the conversion entry question.

class questioned.questions.radix_conversion_question.RadixConversionQuestion(exam_spec: dict, question: str, answer: str, *, question_data: dict = {}, **kwargs)[source]

Bases: questioned.questions.question.Question

Defines a radix conversion question.

This question type requires the student to convert a number from one base to another. For example from hexadecimal to decimal, or from binary to decimal, etc.

This question type requires no extra information from the exam_spec.

classmethod generate(exam_spec, count: int = 5, section_data={})[source]

Generates an amount of manually input questions.

Module contents

The questions module contains all the different question object types.