Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 My Turing Computer Science Summative - Quiz
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
al2548




PostPosted: Thu Jan 19, 2017 9:06 am   Post subject: My Turing Computer Science Summative - Quiz

View.Set ("graphics:max;max,nobuttonbar")

var answer, choice, q1, q2, q3, q4, q5, q6, q7 : string
var score, score1, answer1 : string

var x : int
var y : int
var z : int

loop
delay (20)
randint (x, 1, maxx)
randint (y, 1, maxy)
randint (x, 1, maxx)
randint (y, 1, maxy)
randint (z, 1, maxcolor)
Draw.FillStar (x, y, x + 50, y + 50, z)
exit when z = 250

end loop
cls
loop
put "Hello there! I am a program to quiz you on the units of TEJ20."
put "Type your answer and then press enter. If you answer the question wrong, you must try again."
put "Please choose the unit you would like to be tested on (1-5)."

get answer1
if answer1 = "1" then
put "Great! Let's get started."
delay (2000)
cls
loop
%Question 1
loop
put "Question 1: What metal device cools down the CPU?"
put "a) CD-ROM"
put "b) Platter"
put "c) Heatsink"
put "d) RAM"
put "e) ALU"
get q1
%Check to see if they got right answer
if q1 = "c" or q1 = "C" or q1 = "Heatsink" or q1 = "heatsink" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is a Heatsink."
exit
end if
end loop
delay (2000)
cls

%Question 2
loop
put "Question 2: How pins does an IDE/ATA have?"
get q2
%Check for correct answer
if q2 = "44" or q2 = "44 pins" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is 44 pins."
exit
end if
end loop
delay (2000)
cls

%Question 3
loop
put "Question 3: What is the value is the distance, in mm, between adjacent pixels on the screen called?"
get q3
%Check for correct answer
if q3 = "Dot Pitch" or q3 = "dot pitch" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is dot pitch."
exit
end if
end loop
delay (2000)
cls

%Question 4
loop
put "Question 4: What is the capacity of a 3.5 floppy disk?"
put "a) 1.44MB"
put "b) 700MB"
put "c) 1GB"
put "d) 1.25MB"
put "e) 6.66MB"
get q4
%Check for correct answer
if q4 = "a" or q4 = "A" or q4 = "1.44" or q4 = "1.44MB" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is 1.44MB."
exit
cls


%Question 5
loop
put "Question 5: What is the electronic device that moves an arm across the hard drive's surface called?"
get q5
%Check for correct answer
if q5 = "Actuator" or q5 = "actuator" or q5 = "An Actuator" or q5 = "an actuator" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is an actuator."
exit
end if
end loop
delay (2000)
cls

%Question 6
loop
put "Question 6: Which device does not belong?"
put "a) Mouse"
put "b) Printer"
put "c) Keyboard"
put "d) Joystick"
put "e) Webcam"
get q6 : *
%Check for correct answer
if q6 = "b" or q6 = "B" or q6 = "Printer" or q6 = "printer" or q6 = "a printer" or q6 = "A Printer" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is a printer"
exit
end if
end loop
delay (2000)
cls

%Question 7
loop
put "Question 7: What does DDR stand for?"
get q7
if q7 = "Double Data Rate" or q7 = "double data rate" or q7 = "Double data rate" then
put "Correct!"
exit
else
put "Incorrect."
put "The correct answer is Double Data Rate."
exit
end if
end loop
delay (2000)
cls


put "Would you like to play again (yes/no)?"
get choice
exit when choice = 'no' or choice = 'No' or choice = 'n' or choice = 'N'
end loop
cls
end if
end loop







There's a problem with my computer summative. Every time I begin the quiz, it works fine with questions one and two. But when I get to question 3, it completely disregards anything I type and always gives me the incorrect path. Question 4 just skips the "get" part of the question (doesn't even give me a chance to type anything) and just shows me the response to an incorrect answer. It seems to stop there, but then question 7 has the same issue with question 3; even if I type the right answer, it gives me a "Incorrect". So then I tried getting rid of questions 3 and 4. Everything else works except for question 7. Then the ending question, "Would you like to play again?" doesn't give me a chance to put in an answer and just shows the very first question again. The "or"s work but it's only those questions. Sorry, there isn't much commenting. Please help me![/url]
Sponsor
Sponsor
Sponsor
sponsor
5c0r910n




PostPosted: Thu Jan 19, 2017 10:42 am   Post subject: RE:My Turing Computer Science Summative - Quiz

I believe your problem is that some of your answers require spaces. You can fix this by changing your answer to just being "a" "b" "c" excetera, or when getting the variable just a ":*"

example: get q7:*


good luck m8
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: