I want to write a series of questions that force students to really understand looping. I expect these would be small programs that would output a list of expected numbers. For example:
- Write a program that uses a loop to print the numbers 0-5 to the serial monitor.
- Write a program that uses a loop to print the numbers 0-10 to the serial monitor.
- Write a program that uses a loop to print the numbers 3-12 to the serial monitor.
- Write a program that uses a loop to print the following to the serial monitor: 0,2,4,6,8,10.
- Write a program that uses a loop to print the following to the serial monitor: 0,5,10,15,20,25,30.
- Write a program that uses a loop to count down from 5 to 0 and prints those numbers to the serial monitor.
I think the best way to ask these types of questions is to use the CodeRunner question type, but I'm not exactly sure how.
To make matters more complicated, I would like to ask the question using C/C++, but modified so that it appears to be ArduinoC to the students (unless of course there's a way to setup my jobe server to handle ArduinoC). To make matters even more complicated, I would also like to make this an Arduino via Python3 question type so that I could use pylint to check for things like white space and proper positioning of curly braces and whatnot.
The correct solution would look like:
void setup() { Serial.begin(9600); for(int x = 0; x < 5; x++) Serial.println(x); } void loop() { }Ideally the students would need to input everything since part of their confusion arises from not knowing whether they should add their code to the setup or the loop.
Also, is there a way to make the inputs into the for loop variables so that the answers to the 2nd, 3rd, 4th, etc. questions vary? I'd like the quiz questions to vary from student to student to make cheating a little harder.