Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Indian Institute of Technology Bombay

ISTE Main Workshop on Computer Programming


Assignment: Constructing Peer-Instruction Questions

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 */

return 0;
}



Write 3-5 choices for the above question.
1. ..10
2. 20
3. 3
4. 7
5.
6. ..
7. ..
8. ..

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 3-5 choices for the above question.
1. ..3
2. 7
3. 9
4. 10
5. ..
6. ..
7. ..

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.

You might also like