Code Line
stringclasses 57
values | User Explanation
stringclasses 692
values | Line-Explanation in PCEX
stringclasses 131
values | Annotation Score
float64 1
5
⌀ |
---|---|---|---|
int [] arr = { 1, 2, 3}; | Declares the array we want to use for our assignment | We initialize the array of type int to hold the specified numbers. | 4 |
int [] arr = { 1, 2, 3}; | Declares the array we want to use for our assignment | We initialize the array by separating elements with a comma and enclosing the collection in braces { }. | 3 |
for ( int i = 0; i < arr.length; i++ ) { | This line assures that we loop over all the elements in the array we want to increment | We want to iterate over the array and increment each element in the array by 1. | 4 |
for ( int i = 0; i < arr.length; i++ ) { | This line assures that we loop over all the elements in the array we want to increment | To really change the array as we march across it, we need to use indexes so we can assign an updated value to each position as we go. | 1 |
for ( int i = 0; i < arr.length; i++ ) { | This line assures that we loop over all the elements in the array we want to increment | We need the array indexes to start at 0 (array indexes start from 0) with every integer number up to but not including the array length. | 1 |
arr[i] += 1; | extracts to value at the i-th index of the array and adds 1 to that value. | This statement increments the element at the index i of the array by 1. | 4 |
arr[i] += 1; | then it stores that value back in the array at the i-th index | This statement increments the element at the index i of the array by 1. | 2 |
int num = 15; | variable decleration: declares the number we are trying to divide | We define variable num to store the number that we want to find its smallest divisor. | 4 |
int num = 15; | variable decleration: declares the number we are trying to divide | We could initialize it to any positive integer greater than 1. | 1 |
int num = 15; | variable decleration: declares the number we are trying to divide | In this program, we initialize variable num to 15. | 2 |
int divisor = 2; | variable decleration. Declares the start point of where we want to test from | We initialize variable divisor by 2 because we want to find the smallest divisor except 1. | 2 |
int divisor = 2; | variable decleration. Declares the start point of where we want to test from | We define variable divisor to store the smallest divisor of the number. | 2 |
divisor += 1; | if the loop condition is true, then we increment the divisor by 1 | When the divisor is not a factor of the number, we increment the variable divisor by 1. | 3 |
while (num % divisor != 0) { | checks if the module of the expression is not equal to 0 and will loop until the condition is true. | Since we don't know ahead of time how many times the loop will be repeated, we need to use a while loop. | 2 |
while (num % divisor != 0) { | checks if the module of the expression is not equal to 0 and will loop until the condition is true. | We need to increment the divisor repeatedly as long as the divisor is not a factor of the number. | 2 |
while (num % divisor != 0) { | checks if the module of the expression is not equal to 0 and will loop until the condition is true. | Therefore, we need to use a loop structure. | 1 |
while (num % divisor != 0) { | checks if the module of the expression is not equal to 0 and will loop until the condition is true. | The condition in the while loop tests whether the body of the loop should be repeated, so it should test whether the divisor is not a factor of the number. | 3 |
while (num % divisor != 0) { | checks if the module of the expression is not equal to 0 and will loop until the condition is true. | We could check whether the divisor is not a factor of the number by computing the remainder of the division of the number by the divisor. | 3 |
while (num % divisor != 0) { | if it is not 0, the condition is true which causes the loop to go | Since we don't know ahead of time how many times the loop will be repeated, we need to use a while loop. | 1 |
while (num % divisor != 0) { | if it is not 0, the condition is true which causes the loop to go | We need to increment the divisor repeatedly as long as the divisor is not a factor of the number. | 1 |
while (num % divisor != 0) { | if it is not 0, the condition is true which causes the loop to go | Therefore, we need to use a loop structure. | 1 |
while (num % divisor != 0) { | if it is not 0, the condition is true which causes the loop to go | The condition in the while loop tests whether the body of the loop should be repeated, so it should test whether the divisor is not a factor of the number. | 2 |
while (num % divisor != 0) { | if it is not 0, the condition is true which causes the loop to go | We could check whether the divisor is not a factor of the number by computing the remainder of the division of the number by the divisor. | 2 |
System.out.println("The smallest divisor of " + num + " is " + divisor); | prints to the consol for the user to see what the smallest divisor was of the number | This statement prints to the default standard output stream the smallest divisor of the number. | 4 |
int [] arr = { 1, 2, 3}; | create java array list with all the elements are integers | We initialize the array of type int to hold the specified numbers. | 3 |
int [] arr = { 1, 2, 3}; | create java array list with all the elements are integers | We initialize the array by separating elements with a comma and enclosing the collection in braces { }. | 2 |
for ( int i = 0; i < arr.length; i++ ) { | iterate all elements in the array | We want to iterate over the array and increment each element in the array by 1. | 3 |
for ( int i = 0; i < arr.length; i++ ) { | iterate all elements in the array | To really change the array as we march across it, we need to use indexes so we can assign an updated value to each position as we go. | 2 |
for ( int i = 0; i < arr.length; i++ ) { | iterate all elements in the array | We need the array indexes to start at 0 (array indexes start from 0) with every integer number up to but not including the array length. | 2 |
arr[i] += 1; | Add 1 to i. | This statement increments the element at the index i of the array by 1. | 1 |
arr[i] += 1; | Each iteration will add 1 to the next element in the array. | This statement increments the element at the index i of the array by 1. | 3 |
int num = 15; | declare a integer called num, and assign it's value with 15 | We define variable num to store the number that we want to find its smallest divisor. | 3 |
int num = 15; | declare a integer called num, and assign it's value with 15 | We could initialize it to any positive integer greater than 1. | 2 |
int num = 15; | declare a integer called num, and assign it's value with 15 | In this program, we initialize variable num to 15. | 5 |
int divisor = 2; | declare an integer named divisor, assign it's value to 2. | We initialize variable divisor by 2 because we want to find the smallest divisor except 1. | 4 |
int divisor = 2; | declare an integer named divisor, assign it's value to 2. | We define variable divisor to store the smallest divisor of the number. | 3 |
while (num % divisor != 0) { | write a loop. | Since we don't know ahead of time how many times the loop will be repeated, we need to use a while loop. | 2 |
while (num % divisor != 0) { | write a loop. | We need to increment the divisor repeatedly as long as the divisor is not a factor of the number. | 1 |
while (num % divisor != 0) { | write a loop. | Therefore, we need to use a loop structure. | 5 |
while (num % divisor != 0) { | write a loop. | The condition in the while loop tests whether the body of the loop should be repeated, so it should test whether the divisor is not a factor of the number. | 2 |
while (num % divisor != 0) { | write a loop. | We could check whether the divisor is not a factor of the number by computing the remainder of the division of the number by the divisor. | 1 |
while (num % divisor != 0) { | the condition is "if the remainder of number divided by divisor is not zero", then enter the loop | Since we don't know ahead of time how many times the loop will be repeated, we need to use a while loop. | 1 |
while (num % divisor != 0) { | the condition is "if the remainder of number divided by divisor is not zero", then enter the loop | We need to increment the divisor repeatedly as long as the divisor is not a factor of the number. | 2 |
while (num % divisor != 0) { | the condition is "if the remainder of number divided by divisor is not zero", then enter the loop | Therefore, we need to use a loop structure. | 1 |
while (num % divisor != 0) { | the condition is "if the remainder of number divided by divisor is not zero", then enter the loop | The condition in the while loop tests whether the body of the loop should be repeated, so it should test whether the divisor is not a factor of the number. | 3 |
while (num % divisor != 0) { | the condition is "if the remainder of number divided by divisor is not zero", then enter the loop | We could check whether the divisor is not a factor of the number by computing the remainder of the division of the number by the divisor. | 2 |
divisor += 1; | add 1 to divisor | When the divisor is not a factor of the number, we increment the variable divisor by 1. | 4 |
System.out.println("The smallest divisor of " + num + " is " + divisor); | print the "The smallest divisor of the num(what) is divisor(what). | This statement prints to the default standard output stream the smallest divisor of the number. | 4 |
int num = 1234; | Initialize a number to some value. | We need variable num to store the integer that we want to print its digits. | 3 |
do { | Start the loop where the digits are printed. | We need to process the digits of the integer from right to left and print them. | 3 |
do { | Start the loop where the digits are printed. | Therefore, we need to use a loop structure. | 3 |
do { | Start the loop where the digits are printed. | In this program, we do this by using a do loop. | 3 |
do { | Start the loop where the digits are printed. | The do loop is more appropriate than a while loop because a positive integer always has at least one digit which results in the body of the loop performing at least once. | 2 |
System.out.println(num % 10); | Print the rightmost digit of the current value of num. | Each printed digit is followed by the line separator (e.g. '\n') at the end. | 2 |
System.out.println(num % 10); | Print the rightmost digit of the current value of num. | We need to extract the last digit in the 1's position of the integer. | 4 |
System.out.println(num % 10); | Print the rightmost digit of the current value of num. | For example, if the integer is 1234, we want to extract the digit 4 that is in 1's position of the integer. | 1 |
System.out.println(num % 10); | Print the rightmost digit of the current value of num. | We do this by calculating the remainder of the division of the integer by 10. | 2 |
System.out.println(num % 10); | Print the rightmost digit of the current value of num. | Then, this statement prints the last digit of the integer to the standard output stream. | 4 |
num = num / 10; | Divide num by 10 to remove the rightmost digit. | Therefore, this division will remove the digit that we processed (lastDigit) and we can move on to the next digit. | 3 |
num = num / 10; | Divide num by 10 to remove the rightmost digit. | We truncate the extracted digit that we processed from the original integer by dividing the integer by 10. | 4 |
num = num / 10; | Divide num by 10 to remove the rightmost digit. | Note that this statement performs an integer division because both operand of the / operator are integer. | 1 |
} while (num > 0); | Continue the loop until all of the digits have been printed. | We need to check for termination conditions to avoid infinite loops. | 3 |
} while (num > 0); | Continue the loop until all of the digits have been printed. | The loop should terminate when we run out of digits to process. | 4 |
} while (num > 0); | Continue the loop until all of the digits have been printed. | We could check whether the are more digits left by checking whether the variable num, which gets updated in the body of the do loop, is greater than zero. | 3 |
} while (num > 0); | Continue the loop until all of the digits have been printed. | If variable num is greater than zero, then it must have at least one digit, and in that case, the body of the do loop will be repeated again. | 3 |
} while (num > 0); | Continue the loop until all of the digits have been printed. | The body of the while loop should repeat as long as there are more digits left that we have not processed yet. | 4 |
Scanner scan = new Scanner(System.in); | Create a scanner to get input from the user. | To read the input values from the user, we need to define a Scanner object. | 4 |
Scanner scan = new Scanner(System.in); | Create a scanner to get input from the user. | We need to read and process the values that the user enters. | 3 |
System.out.println("Enter the phone age in years:"); | Ask the user to enter the phone age. | We prompt the user to enter the phone age in years. | 4 |
int phoneAge = scan.nextInt(); | Get the phone age that the user entered. | We read the phone age by calling the nextInt() method because this input is an integer. | 3 |
int phoneAge = scan.nextInt(); | Get the phone age that the user entered. | We need to read the phone age that the user enters and store it in a variable. | 3 |
System.out.println("Enter whether the phone is broken (true or false):"); | Ask the user if the phone is broken. | We prompt the user to enter whether the phone is broken. | 4 |
boolean isBroken = scan.nextBoolean(); | Check whether the user entered true or false to the previous question. | We need to read whether the phone is broken and store it in a variable. | 3 |
boolean isBroken = scan.nextBoolean(); | Check whether the user entered true or false to the previous question. | The variable isBroken is true when the phone is broken, and false otherwise. | 3 |
boolean isBroken = scan.nextBoolean(); | Check whether the user entered true or false to the previous question. | We read whether the phone is broken by calling the nextBoolean() method because this input is a boolean. | 3 |
scan.close(); | Close the scanner since it is not needed any more. | We close the scanner as we do not want to process any input from the user in the rest of the program. | 3 |
boolean needPhone = isBroken || phoneAge >= 3; | Check if the phone is broken or its age is greater than or equal to 3. | We use the || operator (called or) to combine the two conditions. | 3 |
boolean needPhone = isBroken || phoneAge >= 3; | Check if the phone is broken or its age is greater than or equal to 3. | The first condition is to test if the phone is broken and the second condition is to test if the phone age is at least 3 years old. | 4 |
boolean needPhone = isBroken || phoneAge >= 3; | Check if the phone is broken or its age is greater than or equal to 3. | We need two conditions to determine if it is the time for a new phone. | 2 |
System.out.println(needPhone); | Print out whether a new phone is needed. | This statement prints true/false depending on whether it is time to buy a new phone. | 4 |
System.out.println(needPhone); | Print out whether a new phone is needed. | The printed value is followed by an end-of-line character in the end. | 2 |
Scanner scan = new Scanner(System.in); | Create a new scanner to get the user's input. | To read the input value from the user, we need to define a Scanner object. | 4 |
Scanner scan = new Scanner(System.in); | Create a new scanner to get the user's input. | We need to read and process the value that the user enters. | 3 |
System.out.println("Enter an integer for seconds: "); | Ask the user to enter the number of seconds. | We prompt the user to enter the seconds. | 5 |
int seconds = scan.nextInt(); | Get the number entered by the user. | We need to read the seconds that the user enters and store it in a variable. | 3 |
int seconds = scan.nextInt(); | Get the number entered by the user. | We read the seconds by calling the nextInt() method because this input is an integer. | 2 |
scan.close(); | Close the scanner since it is not needed any more. | We close the scanner as we do not want to process any input from the user in the rest of the program. | 4 |
int minutes = seconds / 60; | Get the minutes by dividing the seconds by 60. | To obtain the minutes in seconds, we divide the seconds by 60 because there are 60 seconds in a minute. | 4 |
int minutes = seconds / 60; | Get the minutes by dividing the seconds by 60. | Note that since both operands of division operator are integer, the fractional part of the result is truncated, if there is any. | 1 |
int remainingSeconds = seconds % 60; | Get the remaining seconds by calculating seconds modulo 60. | This is because there are 60 seconds in a minute. | 2 |
int remainingSeconds = seconds % 60; | Get the remaining seconds by calculating seconds modulo 60. | Note that the % operator returns the remainder of the division. | 2 |
int remainingSeconds = seconds % 60; | Get the remaining seconds by calculating seconds modulo 60. | To obtain the remaining seconds after taking away the minutes, we have to take the remainder of the seconds divided by 60. | 3 |
System.out.println(seconds + " seconds is " + minutes + " minutes and " + remainingSeconds + " seconds."); | Print out the seconds, minutes, and remaining seconds. | This statement prints to the default standard output stream the minutes and remaining seconds from the input amount of time in seconds. | 4 |
System.out.println(seconds + " seconds is " + minutes + " minutes and " + remainingSeconds + " seconds."); | Print out the seconds, minutes, and remaining seconds. | The printed text is followed by the end-of-line character at the end. | 2 |
int num = 15; | Initialize num to some number. | We define variable num to store the number that we want to find its smallest divisor. | 3 |
int num = 15; | Initialize num to some number. | We could initialize it to any positive integer greater than 1. | 3 |
int num = 15; | Initialize num to some number. | In this program, we initialize variable num to 15. | 3 |
int divisor = 2; | Initialize divisor to 2 for use in the while loop. | We initialize variable divisor by 2 because we want to find the smallest divisor except 1. | 3 |
int divisor = 2; | Initialize divisor to 2 for use in the while loop. | We define variable divisor to store the smallest divisor of the number. | 2 |
while (num % divisor != 0) { | Loop until a divisor is found. | Since we don't know ahead of time how many times the loop will be repeated, we need to use a while loop. | 3 |
End of preview. Expand
in Dataset Viewer.
YAML Metadata
Warning:
empty or missing yaml metadata in repo card
(https://huggingface.co/docs/hub/datasets-cards)
In code comprehension tasks, students may be asked to explain critical steps of the code. The ability to automatically assess these self-explanations offers a unique opportunity to understand the current state of student knowledge, recognize possible misconceptions, and provide feedback. Annotated datasets are needed to train Artificial Intelligence/Machine Learning approaches for the automated assessment of student explanations. To answer this need, we present a novel corpus called SelfCode which consists of 1,770 sentence pairs of student and expert self-explanations of JAVA code examples along with semantic similarity judgments provided by experts.
Data Set Example
Line of Code | Crowd Sourced Explanation | ExpertExplanation | Annotation Score |
---|---|---|---|
int [] arr = { 1, 2, 3}; | Declares the array we want to use for our assignment | We initialize the array of type int to hold the specified numbers. | 4 |
int num = 15; | variable decleration: declares the number we are trying to divide | We could initialize it to any positive integer greater than 1. | 1 |
divisor += 1; | if the loop condition is true, then we increment the divisor by 1 | When the divisor is not a factor of the number, we increment the variable divisor by 1. | 3 |
int seconds = scan.nextInt(); | Get the number entered by the user. | We read the seconds by calling the nextInt() method because this input is an integer. | 2 |
System.out.println("Enter an integer: "); | Ask the user to enter an integer. | We prompt the user to enter an integer. | 5 |
Data Set Stats
Annotation Label | No. of sentence pairs |
---|---|
1 | 529 |
2 | 507 |
3 | 419 |
4 | 253 |
5 | 62 |
Cite Our Work
If you use the SelfCode data set, please cite our publication:
@article{Chapagain_Risha_Banjade_Oli_Tamang_Brusilovsky_RUs,
title = {SelfCode: An Annotated Corpus and a Model for Automated Assessment of Self-Explanation During Source Code Comprehension},
volume = {36},
url = {https://journals.flvc.org/FLAIRS/article/view/133385},
number = {1},
journal = {The International FLAIRS Conference Proceedings},
author = {Chapagain, Jeevan and Risha, Zak and Banjade, Rabin and Oli, Priti and Tamang, Lasang and Brusilovsky, Peter and Rus, Vasile}
}
- Downloads last month
- 13