Computing the (Euclidean) distance between two randomly-drawn points by using the Pythagorean Theorem. In addition to the correct solution, four false alternatives are generated through
num_to_schoice()by providing two common errors along with a range and minimal delta for two further random solutions.
Random numbers and graphics
Verbatim R input/output:
(Note that the HTML output contains mathematical equations in MathML. It is displayed by browsers with MathML support like Firefox or Safari - but not Chrome.)
library("exams") set.seed(1090) exams2html("dist3.Rnw") set.seed(1090) exams2pdf("dist3.Rnw") set.seed(1090) exams2html("dist3.Rmd") set.seed(1090) exams2pdf("dist3.Rmd")