Forum archive 2000-2006

Michael Gage - True false example

Michael Gage - True false example

by Arnold Pizer -
Number of replies: 0
inactiveTopicTrue false example topic started 5/8/2000; 8:08:41 PM
last post 5/8/2000; 8:08:41 PM
userMichael Gage - True false example  blueArrow
5/8/2000; 8:08:41 PM (reads: 3686, responses: 0)

The true false basic example

(for more advanced information on select lists, see Select.pm) To obtain this problem

(1 pt) rochesterLibrary/setMAAtutorial/truefalseexample.pg

True False Example

Enter T or F depending on whether the statement is true or false. (You must enter T or F -- True and False will not work.)

 1. All differentiable strictly increasing functions have non-negative derivatives at every point
 2. All polynomials are differentiable.
 3. All compact sets are closed
 4. All closed sets are compact

 

 

 


WARNINGS
µ¦å{h­
DOCUMENT();      
loadMacros("PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",

);
TEXT(beginproblem(), $BR,$BBOLD, "True False Example", $EBOLD, $BR,$BR);

# Since this is a true questions, we do not usually wish to tell students which
# parts of the matching question have been answered correctly and which are
# incorrect. That is too easy. To accomplish this we set the following flag to
# zero.
$showPartialCorrectAnswers = 0;

# True false questions are a special case of a "select list"
# Make a new select list
$tf = new_select_list();
# $tf now "contains" the select list object.
# Insert some questions and whether or not they are true.

$tf -> qa ( # each entry has to end with a comma
"All continuous functions are differentiable.",
"F",
"All differentiable functions are continuous.",
"T",
"All polynomials are differentiable.",
"T",
"All functions with positive derivatives are increasing.",
"T",
"All compact sets are closed",
"T",
"All closed sets are compact",
"F",
"All increasing functions have positive deriviatives",
"F",
"All differentiable strictly increasing functions have non-negative derivatives
at every point",
"T",
);

# Choose four of the question and answer pairs at random.
$tf ->choose(4);

# Now print the text using $ml->print_q for the questions
# and $ml->print_a to print the answers.

BEGIN_TEXT
$PAR

Enter T or F depending on whether the statement is true or false.
(You must enter T or F -- True and False will not work.)$BR

\{ $tf-> print_q \}

$PAR

END_TEXT

# Enter the correct answers to be checked against the answers to the students.

ANS(str_cmp( $tf->ra_correct_ans ) ) ;

ENDDOCUMENT(); # This should be the last executable line in the problem.


<!--
(1 pt)
Enter T or F depending on whether the statement is true or false. (You must enter T or F -- True and False will not work.)

1. All continuous functions are differentiable.
2. All polynomials are differentiable.


Enter this code

 


1 DOCUMENT(); # This should be the first executable line in the problem.
2 loadMacros(PG.pl,
3 PGbasicmacros.pl,
4 PGchoicemacros.pl,
5 PGanswermacros.pl,
6 PGgraphmacros.pl,
7 );
8
9
10 TEXT(beginproblem()); # standard preamble to each problem.
11 # Since this is a true questions, we do not usually wish to tell students which
12 # parts of the matching question have been answered correctly and which are
13 # incorrect. That is too easy. To accomplish this we set the following flag to zero.
14 $showPartialCorrectAnswers = 0;
15
16 # Make a new select list
17 $tf = new_select_list();
18 # $tf now "contains" the select list object.
19 # See matchinglistexample.pg for details
20
21 # Insert some questions and whether or not they are true.
22 $tf -> qa (
23 "All continuous functions are differentiable.", # each entry has to end with a comma
24 "F",
25 "All differentiable functions are continuous.",
26 "T",
27 "All polynomials are differentiable.",
28 "T",
29 "All functions with positive derivatives are increasing.",
30 "T"
31 ); # remember every statement has to end with a semi-colon.
32
33 # Choose two of the question and answer pairs at random.
34 $tf ->choose(2);
35 # Now print the text using $ml->print_q
36
37 BEGIN_TEXT
38 $PAR
39
40 Enter T or F depending on whether the statement is true or false.
41 (You must enter T or F -- True and False will not work.)$BR
42 \{ $tf-> print_q \}
43 $PAR
44 END_TEXT
45
46 # Enter the correct answers to be checked against the answers to the students.
47 ANS( str_cmp( $tf->ra_correct_ans ) ) ;
48
49 # The ra_... means that the output of this function is an array reference -- a gadget that looks like
50 # [T, F, T] or whatever the list of T's and F's represents the correct answers.
51 # That's it.
52 ENDDOCUMENT(); # This should be the last executable line in the problem.
-->

Comments:

  1. This is similar to the matching list problem, but this time there is no separate list of matching answers to choose from. You can also use this template for problems which require short answers (e.g. "decreasing", "increasing", "constant") rather than "T" and "F" or "True" and "False". See also the pop-up list example for another way to pose this kind of question.
  2. First we create the object -- this time called a "select list". $tf = new_select_list(); (line 17)
  3. Next we enter a list of questions, followed by their answers (T or F) (lines 22 - 31)
  4. Choose two questions at random from the list. $tf ->choose(2); (line 34)
  5. Print the questions { $tf-> print_q } (line 42)
  6. Register the correct answers ANS( str_cmp( $tf->ra_correct_ans ) ) ; (line 47)

<| Post or View Comments |>