Wolfram Language

Richer Knowledgebase Access

Online Quiz Generation

It is easy to create and deploy forms using new built-in functionality. Such forms may be deployed in the cloud, providing seamless persistent storage of code and data, cloud computation, and instant external deployment through active documents, APIs, apps, and so on. These features are illustrated here through the creation and deployment of two "quizzes" that query the user to identify large cities and certain popular films, respectively.

Create a quiz on large US cities in the cloud.

In[1]:=
Click for copyable input
CloudDeploy[ FormFunction[{"city", "How many of the 10 most populous US cities can you name?"} -> RepeatingElement[ Restricted[ "City", {"Country" -> Entity["Country", "UnitedStates"], "Population" -> TakeLargest[10]}], {1, {1, 10}}], GeoListPlot[{#city, Complement[ EntityList@ Entity["City", {"Country" -> Entity["Country", "UnitedStates"], "Population" -> TakeLargest[10]}], #city]}, GeoLabels -> True, PlotLegends -> {"OK", "Missed"}] &, "PNG"]]
Out[1]=

Visit the form to interact with it.

If one of the fields is not among the largest 10 cities in the US, the form will display a failure message.

Create a movie quiz in the cloud.

In[2]:=
Click for copyable input
CloudDeploy[ FormFunction[{"movies", "How many of the 10 top grossing movies by Steven Spielberg can \ you name?"} -> RepeatingElement[ Restricted[ "Movie", {"Director" -> Entity["Person", "StevenSpielberg::76z25"], "DomesticBoxOfficeGross" -> TakeLargest[10]}], {1, {1, 10}}], With[{images = EntityValue[ EntityClass[ "Movie", {"Director" -> Entity["Person", "StevenSpielberg::76z25"], "DomesticBoxOfficeGross" -> TakeLargest[10]}], "Image", "EntityAssociation"]}, Grid[{ {"you guessed", Length[#movies], ImageCollage[Values[KeyTake[images, #movies]]]}, {"you missed", 10 - Length[#movies], ImageCollage[Values[KeyDrop[images, #movies]]]} }, Frame -> All, Alignment -> Left]] &]]
Out[2]=

Visit the page to try the quiz.

Related Examples

de es ja ko pt-br ru zh