Wolfram 语言

更丰富的知识库访问

生成在线测验题

使用新的内置功能很容易创建和部署表单. 这种表单可以在云中进行部署,通过动态文件、应用程序接口(API)、应用程序等,提供代码和数据的无缝和持久的存储,云计算和即时外部部署. 这些特性在这里通过创建和部署两个小测验给以演示. 两个小测验分别请求用户来识别身份的某些大城市和某些流行电影.

在云端创建关于美国大城市的测验题.

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]=

访问表单并与其互动.

如果任何一个选项不在美国最大的 10 个城市中,表单会显示错误信息.

在云端创建关于电影的测验题.

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]=

访问该网页来尝试测验.

相关范例

de en es fr ja ko pt-br ru