The document provides instructions for constructing peer-instruction questions for a computer programming course topic on switches and recursion. It includes examples of different types of peer-instruction questions and prompts the reader to write their own questions for each type. The types are: 1) Counting iterations, 2) What does this code do?, 3) Predict the output of the code, 4) What will happen if something is changed?, and 5) Debug the code. For each type, the reader is asked to write a short code example and corresponding multiple choice questions and identify the correct answer.
The document provides instructions for constructing peer-instruction questions for a computer programming course topic on switches and recursion. It includes examples of different types of peer-instruction questions and prompts the reader to write their own questions for each type. The types are: 1) Counting iterations, 2) What does this code do?, 3) Predict the output of the code, 4) What will happen if something is changed?, and 5) Debug the code. For each type, the reader is asked to write a short code example and corresponding multiple choice questions and identify the correct answer.
The document provides instructions for constructing peer-instruction questions for a computer programming course topic on switches and recursion. It includes examples of different types of peer-instruction questions and prompts the reader to write their own questions for each type. The types are: 1) Counting iterations, 2) What does this code do?, 3) Predict the output of the code, 4) What will happen if something is changed?, and 5) Debug the code. For each type, the reader is asked to write a short code example and corresponding multiple choice questions and identify the correct answer.
What you did so far During the Peer-Instruction (PI) session in the workshop, we discussed various types of Peer- Instruction questions for a Computer Programming course. You also attempted to write a PI question for a topic.
Goals of this assignment In this assignment, you will create PI questions of different types for a topic in your programming course.
0. Choose a typical topic you teach in your programming course and write it in the box below. Switch and recursion
Instructions
On each page, you will write a question of a different type. Each question contains brief guidelines on how to write the question and space for you to write your questions and choices.
Examples for each question are present in the slides used in the workshop session in Peer- Instruction. These slides are in the file peer-instruction-iste-programming, uploaded on Moodle.
Blue, italicized text contains instructions for you.
Effective PI questions. RECALL An effective peer-instruction question: Is usually conceptual (avoid long analytic computation) Elicits pre-existing thinking, students alternate conceptions An effective PI question asks students to: Predict results of experiment, or algorithm Apply ideas in new context Relates different representations An effective PI questions contains believable distractors. An effective PI question is not ambiguous not leading not trivial
1. Type: Counting iterations.
How-to: Show a piece of code that executes iterations, such as a for loop or a while loop. Ask students to determine how many times the code gets executed, or what the value of a certain variable is when the loop is exited.
Example: See example on Slide 25 in peer-instruction-iste-programming.
Write the piece of code and the question in the box below. How many times do while loop will get executed? #include <stdio.h> #include <stdlib.h>
int main() { int input;
do {
printf( "1. Play game\n" ); printf( "2. Load game\n" ); printf( "3. Play multiplayer\n" ); printf( "4. Exit\n" ); printf( "Selection: " ); scanf( "%d", &input ); switch ( input ) { case 1: /* Note the colon, not a semicolon */ printf("Playing the game\n"); break; case 2: printf("Loading the game\n"); break; case 3: printf("Playing multiplayer\n"); break; case 4: printf( "Thanks for playing!\n" ); break; default: printf( "Bad input!\n" ); break; } }while(input != 4); }
Write 3-5 choices for the above question. 1. 2 2. 6 3. 4 4. 8 5. 6. ..
Write in the box below what you consider to be the correct answer and why. 4
2. Type: What does this code do?
How-to: Show a piece of code. Ask students about the purpose of the code, that is, what it is supposed to do. Do not ask students to calculate the output. Do not give long programs, keep them under ~10 lines.
Example: See example on Slide 26 in peer-instruction-iste-programming.
Write the piece of code and the question in the box below. What is the purpose of this program? #include <stdio.h>
void recurse ( int count ) /* Each call gets its own copy of count */ { printf( "%d\n", count ); /* It is not necessary to increment count since each function's variables are separate (so each count will be initialized one greater) */ getchar(); recurse ( count + 1 );
}
int main() { recurse ( 1 ); /* First function call, so it starts at one */
return 0; }
Write 3-5 choices for the above question. 1. ..polymorphism 2. ..recursion 3. .inheritance 4. swpping 5. ..
Write in the box below what you consider to be the correct answer and why. recursion
3. Type: Predict the output of the code.
How-to: Show a piece of code. Ask students to calculate its output. Make sure that the code is not too long. Keep it under ~10 lines)
Example: See example on Slide 27 in peer-instruction-iste-programming.
Write the piece of code and the question in the box below.
#include <stdio.h>
void recurse ( int count ) /* Each call gets its own copy of count */ { printf( "%d\n", count ); /* It is not necessary to increment count since each function's variables are separate (so each count will be initialized one greater) */ getchar(); recurse ( count + 1 );
}
int main() { recurse ( 1 ); /* First function call, so it starts at one */
Write in the box below what you consider to be the correct answer and why. 20
4. Type: What will happen if something is changed?
How-to: Show a piece of code. Suggest a change in the code, for example a function call is changed. Ask students what will happen to the output if the change happens.
Example: See example on Slide 28 in peer-instruction-iste-programming.
Write the piece of code and the question in the box below.
What change is made in this? #include <stdio.h>
void count_to_ten ( int count ) { //we only keep counting if we have a value less than ten if ( count < 10 ) { printf("%d",count); getchar(); count_to_ten( count + 1 ); } } int main() { count_to_ten ( 0 ); }
Write in the box below what you consider to be the correct answer and why. 9
5. Type: Debug the code.
How-to: Show a piece of code. Suggest that a certain error exists in the code (for example a particular statement was forgotten). Ask students to what will happen to the output if the error existed in the code?
Example: See example on Slide 29 in peer-instruction-iste-programming.
Write the piece of code and the question in the box below.
#include <stdio.h>
void count_to_ten ( int count ) { //we only keep counting if we have a value less than ten if ( count >10 ) { printf("%d",count); getchar(); count_to_ten( count + 1 ); } } if ( count >10 ) { if ( count >10 ) }
Write 3-5 choices for the above question. 1. .. if ( count >10 ) 2. .. if ( count >10 ) 3. ..void count_to_ten ( int count ) 4. .. printf("%d",count);
Write in the box below what you consider to be the correct answer and why. if ( count >10 ) it should be if ( could<10) as the values are taken less then 10.