From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: Exams with Org? Date: Sat, 07 Dec 2013 23:00:57 +0100 Message-ID: References: <52A22441.2050704@mun.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpPvv-00045b-4v for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 17:01:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VpPvo-0002M8-V2 for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 17:01:07 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:33777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VpPvo-0002M1-OZ for emacs-orgmode@gnu.org; Sat, 07 Dec 2013 17:01:00 -0500 In-reply-to: <52A22441.2050704@mun.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Roger Mason Cc: org-mode rmason@mun.ca writes: > Hello, > > Has anyone used Org to create exams? It would be useful to have the > value per question totalled to provide the total per section etc and to > be able to embed the answers in the exam and expose them in the final > document using some kind of conditional processing. > > If anyone has done this kind of thing I'd be interested to see an > example file. I've done part of it (not the value of the questions, but including the answers in the source). For an exam I gave last year on the OCaml language, I put the solution for the code questions in the source, and use it to generate the expected type of the function. (This way I could also make sure I was not asking to code something too difficult.) Here is part of the exam (sorry, it's in French, but it should give you the general idea). I also include the beginning of the file since I've found that more examples about how to set things up always helps. There are two kinds of code blocks below: those with results "silent" are just used to add some things to the session (OCaml works by default with a session in org), those with results "verbatim" export the result of evaluating of the source, which is what the toplevel answers (i.e., the type). --8<---------------cut here---------------start------------->8--- # -*- org-confirm-babel-evaluate: nil -*- #+begin_src emacs-lisp :results silent :exports none (setq org-export-latex-minted-options '(("frame" "lines") )) (add-to-list 'org-structure-template-alist '("Q" "#+BEGIN_question\n?\n#+END_question" "\n?\n")) #+end_src #+TITLE: Programmation Fonctionnelle #+DATE: jeudi 6 juin 2013 #+Author: #+LANGUAGE: fr #+OPTIONS: num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport #+LATEX_CMD: xelatex #+LaTeX_HEADER: \usepackage{lastpage} #+LaTeX_HEADER: \usepackage{tikz} #+LaTeX_HEADER: \usepackage{minted} #+LaTeX_HEADER: \usemintedstyle{emacs} \newtheorem{question}{Question} * Arbres binaires annotés Les fonctions demandées dans les questions suivantes peuvent dépendre les unes des autres. Vous pouvez toujours utiliser les fonctions que vous ne savez pas définir. ** Définition du type #+BEGIN_question Définir un type polymorphe ~('a,'b) tree~ représentant un arbre annoté. Les constructeurs de ce type seront l'arbre vide ~Emp~ contenant une annotation de type ~('a)~, une feuille ~Leaf~ contenant une annotation de type ~('a)~ et une valeur de type ~('b)~, et un nœud ~Node~ contenant une annotation de type ~('a)~, un sous-arbre gauche et un sous-arbre droit. #+END_question #+name: treetype #+BEGIN_SRC ocaml :results silent :exports results type ('a,'b) tree = | Emp of 'a | Leaf of 'a * 'b | Node of 'a * ('a,'b) tree * ('a,'b) tree #+END_SRC Dans les questions suivantes, il faudra maintenir l'invariant suivant: un arbre est soit vide (constructeur ~Emp~), soit il ne contient pas de sous-arbre vide (tous les sous-arbres sont soit ~Leaf~ soit ~Node~). #+BEGIN_question Écrire une fonction ~tag~ prenant un arbre et renvoyant son annotation. #+END_question #+name: tag #+BEGIN_SRC ocaml :results code verbatim :exports results let tag = function | Emp a -> a | Leaf (a,_) -> a | Node (a,_,_) -> a #+END_SRC --8<---------------cut here---------------end--------------->8--- Alan