Posted: Mon May 25, 2009 8:24 am Post subject: Making multiple choise questions
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
<Answer Here>
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing:
<Add your code here>
Please specify what version of Turing you are using
<Answer Here>
Sponsor Sponsor
Tallguy
Posted: Mon May 25, 2009 8:25 am Post subject: RE:Making multiple choise questions
we still need to know what exactly you need help with . . .
animeanime
Posted: Mon May 25, 2009 8:26 am Post subject: Re: Making multiple choise questions
Cant edit the post. So here....
What is it you are trying to achieve?
Making a multiple choise exam in turing
What is the problem you are having?
Cannot start the program and cant make it work
Describe what you have tried to solve this problem
I have tried using different ways of using " if " and " elsif " and it dident work
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing:
% The multiple choise exam % User choose one of the 4 possiable answers for each question
var answer: char var point: real var a, b, c, d: char
point :=0
put"This is a science exam consisting of 20 questions. Please select the most correct answer for each question." put"Question Number #1" put"What is the last planet in the solor system" put"a) Venus" put"b) Pluto" put"c) Mars" put"d) Jupiter" get answer
if answer= a
then put"WRONG!" if answer= b
then put"WRONG!" if answer= c
then put"WRONG!" else put"CORRECT!" endif endif endif
Please specify what version of Turing you are using
4.0.3
Tallguy
Posted: Mon May 25, 2009 8:36 am Post subject: Re: Making multiple choise questions
Turing:
if answer= "a"
forgot the " " for when the user chooses an answer
animeanime
Posted: Mon May 25, 2009 8:42 am Post subject: Re: Making multiple choise questions
Ok, what if I want it to be something like this?
Turing:
% The multiple choise exam % User choose one of the 4 possiable answers for each question
var answer: char var point: real var a, b, c, d: char
point :=0
put"This is a science exam consisting of 20 questions. Please select the most correct answer for each question." put"Question Number #1" put"What is the last planet in the solor system" put"a) Venus" put"b) Pluto" put"c) Mars" put"d) Jupiter" get answer
if answer= 'a', 'c', 'd' then point=point+0 else then point=point+1 endif
So it counts how much right questions I did, and how much incorrect questions I did. How can I do that?
octopi
Posted: Mon May 25, 2009 8:45 am Post subject: Re: Making multiple choise questions
Although this is incorrect, you can replace it with something that is correct...
code:
if answer= 'a', 'c', 'd'
then point=point+0
else
then point=point+1
end if
Could be changed to
code:
if answer= "b"
then point=point+1
else
then point=point+0
end if
But please keep in mind that point=point+0, is the same as point=point, which is the same as not even having that line there to begin with.
If you have 5 apples, and you add 0 apples, you still have 5 apples.
animeanime
Posted: Mon May 25, 2009 8:50 am Post subject: Re: Making multiple choise questions
I put it, and I get a syntax error at " then "
Turing:
var answer: char var point: real var a, b, c, d: char
point :=0
put"This is a science exam consisting of 20 questions. Please select the most correct answer for each question." put"Question Number #1" put"What is the last planet in the solor system" put"a) Venus" put"b) Pluto" put"c) Mars" put"d) Jupiter" get answer
if answer= "b" then point:=point+1 else then point=point+0 endif
animeanime
Posted: Mon May 25, 2009 9:08 am Post subject: Re: Making multiple choise questions
I got it to start. But now, its not WORKING properly, why?
Turing:
% The multiple choise exam % User choose one of the 4 possiable answers for each question
var answer: char var point: real var a, b, c, d: char
point :=0
put"This is a science exam consisting of 20 questions. Please select the most correct answer for each question." put"Question Number #1" put"What is the last planet in the solor system" put"a) Venus" put"b) Pluto" put"c) Mars" put"d) Jupiter" get answer
if answer= "b" then point:=point+1 else
point:=point+0 endif
put"Question Number #2" put"What is photosynthesis?" put"a) When plants absorb water from the sun" put"b) When plants absorb water from their roots" put"c) When the sun absorbs energy from the plant" put"d) When plants absorbs energy from the sun" get answer
if answer= "d" then point:=point+1 else
point:=point+0 endif
put"Question Number #3" put"What are the 3 primary colors?" put"a) Red, Yellow, Green" put"b) Yellow, Red, Blue" put"c) Yellow, Blue, Green" put"d) Green, Yellow, Purple" get answer
if answer= "b" then point:=point+1 else
point:=point+0 endif
put"Question Number #4" put"What is the biggest country in the world?" put"a) Russia" put"b) USA" put"c) Canada" put"d) China" get answer
if answer= "a" then point:=point+1 else
point:=point+0 endif
put"Question Number #5" put"What is a mouse on a computer?" put"a) Input Device" put"b) Output Device" put"c) Internet Device" put"d) Moving Device" get answer
if answer= "a" then point:=point+1 else
point:=point+0 endif
put point
Sponsor Sponsor
octopi
Posted: Mon May 25, 2009 9:15 am Post subject: Re: Making multiple choise questions
What isn't working with it?, you need to be descriptive with your questions.
Perhaps it isn't working, since Pluto isn't a planet let alone the the largest in the solar system.
michaelp
Posted: Mon May 25, 2009 2:26 pm Post subject: Re: Making multiple choise questions
Turing:
get answer
if answer= "b" then point:=point+1 else
point:=point+0 endif
That 'point := point + 0' is unnecessary.
Also, instead of "answer = "b"" try doing it with single quotes. Single quotes are for single characters, double quotes are for strings, and the answer variable is a character.
So, your new code would be:
Turing:
get answer
if answer= 'b'then
point:=point+1 endif
You should put then on the same line as the if, it looks better. (IMO anyways)
corriep
Posted: Mon May 25, 2009 2:42 pm Post subject: Re: Making multiple choise questions
Ok 3 things:
#1 The variables a, b, c, d : char are un-needed and you should get rid of them
#2 answer should be a string not a char
#3
octopi wrote:
Perhaps it isn't working, since Pluto isn't a planet
Don't you dare say that!
Kharybdis
Posted: Tue May 26, 2009 7:51 am Post subject: RE:Making multiple choise questions
Pluto owns. The scientists who spewed that scientific mumbo-jumbo saying its not a planet ultimately fail.
Anyways, animeanime, please read the tutorials on if and elsif statements and strings.
Posted: Tue May 26, 2009 9:32 am Post subject: RE:Making multiple choise questions
When pluto was de planeted my science teacher read an article about how a group in the 80's thought the mass of pluto was too great considering the mass formations of ice
I forget the details but it just shows how long it takes to get the technology and prove something
animeanime
Posted: Tue May 26, 2009 9:33 am Post subject: Re: Making multiple choise questions
Thanks guys. Its working so far.
animeanime
Posted: Tue May 26, 2009 10:06 am Post subject: Re: Making multiple choise questions
Is it possible to make it like a real test? So for example after you did questions 1 and 2, and as your doing number 3. You want to change the answer for number 2. So you change it and then go back to number 3 and continue the test...... Is that possible?