## Question Authors' Forum

### Testing implementation of an answer in C++

by Richard Lobb -
Number of replies: 0

I am doing the fundamental programming in C++, so the syllabus progresses from non-modular programming (learning to use the vocabulary of C++, control using selection and using loops) into modular programming, ie functions and parameter passing. So, is it possible to evaluate students' answers for specific sections of the program?

Assuming I wanted to evaluate the students' understanding of the while loop (without using a function).
while ( number != 0 )
{
remainder = number % 10;
revno = revno * 10 + remainder;
number = number / 10;
}


but not this:

do
{
remainder = number % 10;
revno = revno * 10 + remainder;
number = number / 10;
}while ( number != 0 );


even though they are both correct to be used as a block of code to determine if the number is indeed a palindrome.

How to assess the specific block from the whole program like the one in the attached file?
Can we also provide flexibility for the student's answers, for example in line 29, the condition statement is in one line but the block between lines 30 to 33 is also a correct answer (assuming the question give freedom to that part).