QuestionSelector[{qo1,qo2,…}]
represents a list of questions from which one of the question objects qoi can be randomly selected.
QuestionSelector[CloudObject[…]]
represents a cloud-deployed question selector.
QuestionSelector
QuestionSelector[{qo1,qo2,…}]
represents a list of questions from which one of the question objects qoi can be randomly selected.
QuestionSelector[CloudObject[…]]
represents a cloud-deployed question selector.
Details and Options
- QuestionSelector[…][] returns the selected QuestionObject.
- QuestionSelector[…][n] returns a list of n selected questions.
- Typically, QuestionSelector is used with a question notebook available via CreateNotebook["QuestionNotebook"].
- QuestionSelector[…][] is equivalent to First@QuestionSelector[…][1].
- A QuestionSelector may serve questions locally or from the cloud when deployed from a question notebook.
- Cloud-deployed question pools have the form QuestionSelector[CloudObject[…]] for a cloud object containing only a single pool or QuestionSelector[{CloudObject[…],"questionid"}] when the cloud object contains multiple pools, generators or question objects..
- QuestionSelector provides a convenient tool for defining question banks and question pools.
Examples
open all close allBasic Examples (1)
selector = QuestionSelector[{
QuestionObject["In what year was Wolfram Mathematica launched?", MatchQ[1988]],
QuestionObject["In what year was Wolfram|Alpha launched?", AssessmentFunction[{1995, 2009 -> True, 2010, 2018}]],
QuestionObject["In what year was Wolfram Research founded?", MatchQ[1987]]
}]Get a random question from the pool:
selector[]Scope (3)
Create a pool of geometry questions:
geometrypool = QuestionSelector[{
QuestionObject["What is the area of a circle with radius 2?", AssessmentFunction[{4 * Pi}, Tolerance -> 0.1]],
QuestionObject["What is the perimeter of square with side 3?", AssessmentFunction[{12}]],
QuestionObject["What is the radius of a cone with volume 25 and height 7?", AssessmentFunction[{Sqrt[30 / (7 * Pi)]}, Tolerance -> 0.1]]
}]Get a random question from the pool:
geometrypool[]Create a list of multiple questions from the pool:
geometrypool[3]Deploy a question selector to the cloud:
deployed = ResourceFunction["QuestionDeploy"][QuestionSelector[{
QuestionObject["In what year was Wolfram Mathematica launched?", MatchQ[1988]],
QuestionObject["In what year was Wolfram|Alpha launched?", AssessmentFunction[{1995, 2009 -> True, 2010, 2018}]],
QuestionObject["In what year was Wolfram Research founded?", MatchQ[1987]]
}]]selector = deployed["QuestionSelector"]question = selector[]The solutions are not included in either the pool or the question:
InputForm[{selector, question}]Define a list of true/false questions:
moonquestions = QuestionObject["True or False: " <> CommonName[#] <> " has a moon.",
AssessmentFunction[#[EntityProperty["Planet", "MoonCount"]] > Quantity[0, IndependentUnit["moons"]]]]& /@ EntityList["Planet"]Create a pool that generates three questions from the list:
moonpool = QuestionSelector[moonquestions, 3]moonpool[]Applications (2)
Create a question pool asking for the population of G7 countries:
g7pool = QuestionSelector@KeyValueMap[QuestionObject[
QuestionInterface["NumericRange", <|"Prompt" -> Row[{"In millions, what is the approxmiate population of ", #1, "?"}], "Range" -> {5, 500}|>],
AssessmentFunction[{QuantityMagnitude@#2 / 10 ^ 6 -> 1}, Tolerance -> 20]
]&, EntityValue[EntityClass["Country", "GroupOf7"], "Population", "EntityAssociation"]]g7pool[]Create a function to generate questions about classes of animals:
classquestion[class_] := QuestionObject[QuestionInterface["ShortAnswer", <|"Prompt" -> Row[{"Name a species from the ", class}], "Interpreter" -> "Animal"|>],
#["Class"] === class&]pool = QuestionSelector[classquestion /@ {Entity["Species", "Class:Mammalia"], Entity["Species", "Class:Reptilia"], Entity["Species", "Class:Aves"], Entity["Species", "Class:Actinopterygii"]}]Retrieve a question from the pool:
pool[]Properties & Relations (1)
QuestionSelector serves questions from a predefined, static set of questions:
QuestionSelector[{QuestionObject["Is a hot dog a sandwich?", AssessmentFunction[{True}]],
QuestionObject["Is a taco a sandwich?", AssessmentFunction[{True}]],
QuestionObject["Is a poptart a sandwich?", AssessmentFunction[{True}]]}][]QuestionGenerator can work equivalently using RandomChoice:
QuestionGenerator[{"food" :> RandomChoice[{"hot dog", "taco", "poptart"}]},
QuestionObject["Is a " <> #food <> " a sandwich?",
AssessmentFunction[{True}]
]&][]QuestionGenerator can also generate new questions:
QuestionGenerator[{"food" :> RandomEntity["Food"]["Name"]},
QuestionObject["Is a " <> #food <> " food?",
AssessmentFunction[{True}]
]&][]Neat Examples (1)
Using the resource function RandomEntityQuestion, generate a pool of random multiple choice questions about dog breeds with images as answer choices:
dogpool = QuestionSelector[Table[ResourceFunction["RandomEntityQuestion"]["DogBreed", "AnswerProperty" -> "Image"], {i, 5}]]dogpool[]Related Guides
History
Text
Wolfram Research (2022), QuestionSelector, Wolfram Language function, https://reference.wolfram.com/language/ref/QuestionSelector.html.
CMS
Wolfram Language. 2022. "QuestionSelector." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/QuestionSelector.html.
APA
Wolfram Language. (2022). QuestionSelector. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/QuestionSelector.html
BibTeX
@misc{reference.wolfram_2026_questionselector, author="Wolfram Research", title="{QuestionSelector}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/QuestionSelector.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_questionselector, organization={Wolfram Research}, title={QuestionSelector}, year={2022}, url={https://reference.wolfram.com/language/ref/QuestionSelector.html}, note=[Accessed: 12-June-2026]}