{"feature_type": "Question from Code", "problem_stem": "Student question: assign the amount in rain_today to the space rainfall points to | Code context (simplify for kids): int main(int argc, char **argv) { float *rainfall; float rain_today; }", "question": "assign the amount in rain_today to the space rainfall points to", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do I get error with new_post.author = author->name | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents) { if (author == NULL || target == NULL) { return 2; } if (check_friends((User *)author, target) == 1) { return 1; } struct post new_post; new_post.author = author->name; new_post.contents = contents; time_t curtime; new_post.date = &cur", "question": "why do I get error with new_post.author = author->name", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how to fix error for new_post->author = author->name | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents) { if (author == NULL || target == NULL) { return 2; } if (check_friends((User *)author, target) == 1) { return 1; } Post *new_post = malloc(sizeof(Post)); new_post->author = author->name; new_post->contents = contents; time_t curtime; n", "question": "how to fix error for new_post->author = author->name", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this work | Code context (simplify for kids): int check_friends(User *user1, User *user2) { int friends = 1; for (int i = 0; i < MAX_FRIENDS; i++) { if (strcmp((user1->friends[i])->name, user2->name) == 0) { friends = 0; break; } } return friends; }", "question": "does this work", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do I have unitialised values | Code context (simplify for kids): void delete_from_friends(User *user) { for (int i = 0; i < MAX_FRIENDS; i++) { if (user->friends[i] == NULL) {} else { for (int j = 0; j < MAX_FRIENDS; j++) { User *friends_friend = user->friends[i]->friends[j]; if (friends_friend == NULL) {} else if (strcmp(friends_friend->name, user->name) == 0) {", "question": "why do I have unitialised values", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do i have an error with if (friends_friend == NULL) {} | Code context (simplify for kids): void delete_from_friends(User *user) { for (int i = 0; i < MAX_FRIENDS; i++) { if (user->friends[i] == NULL) {} else { for (int j = 0; j < MAX_FRIENDS; j++) { User *friends_friend = user->friends[i]->friends[j]; if (friends_friend == NULL) {} else if (strcmp(friends_friend->name, user->name) == 0) {", "question": "why do i have an error with if (friends_friend == NULL) {}", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Is there a segmentation fault in this | Code context (simplify for kids): Rule *parse_file(FILE *fp) { // Implement this function and remove the stubbed return statement below. Rule *first_rule_ptr = NULL; Rule *last_rule_ptr = NULL; char str[MAXLINE]; while (fgets(str, MAXLINE, fp) != NULL) { if (str[0] == ' ' || str[0] == '\\t' || str[0] == '\\n') {} else if (is_comment_o", "question": "Is there a segmentation fault in this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void fib(int **fib_sequence, int count){ *fib_sequence = malloc(sizeof(int)*count); if (count == 1) { *fib_sequence[0] = 0; } else { *fib_sequence[0] = 0; *fib_sequence[1] = 1; for (int i = 2; i < count; i++) { *fib_sequence[i] = *fib_sequence[i-2] + *fib_sequence[i-1]; } } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: why do I get a segmentation fault", "question": "why do I get a segmentation fault", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ *fib_sequence = malloc(sizeof(int)*count); if (count == 1) { *fib_sequence[0] = 0; } else { *fib_sequence[0] = 0; *fib_sequence[1] = 1; for (int i = 2; i < count; i++) { *fib_sequence[i] = *fib_sequence[i-2] + *fib_sequence[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ int *cur = *fib_sequence cur = malloc(sizeof(int)*count); if (count == 1) { cur[0] = 0; } else { cur[0] = 0; cur[1] = 1; for (int i = 2; i < count; i++) { cur[i] = cur[i-2] + cur[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ int *cur = *fib_sequence cur = malloc(sizeof(int)*count); if (count == 1) { *cur[0] = 0; } else { *cur[0] = 0; *cur[1] = 1; for (int i = 2; i < count; i++) { *cur[i] = *cur[i-2] + *cur[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ int *cur = *fib_sequence cur = malloc(sizeof(int)*count); if (count == 1) { cur[0] = 0; } else { cur[0] = 0; cur[1] = 1; for (int i = 2; i < count; i++) { cur[i] = *cur[i-2] + *cur[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ int *cur = *fib_sequence *cur = malloc(sizeof(int)*count); if (count == 1) { cur[0] = 0; } else { cur[0] = 0; cur[1] = 1; for (int i = 2; i < count; i++) { cur[i] = cur[i-2] + cur[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: generate the first n values in the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ int *cur = **fib_sequence cur = malloc(sizeof(int)*count); if (count == 1) { cur[0] = 0; } else { cur[0] = 0; cur[1] = 1; for (int i = 2; i < count; i++) { cur[i] = cur[i-2] + cur[i-1]; } } }", "question": "", "intention": "generate the first n values in the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { for (int i = 8; i >= 0; i--){ sin_array[i] = sin % 10; sin = sin / 10; } if (sin != 0) { return 1; } else { return 0; } }", "question": "", "intention": "It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { for (int i = 8; i >= 0; i--){ sin_array[i] = sin % 10; sin = sin / 10; } if (sin == 0) { return 0; } else { return 1; } }", "question": "", "intention": "It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: it takes an 9 element integer array representing a candidate SIN number. It returns 0 if the number given is a valid Canadian SIN number, and 1 otherwise. | Code context (simplify for kids): int check_sin(int *sin_array) { int sin_total = 0; for (int i = 0; i < 9; i++){ if (i % 2 == 0){ int result = sin_array[i] * 2; //multiplies every second digit by 2 if (result >= 10) { sin_total += 1 + (result % 10); } else { sin_total += result; } } else { sin_total += sin_array[i]; } } if (sin_tot", "question": "", "intention": "it takes an 9 element integer array representing a candidate SIN number. It returns 0 if the number given is a valid Canadian SIN number, and 1 otherwise.", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): User *find_user(const char *name, const User *head) { User *curr_user = (User *) head; while (curr_user != NULL) { if (strcmp(curr_user->name, name) == 0) { return curr_user; } } return NULL; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void list_users(const User *curr) { User *curr_user = (User *) curr; while (curr_user != NULL) { printf(\"%s\\n\", curr_user->name); curr_user = curr_user->next; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to determine the number of elements in an array", "question": "how to determine the number of elements in an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do we have to assign values to all attributes of a struct when creating a new instance of it", "question": "Do we have to assign values to all attributes of a struct when creating a new instance of it", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { int null_count = 0; for (int i = 0; i < capacity; i++) { if (src[i] == '\\0') { // When src is less than or equal to capacity to be copied null_count += (capacity - i); break; } } if (null_count != 0) { for (int j = 0; j < capacity - null_count;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; for ( ; i < capacity; i++) { dest[i] = '\\0'; } } return dest; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { int null_count = 0; for (int i = 0; i < capacity; i++) { if (src[i] == '\\0') { // When src is less than or equal to capacity to be copied null_count += (capacity - i); break; } } if (null_count != 0) { for (int j = 0; j < capacity - null_count;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is the sizeof(int**) equal to sizeof(int*)", "question": "is the sizeof(int**) equal to sizeof(int*)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Get parent process to wait for all child process to complete", "question": "", "intention": "", "task_description": "Get parent process to wait for all child process to complete", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when a message with newlines is sent to a client from a server should the message end with one network newline or does the network newline replace all newline characters in the message", "question": "when a message with newlines is sent to a client from a server should the message end with one network newline or does the network newline replace all newline characters in the message", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to use memset vs when to malloc", "question": "When to use memset vs when to malloc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to copy a char array to a char pointer", "question": "how to copy a char array to a char pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use select", "question": "how to use select", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: print list | Code context (simplify for kids): int *make_list() { int list[3] = {1, 2, 3}; return list; } int main() { int *l = make_list(); int i; for (i = 0; i < 3; i++) { printf(\"%d\\n\", l[i]); } return 0; }", "question": "print list", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: does initializing a char array include the null terminator", "question": "does initializing a char array include the null terminator", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: store literal dynamically | Code context (simplify for kids): char *word = malloc(6 * sizeof(char)); *word = \"hello\";", "question": "store literal dynamically", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can strcpy alter string literal", "question": "can strcpy alter string literal", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to guarantee order of output for child processes when forking", "question": "how to guarantee order of output for child processes when forking", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include #include #include int main(int argc, char **argv) { int ret; int sum = 0; int status; for (int i = 1; i < argc; i++) { ret = fork(); if (ret < 0) { perror(\"fork\"); exit(1); } else if (ret == 0) { int len = strlen(argv", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is dup2 used for", "question": "what is dup2 used for", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: modify the program so that the new children do not create additional processes. Only the original parent calls fork ITERATIONS times. Keep the printf call for all processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "modify the program so that the new children do not create additional processes. Only the original parent calls fork ITERATIONS times. Keep the printf call for all processes.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to fork children processes in parallel and make the parent wait for all the childern", "question": "how to fork children processes in parallel and make the parent wait for all the childern", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: fork 5 child proccess in parallel and make the parent process wait until all child processes have terminated", "question": "", "intention": "", "task_description": "fork 5 child proccess in parallel and make the parent process wait until all child processes have terminated", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to fork childern sequentially and not in parallel", "question": "how to fork childern sequentially and not in parallel", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: execvp: No such file or directory why am i getting this error", "question": "execvp: No such file or directory why am i getting this error", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this compiling and executing this result in a segmentation fault? | Code context (simplify for kids): int main(int argc, char **argv) { // TODO: Verify that command line arguments are valid. if (argc != 2) { return 2; //returning with code 2 } // TODO: Parse arguments and then call the two helpers in sin_helpers.c // to verify the SIN given as a command line argument. int sin_number = strtol(argv[1]", "question": "Why does this compiling and executing this result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does calling this function with appropriate parameters result in a segmentation fault? | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { //setting up dummy variables to test whether sin is a 9 digit in int dummy = sin; int count = 0; while (dummy != 0) { dummy = dummy / 10; count = count + 1; } if (count != 9) { //10 didn't divide into sin exactly 9 times, thus the number is not a 9 digit", "question": "Does calling this function with appropriate parameters result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Will executing main result in a segmentation fault? | Code context (simplify for kids): #include int check_sin(int *sin_array) { if (sin_array[0] == 0) { //assignment simplification: if it starts with 0 its invalid return 0; } else { int result[9]; int sum = 0; for (int i = 0; i < 9; i++) { if (i % 2 == 0) { //even indices get multiplied by 1 result[i] = sin_array[i]; //the r", "question": "Will executing main result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does executing main result in a segmentation fault? | Code context (simplify for kids): #include int populate_array(int sin, int *sin_array) { //setting up dummy variables to test whether sin is a 9 digit in int dummy = sin; int count = 0; while (dummy != 0) { dummy = dummy / 10; count = count + 1; } if (count != 9) { //10 didn't divide into sin exactly 9 times, thus the numb", "question": "Does executing main result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does executing this code result in a segmentation fault? | Code context (simplify for kids): #include int populate_array(int sin, int *sin_array) { //setting up dummy variables to test whether sin is a 9 digit in int dummy = sin; int count = 0; while (dummy != 0) { dummy = dummy / 10; count = count + 1; } if (count != 9) { //10 didn't divide into sin exactly 9 times, thus the numb", "question": "Does executing this code result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does executing this code result in a segmentation fault? | Code context (simplify for kids): #include int populate_array(int sin, int *sin_array) { //setting up dummy variables to test whether sin is a 9 digit in int dummy = sin; int count = 0; while (dummy != 0) { dummy = dummy / 10; count = count + 1; } if (count != 9) { //10 didn't divide into sin exactly 9 times, thus the numb", "question": "Does executing this code result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does executing this produce a segmentation fault? | Code context (simplify for kids): #include int populate_array(int sin, int *sin_array) { //setting up dummy variables to test whether sin is a 9 digit in int dummy = sin; int count = 0; while (dummy != 0) { dummy = dummy / 10; count = count + 1; } if (count != 9) { //10 didn't divide into sin exactly 9 times, thus the numb", "question": "Why does executing this produce a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does running this produce a segmentation fault? | Code context (simplify for kids): #include int check_sin(int *sin_array) { if (sin_array[0] == 0) { //assignment simplification: if it starts with 0 its invalid return 0; } else { int result[9]; int sum = 0; for (int i = 0; i < 9; i++) { if (i % 2 == 0) { //even indices get multiplied by 1 result[i] = sin_array[i]; //the r", "question": "Why does running this produce a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Outputs 1 | Code context (simplify for kids): #include int check_sin(int *sin_array) { if (sin_array[0] == 0) { //assignment simplification: if it starts with 0 its invalid return 0; } else { int result[9]; int sum = 0; for (int i = 0; i < 9; i++) { if (i % 2 == 0) { //even indices get multiplied by 1 result[i] = sin_array[i]; //the r", "question": "", "intention": "Outputs 1", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does running this result in a segmentation fault? | Code context (simplify for kids): #include int check_sin(int *sin_array) { if (sin_array[0] == 0) { //assignment simplification: if it starts with 0 its invalid return 1; } else { int result[9]; int sum = 0; for (int i = 0; i < 9; i++) { if (i % 2 == 0) { //even indices get multiplied by 1 result[i] = sin_array[i]; //the r", "question": "Why does running this result in a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Would the lines of code compile and execute without error always? | Code context (simplify for kids): int x; int *p = &x; printf(\"%d\\n\", *p);", "question": "Would the lines of code compile and execute without error always?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Would the code compile and execute without error all the time? | Code context (simplify for kids): char arr[11] = \"Basket\"; strcat(arr, \"ball\"); printf(\"%s\\n\", arr);", "question": "Would the code compile and execute without error all the time?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Would this code always compile and execute without error? | Code context (simplify for kids): char str[] = \"CSC209\"; char *s = \"CSC209S\"; s[6] = '\\0'; printf(\"%d\\n\", strcmp(str, s));", "question": "Would this code always compile and execute without error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this code always compile and run without error | Code context (simplify for kids): char *get_extension(char •str) { char ext[4]; char *p; if ((p = strchr(str, '.')) != NULL) { strncpy(ext, p, 4); ext[3] = '\\0'; return ext; } else { return NULL; } } printf(\"%s\\n\", get_extension(\"run.c\"));", "question": "Does this code always compile and run without error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does running this code cause any errors such as segmentation fault | Code context (simplify for kids): char *get_extension(char *str) { char ext[4]; char *p; if ((p = strchr(str, '.')) != NULL) { strncpy(ext, p, 4); ext[3] = '\\0'; return ext; } else { return NULL; } } printf(\"%s\\n\", get_extension(\"run.c\"));", "question": "Does running this code cause any errors such as segmentation fault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why am I having a memory leakage from this? | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; int print_user(const User *user) { if (user == NULL) { return 1; } else { // Prints the profil", "question": "Why am I having a memory leakage from this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why am I having a memory leakage? It seems like the pic is being closed by fclose(pic); | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; int print_user(const User *user) { if (user == NULL) { return 1; } else { // Prints the profil", "question": "Why am I having a memory leakage? It seems like the pic is being closed by fclose(pic);", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string.h is memset. */", "question": "", "intention": "", "task_description": "/* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string.h is memset. */", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 4 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Building a dynamic array containing the first n elements of the Fibonacci sequence | Code context (simplify for kids): void fib(int **fib_sequence, int count){ *fib_sequence = malloc(sizeof(int) * count); if (count >= 1){ (*fib_sequence)[0] = 0; } if (count >= 2){ (*fib_sequence)[1] = 1; } if (count >= 3){ for (int i = 2; i < count; i++){ (*fib_sequence)[i] = (*fib_sequence)[i-2] + (*fib_sequence)[i-1]; } } } int ma", "question": "", "intention": "Building a dynamic array containing the first n elements of the Fibonacci sequence", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * Convert a 9 digit int to a 9 element int array. */ | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { int temp = sin; int size = 0; while (temp != 0){ temp /= 10; size ++; } if (size != 9) { return 1; } else { for (int i = size - 1; i >= 0; i--){ sin_array[i] = sin % 10; sin /= 10; } return 0; } }", "question": "", "intention": "/* * Convert a 9 digit int to a 9 element int array. */", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int populate_array(int sin, int *sin_array) { int temp = sin; int size = 0; while (temp != 0){ temp /= 10; size ++; } if (size != 9) { return 1; } else { for (int i = size - 1; i >= 0; i--){ sin_array[i] = sin % 10; sin /= 10; } return 0; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Open a file and print each line in the file to standard output | Code context (simplify for kids): FILE *file; char line[4096]; file = fopen(user->profile_pic, \"r\"); while (fgets(line, 4096, file) != NULL) { printf(\"%s\", line); } fclose(file);", "question": "", "intention": "Open a file and print each line in the file to standard output", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: STORE the name of the file. Then you read the file and immediately print it back out. You can do this in pieces and never store the entire thing. If you think about it for a while, you will realize that you don't need to assume a maximum line length for using fgets. | Code context (simplify for kids): FILE *file; char line[4096]; char string[32]; strncpy(string, user->profile_pic, 32); file = fopen(string, \"r\"); while (fgets(line, 4096, file) != NULL) { printf(\"%s\", line); } fclose(file);", "question": "", "intention": "STORE the name of the file. Then you read the file and immediately print it back out. You can do this in pieces and never store the entire thing. If you think about it for a while, you will realize that you don't need to assume a maximum line length for using fgets.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: You will need to use fork and execvp to the run the command specified by an action. Fortunately in Part 1, you already prepared the array of arguments to pass into execvp. The parent process should wait for each child to complete. If the child terminates with a non-zero exit status, the parent should also terminate with a non-zero exit status. This means that pmake will stop when it encounters an | Code context (simplify for kids): #include #include #include #include #include #include #include #include \"pmake.h\" void execute_action(Action *action) { printf(\"%s\\n\", *action->args); pid_t pid = fork(); if (pid == 0) { execvp(action->args[0], action", "question": "You will need to use fork and execvp to the run the command specified by an action. Fortunately in Part 1, you already prepared the array of arguments to pass into execvp. The parent process should wait for each child to complete. If the child terminates with a non-zero exit status, the parent should also terminate with a non-zero exit status. This means that pmake will stop when it encounters an ", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: syntax for strtol", "question": "syntax for strtol", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does scanf work?", "question": "how does scanf work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does malloc work?", "question": "how does malloc work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does strncpy do?", "question": "what does strncpy do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: How does strncpy work?", "question": "", "intention": "", "task_description": "How does strncpy work?", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How does wait work?", "question": "How does wait work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are the attributes of the struct time_t", "question": "what are the attributes of the struct time_t", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does bind work", "question": "how does bind work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how to find a character in a character array without a null terminator", "question": "", "intention": "", "task_description": "how to find a character in a character array without a null terminator", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: print hello world | Code context (simplify for kids): print(\"Helloworld\");", "question": "print hello world", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: print Hello world | Code context (simplify for kids): printf(\"Hello world\");", "question": "print Hello world", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: print Hello world | Code context (simplify for kids): printf(\"Hello world\\n\");", "question": "print Hello world", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is valgrind?", "question": "what is valgrind?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the best way to debug c code?", "question": "what is the best way to debug c code?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is a null pointer different from null?", "question": "is a null pointer different from null?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to count number of spaces in a string", "question": "how to count number of spaces in a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does getopt do?", "question": "what does getopt do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the exec function do", "question": "what does the exec function do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use dup2", "question": "how to use dup2", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use stat()", "question": "how to use stat()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is asprintf and how do i use it", "question": "what is asprintf and how do i use it", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is line 3 doing | Code context (simplify for kids): FLAGS = -Wall - g - std = gnu99 all : classifier test_load_data classifier : dectree.o classifier.o gcc ${FLAGS} - o classifier dectree.o classifier.o - lm test_load_data : dectree.o test_load_data.o gcc ${FLAGS} - o test_load_data dectree.o test_load_data.o - lm classifier.o : classifier.c dectree.", "question": "what is line 3 doing", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: in a makefile, are actions called if a target has no dependencies?", "question": "in a makefile, are actions called if a target has no dependencies?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does wait() do?", "question": "what does wait() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does dup2() do?", "question": "what does dup2() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use pipe()", "question": "how to use pipe()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What value is returned by scanf when the input stream is closed?", "question": "What value is returned by scanf when the input stream is closed?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the EOF symbol in C?", "question": "What is the EOF symbol in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What is wrong with this code? | Code context (simplify for kids): #include #include void fib(int **arr, int n) { *arr = malloc(sizeof(int) * n); *arr[0] = 0; int index = 1; if (n>=2) { *arr[1] = 1; index = 2; } while (index < n) { *arr[index] = *arr[index - 1] + *arr[index -2]; index ++; } } int main(int argc, char **argv) { /* do not change t", "question": "What is wrong with this code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: build a dynamic array containing the first n fibonacci numbers, assuming that n is greater than or equal to 1. | Code context (simplify for kids): #include #include void fib(int **arr, int n) { *arr = malloc(sizeof(int) * n); *arr[0] = 0; int index = 1; if (n>=2) { *arr[1] = 1; index = 2; } while (index < n) { *arr[index] = *arr[index - 1] + *arr[index -2]; index ++; } } int main(int argc, char **argv) { /* do not change t", "question": "", "intention": "build a dynamic array containing the first n fibonacci numbers, assuming that n is greater than or equal to 1.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i get the output of a shell command in my c program?", "question": "how do i get the output of a shell command in my c program?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: in the c programming language, how do i skip the rest of a line using scanf once I've gotten the data I wanted to use?", "question": "in the c programming language, how do i skip the rest of a line using scanf once I've gotten the data I wanted to use?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i skip the rest of the line using scanf if there are spaces remaining?", "question": "how do i skip the rest of the line using scanf if there are spaces remaining?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I pipe the output of \"ls -l\" into a c program, how can I use scanf to get the size of each file?", "question": "If I pipe the output of \"ls -l\" into a c program, how can I use scanf to get the size of each file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968 | Code context (simplify for kids): #include #include int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } int size = strtol(argv[1], NULL, 10); int total = 0; int cur; char permissions[11]; scanf(\"%*s %*d\"); while (scanf(\"%s %*d", "question": "", "intention": "I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968 | Code context (simplify for kids): #include #include int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } int size = strtol(argv[1], NULL, 10); //int total = 0; int cur; char permissions[11]; while (scanf(\"%s %*d %*s %*s %d %*s\"", "question": "I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should use scanf to output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968", "question": "", "intention": "", "task_description": "I am piping the following output into this code: -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz it should use scanf to output: -rwx------1734 -rw------- 21510 -rwxr-xr-x 8968", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: after passing sin_array into the populate_array function, how do i access the modified array? | Code context (simplify for kids): #include #include int populate_array(int, int *); int check_sin(int *); int main(int argc, char **argv) { // TODO: Verify that command line arguments are valid. if (argc != 2) { return 2; } // TODO: Parse arguments and then call the two helpers in sin_helpers.c // to verify the ", "question": "after passing sin_array into the populate_array function, how do i access the modified array?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How can I use time_t and ctime to get the current date/time as a string in the following format: \"Friday Jan 27 23:01:00 2023\"", "question": "How can I use time_t and ctime to get the current date/time as a string in the following format: \"Friday Jan 27 23:01:00 2023\"", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code not correctly set the friend_of_deleted->friends[j] element to NULL? I want to delete the element user_to_be_deleted from the array called friend_of_deleted->friends | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *user_to_be_deleted = find_user(name, *user_ptr_del); // Check existence if (user_to_be_deleted == NULL) { return 1; } // Delete from main user list if first if (*user_ptr_del == user_to_be_deleted) { *user_ptr_del = (*user_ptr_del)->next", "question": "Why does this code not correctly set the friend_of_deleted->friends[j] element to NULL? I want to delete the element user_to_be_deleted from the array called friend_of_deleted->friends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code not correctly set the friend_of_deleted->friends[j] element to NULL? I want to delete the element user_to_be_deleted from the array called friend_of_deleted->friends | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *user_to_be_deleted = find_user(name, *user_ptr_del); // Check existence if (user_to_be_deleted == NULL) { return 1; } // Delete from main user list if first if (*user_ptr_del == user_to_be_deleted) { *user_ptr_del = (*user_ptr_del)->next", "question": "Why does this code not correctly set the friend_of_deleted->friends[j] element to NULL? I want to delete the element user_to_be_deleted from the array called friend_of_deleted->friends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: friend_of_deleted->friends contains the element user_to_be_deleted. This element should be deleted. | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *user_to_be_deleted = find_user(name, *user_ptr_del); // Check existence if (user_to_be_deleted == NULL) { return 1; } // Delete from main user list if first if (*user_ptr_del == user_to_be_deleted) { *user_ptr_del = (*user_ptr_del)->next", "question": "", "intention": "friend_of_deleted->friends contains the element user_to_be_deleted. This element should be deleted.", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: allocate memory to a node and then set it's value to \"hello\"", "question": "", "intention": "", "task_description": "allocate memory to a node and then set it's value to \"hello\"", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: count the amount of words in string | Code context (simplify for kids): #include #include #include #include #include int count_words(char *sentence) { int count = 0; char* token = strtok(sentence, \" \"); while (token) { token++; token = strtok(NULL, \" \"); } return count; } int main() { int n; n = count_words(\"gcc -Wal", "question": "count the amount of words in string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: count the amount of words in string | Code context (simplify for kids): #include #include #include #include #include int count_words(char *sentence) { int count = 0; char* token = strtok(sentence, \" \"); while (token) { count++; token = strtok(NULL, \" \"); } return count; } int main() { int n; n = count_words(\"gcc -Wal", "question": "count the amount of words in string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: function to count the number of words in a string", "question": "", "intention": "", "task_description": "function to count the number of words in a string", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this return a bus error | Code context (simplify for kids): #include #include #include #include #include int count_words(char *sentence) { int count = 0; char *token = strtok(sentence, \" \"); while (token) { count++; printf(\"token: %s\\n\", token); token = strtok(NULL, \" \"); } return count; } int main() { ch", "question": "why does this return a bus error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how are pointers used with structs?", "question": "how are pointers used with structs?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: could you explain what printf does?", "question": "could you explain what printf does?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): for (int i = 0; i < 5; i++){ printf(i); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can you declare two variables of the same type on one line?", "question": "can you declare two variables of the same type on one line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you find current time using time and ctime functions?", "question": "how do you find current time using time and ctime functions?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does fseek return?", "question": "what does fseek return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how would you free nodes in a linked list?", "question": "how would you free nodes in a linked list?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you split a string on spaces?", "question": "How do you split a string on spaces?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you write me a function that checks whether a string has any non-space characters?", "question": "Can you write me a function that checks whether a string has any non-space characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I calculate how many space separated words make up a line of a file?", "question": "how do I calculate how many space separated words make up a line of a file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the return type of stat? and how do i call it to determine the last time a file was modified?", "question": "what is the return type of stat? and how do i call it to determine the last time a file was modified?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to generate a random number from 0-99 inclusive using random function?", "question": "how to generate a random number from 0-99 inclusive using random function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): for (;;) { ; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to set an alarm using setitimer and ITIMER_PROF?", "question": "how to set an alarm using setitimer and ITIMER_PROF?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): struct itimerval new_time, old_time; new_time.it_interval.tv_usec = 0; new_time.it_interval.tv_sec = 5; new_time.it_value.tv_usec = 0; new_time.it_value.tv_sec = seconds; setitimer(ITIMER_PROF, &new_time, &old_time);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): struct itimerval new_time, old_time; new_time.it_interval.tv_usec = 0; new_time.it_interval.tv_sec = 0; new_time.it_value.tv_usec = 0; new_time.it_value.tv_sec = seconds; setitimer(ITIMER_PROF, &new_time, &old_time);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you make an alarm that will send the SIGPROF signal to a program while it's executing", "question": "how do you make an alarm that will send the SIGPROF signal to a program while it's executing", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: I need this code to exit(0) when the timer sends a SIGPROF to the process | Code context (simplify for kids): /* The purpose of this program is to practice writing signal handling * functions and observing the behaviour of signals. */ #include #include #include #include #include /* Message to print in the signal handling function. */ #define MESSAGE \"%", "question": "I need this code to exit(0) when the timer sends a SIGPROF to the process", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is char**", "question": "what is char**", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to dereference char**?", "question": "how to dereference char**?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): print(\"Hello World\")", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main() { int i = 2; int j = 30; int a[4]; int *p; int *q; p = &i; j = *p; *p = 1; a[0] = 10; a[3] = 12; a[i] = 11; return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what will be the value of pA after execution? | Code context (simplify for kids): int A[4] = {5, 10, 15, 20}; int *pA = A[0]; pA += 1;", "question": "what will be the value of pA after execution?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what will be the value of pA after execution? why? | Code context (simplify for kids): int A[4] = {5, 10, 15, 20}; int *pA = A[0]; pA += 1;", "question": "what will be the value of pA after execution? why?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: given an array of four random integers called arr, and a pointer to an integer called point, assign point to be the address of the last element in arr", "question": "given an array of four random integers called arr, and a pointer to an integer called point, assign point to be the address of the last element in arr", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are strings in C?", "question": "what are strings in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: give an example of a linked list in C using structs", "question": "give an example of a linked list in C using structs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: make a linked list using structs", "question": "", "intention": "", "task_description": "make a linked list using structs", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: in C, does scanf read until the newline?", "question": "in C, does scanf read until the newline?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: read past the first newline of scanf", "question": "read past the first newline of scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `scanf(\"%*c%d\", &number)` with usage examples and explanations", "question": "generate a detailed documentation of `scanf(\"%*c%d\", &number)` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: skip the first line of scanf", "question": "skip the first line of scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): scanf(\"%c%s %*s %*s %*s %s\", &type, perms, file_mem)", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `%*[^\\n]` with usage examples and explanations", "question": "generate a detailed documentation of `%*[^\\n]` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the format specifier for a char", "question": "what is the format specifier for a char", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: first character is empty when using the format specifier %*[^\\n]", "question": "first character is empty when using the format specifier %*[^\\n]", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: discard newline in scanf", "question": "discard newline in scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to call a function located in file A from file B in the C programming language", "question": "how to call a function located in file A from file B in the C programming language", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code return 1? | Code context (simplify for kids): if (-1) { return 1; } return 0;", "question": "will this code return 1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: %3s in scanf will only check for 3 characters?", "question": "%3s in scanf will only check for 3 characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: expected ‘char **’ but argument is of type ‘char (*)[50]’ how would i fix this issue?", "question": "expected ‘char **’ but argument is of type ‘char (*)[50]’ how would i fix this issue?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why would this code have issues? | Code context (simplify for kids): void ask(char *arg[20]); int main() { char potato[20]; ask(&potato); return 0; }", "question": "why would this code have issues?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is the null pointer always added to a string?", "question": "is the null pointer always added to a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what would tar -czvf do?", "question": "what would tar -czvf do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is $@ and $^ in bash scripting?", "question": "what is $@ and $^ in bash scripting?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is $@, $^, and $< in bash scripting?", "question": "what is $@, $^, and $< in bash scripting?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is % in bash scripting?", "question": "what is % in bash scripting?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is % in bash scripting for a makefile?", "question": "what is % in bash scripting for a makefile?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: pointer arithmetic with an array looks like?", "question": "pointer arithmetic with an array looks like?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does sizeof function of an array return the length?", "question": "does sizeof function of an array return the length?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: let there be char **argv. when we do argv + 1, we are starting from the second element in the argv array of char pointers?", "question": "let there be char **argv. when we do argv + 1, we are starting from the second element in the argv array of char pointers?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does line 2 give the number of elements in argv? | Code context (simplify for kids): char **argv; sizeof(argv) / sizeof(char**)", "question": "does line 2 give the number of elements in argv?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Explain the strtok function in C. What is a token and a delimiter? How are they used?", "question": "Explain the strtok function in C. What is a token and a delimiter? How are they used?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: In C, if i call the error function with a string, it would print an error with that string? For example, if I had error(\"too many characters\"); then the error would be \"too many characters\"?", "question": "In C, if i call the error function with a string, it would print an error with that string? For example, if I had error(\"too many characters\"); then the error would be \"too many characters\"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: On line 2, why does this not work? Why do we need to use strcpy? | Code context (simplify for kids): char s[] = \"Hello\"; s = \"Bye\";", "question": "On line 2, why does this not work? Why do we need to use strcpy?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does variable p get assigned to Smith after the program ends? | Code context (simplify for kids): char s[] = \"Hello\"; s = \"Bye\"; char *p = \"Joe\"; p = \"Smith\";", "question": "Does variable p get assigned to Smith after the program ends?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does p get assigned to \"Smith\" but s does not get assigned to \"Bye\"? | Code context (simplify for kids): char s[] = \"Hello\"; s = \"Bye\"; char *p = \"Joe\"; p = \"Smith\";", "question": "Why does p get assigned to \"Smith\" but s does not get assigned to \"Bye\"?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Why can you not reassign arrays in C? Is there a historical explanation for this?", "question": "Why can you not reassign arrays in C? Is there a historical explanation for this?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why can you not re-assign arrays?", "question": "Why can you not re-assign arrays?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Will this work properly in C? | Code context (simplify for kids): char s[] = \"Hello\"; char s[] = \"Goodbye\";", "question": "Will this work properly in C?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is memcpy? how does it work? why?", "question": "what is memcpy? how does it work? why?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What will be the behaviour of this program? Will the strncpy keep on copying all 10 bytes or will it know that s contains space for only 5 bytes and stop? | Code context (simplify for kids): char s[5]; strncpy(s, \"hello world!!!!!!\", 10);", "question": "What will be the behaviour of this program? Will the strncpy keep on copying all 10 bytes or will it know that s contains space for only 5 bytes and stop?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to code in C", "question": "how to code in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to input a string", "question": "how to input a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char phone[11]; int keypad; scanf(\"%s %d\", &phone, &keypad);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to compare two strings", "question": "How to compare two strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: what malloc is incorrectly allocated | Code context (simplify for kids): int **result = malloc(sizeof(int*) * 2); result[0] = malloc(sizeof(int) * ((length + 1)/ 2)); result[1] = malloc(sizeof(int) * length / 2);", "question": "", "intention": "what malloc is incorrectly allocated", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to change a string array", "question": "how to change a string array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to mutate a char array.", "question": "how to mutate a char array.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: creating a copy of s char | Code context (simplify for kids): char tempString[strlen(s)] = s; strncpy(s, tempString, n); strlen(tempString);", "question": "", "intention": "creating a copy of s char", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to add a item at the end of linked list", "question": "how to add a item at the end of linked list", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: open the file and assign it to user profile pic | Code context (simplify for kids): int update_pic(User *user, const char *filename) { if (sizeof(filename) > 31) { return 2; } else if (fopen(filename, \"r\") == NULL) { return 1; } else { strncpy(user->profile_pic, filename, 32); }", "question": "", "intention": "open the file and assign it to user profile pic", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to compare two strings", "question": "how to compare two strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: check if string array is empty", "question": "check if string array is empty", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: author a struct should point to new post which is another struct | Code context (simplify for kids): (User *)author->first_post = &newPost;", "question": "", "intention": "author a struct should point to new post which is another struct", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: author struct should point to newpost which is another struct | Code context (simplify for kids): author->first_post = &newPost;", "question": "", "intention": "author struct should point to newpost which is another struct", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: author struct with property first_post should point to another struct newpost | Code context (simplify for kids): author->first_post = newPost;", "question": "", "intention": "author struct with property first_post should point to another struct newpost", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: author first post should point to new post | Code context (simplify for kids): Post *newPost = malloc(sizeof(Post)); author->first_post = newPost;", "question": "", "intention": "author first post should point to new post", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: author first post should newPost | Code context (simplify for kids): Post *newPost = malloc(sizeof(Post)); author->first_post = newPost; strncpy(newPost->author, author->name, MAX_NAME); newPost->author[MAX_NAME-1] ='\\0'; newPost->contents = contents; newPost->next = NULL;", "question": "", "intention": "author first post should newPost", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: insert before the first_post | Code context (simplify for kids): Post *prevPost = target->first_post; newPost->next = prevPost; target->first_post = newPost;", "question": "", "intention": "insert before the first_post", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: new post should be inserted infront of the list | Code context (simplify for kids): Post *newPost = malloc(sizeof(Post)); strncpy(newPost->author, author->name, MAX_NAME); newPost->author[MAX_NAME-1] ='\\0'; newPost->contents = contents; if (target->first_post == NULL) { newPost->next = NULL; target->first_post = newPost; } else { newPost->next = target->first_post; target->first_po", "question": "", "intention": "new post should be inserted infront of the list", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: storing current time as a date in newPost | Code context (simplify for kids): time_t current_time = time(NULL); newPost->date = ¤t_time;", "question": "", "intention": "storing current time as a date in newPost", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove curr from curr friend's list. | Code context (simplify for kids): for (int i = 0; i < MAX_FRIENDS; i++) { User *userFriend = find_user(curr->friends[i]->name, *user_ptr_del); if (userFriend != NULL) { for (int j = 0; j < MAX_FRIENDS; j++) { if (userFriend->friends[j] != NULL && strcmp(userFriend->friends[j]->name, curr->name) == 0) { userFriend->friends[j] = NULL;", "question": "", "intention": "remove curr from curr friend's list.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: copy char from src to dest | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { //dest = destination string // copy from source and dest int counter = 0; while (src[counter] != '\\0' || counter < capacity) { dest[counter] = src[counter]; } dest[counter - 1] = '\\0'; return dest; }", "question": "", "intention": "copy char from src to dest", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: checking if current token is a colon | Code context (simplify for kids): if (strcmp(token, \":\") == 0) { bool = 1; }", "question": "", "intention": "checking if current token is a colon", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: I am getting a segmentation fault when I run this on a bitmap display", "question": "I am getting a segmentation fault when I run this on a bitmap display", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I am getting a segmentation fault on this code", "question": "I am getting a segmentation fault on this code", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the mask do for sigaction?", "question": "what does the mask do for sigaction?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what types of signals cannot be blocked?", "question": "what types of signals cannot be blocked?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): struct itimerval timer_info; // Makes alarm happen only once timer_info.it_interval.tv_sec = 0; timer_info.it_interval.tv_usec = 0; // Sent it after s seconds timer_info.it_value.tv_sec = 1; timer_info.it_value.tv_usec = 0; if (setitimer(ITIMER_PROF, &timer_info, NULL) == -1) { perror(\"setitimer\"); ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: To print out the profile of the user | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL) { return 1; } if (user->profile_pic[0] == '\\0'){ FILE *fp; char line[100000]; fp = fopen(user->profile_pic, \"r\"); if (fp == NULL) { printf(\"Error opening file\\n\"); return 1; } while (fgets(line, 10000, fp) != NULL) { printf(\"%s\", line); } fclose(f", "question": "", "intention": "To print out the profile of the user", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Free the memory correctly | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents) { if (author == NULL || target == NULL) { return 2; } bool is_friends = false; for (int i = 0; i < MAX_FRIENDS; i++) { if (target->friends[i] == author) { is_friends = true; break; } } if (!is_friends) { return 1; } Post *new_post = (Po", "question": "", "intention": "Free the memory correctly", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Part of a function called run_make which should check if the target in the make file exists nd is up to date. | Code context (simplify for kids): // check if the target exists and is up to date struct stat target_stat; struct stat dep_stat; if (stat(rule->target, &target_stat) == 0) { // target file exists int up_to_date = 1; for (Dependency *dep = rule->dependencies; dep != NULL; dep = dep->next_dep) { if (stat(dep->rule->target, &dep_stat) ", "question": "Part of a function called run_make which should check if the target in the make file exists nd is up to date.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: /* Evaluate the rule in rules corresponding to the given target. If target is NULL, evaluate the first rule instead. If pflag is 0, evaluate each dependency in sequence. If pflag is 1, then evaluate each dependency in parallel (by creating one new process per dependency). In this case, the parent process will wait until all child processes have terminated before checking dependency modified times to decide whether to execute the actions. */", "question": "", "intention": "", "task_description": "/* Evaluate the rule in rules corresponding to the given target. If target is NULL, evaluate the first rule instead. If pflag is 0, evaluate each dependency in sequence. If pflag is 1, then evaluate each dependency in parallel (by creating one new process per dependency). In this case, the parent process will wait until all child processes have terminated before checking dependency modified times to decide whether to execute the actions. */", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: If you type Ctl+C while this function is running then what happens? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "If you type Ctl+C while this function is running then what happens?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: /* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. * Return a dynamically allocated string containing the list of user names. */ | Code context (simplify for kids): char* list_users(const User *curr) { char* result = NULL; int len = 0; while (curr != NULL) { len += strlen(curr->name) + 1; // Add 1 for newline character curr = curr->next; } result = (char*) malloc(len + 1); // Add 1 for null terminator if (result == NULL) { perror(\"malloc\"); exit(1); } char* ptr", "question": "/* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. * Return a dynamically allocated string containing the list of user names. */", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: /* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. * Return a dynamically allocated string containing the list of user names. */ | Code context (simplify for kids): char* list_users(const User *curr) { char* result = NULL; int len = 0; while (curr != NULL) { len += strlen(curr->name) + 1; // Add 1 for newline character curr = curr->next; } result = (char*) malloc(len + 1); // Add 1 for null terminator if (result == NULL) { perror(\"malloc\"); exit(1); } char* ptr", "question": "/* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. * Return a dynamically allocated string containing the list of user names. */", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Will this give a segmentation fault?", "question": "Will this give a segmentation fault?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char* print_user(const User* user) { if (user == NULL) { return NULL; } int length = 0; length += snprintf(NULL, 0, \"Name: %s\\r\\n\\r\\n\", user->name); if (length < 0) { perror(\"snprintf\"); exit(1); } char* output = malloc(length + 1); if (output == NULL) { perror(\"malloc\"); exit(1); } length = strlen(", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: fix my code", "question": "fix my code", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: no segmentation fault | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (!check_perm", "question": "", "intention": "no segmentation fault", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: do you have to initialize strings", "question": "do you have to initialize strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why can't i use scanf to write to a string if i did not initialize the string", "question": "why can't i use scanf to write to a string if i did not initialize the string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I keep getting a segmentation error | Code context (simplify for kids): void fib(int** sequence, int n){ sequence = (int) malloc(sizeof(int) * n); (*sequence)[0] = 0; (*sequence)[1] = 1; for(int i = 2; i amt){ return 0; } char result[45] = \"abc\" ; strncpy(result, target, amt); printf(\"This is the value of the truncated string: %s\\n\", result); return leng - amt ; }", "question": "", "intention": "supposed to take target and store the first amt characters in result.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I want to iterate through elements up until a point. Then if I reach that point, I want to shift each element from that point onwards to the left. | Code context (simplify for kids): for(int i=0; ifriends[i]->name, name) == 0){ //deleted user is in the list. curr->friends[MAX_FRIENDS - 1] = NULL; //Last element must be NULL after deletion. int j = i; for(int j; j < MAX_FRIENDS-1; j++){ //from i(index with deleted user), shift over every el", "question": "", "intention": "I want to iterate through elements up until a point. Then if I reach that point, I want to shift each element from that point onwards to the left.", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): for(int i=0; ifriends[i]->name, name) == 0){ //deleted user is in the list. curr->friends[MAX_FRIENDS - 1] = NULL; //Last element must be NULL after deletion. int j = i; for(int j; j < MAX_FRIENDS-1; j++){ //from i(index with deleted user), shift over every el", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: iterate through all of the User objects. For each user, it checks through the User's list of friends. | Code context (simplify for kids): User *current = *user_ptr_del; while(current != NULL){ printf(\"Now in %s\\n\", current->name); int i=0; for(i; ifriends[i] != NULL) && (strcmp(current->friends[i]->name, name) == 0)){ for(int i; i < MAX_FRIENDS-1; i++){ //from i(index with deleted user), shift over", "question": "", "intention": "iterate through all of the User objects. For each user, it checks through the User's list of friends.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how would i free the space that is allocated to post->contents | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "how would i free the space that is allocated to post->contents", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can I scan multiple lines with scanf", "question": "how can I scan multiple lines with scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: /bin/bash: line 1: [: too many arguments", "question": "/bin/bash: line 1: [: too many arguments", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to read a multiline string using scan f until the end of the string?", "question": "how to read a multiline string using scan f until the end of the string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a pointer", "question": "what is a pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is wrong with this test error? phone_loop_checker.py::TestPhoneLoop::test_valid fail 0 / 1 c_helper.py:125: in _t stdout, stderr, returncode = self._run_exec(args=args, input_=input_, timeout=timeout) c_helper.py:85: in _run_exec return _exec([os.path.join(\".\", self.executable_name)] + (args or []), **kwargs) c_helper.py:475: in _exec raise e from e c_helper.py:471: in _exec stdout, stderr = ", "question": "what is wrong with this test error? phone_loop_checker.py::TestPhoneLoop::test_valid fail 0 / 1 c_helper.py:125: in _t stdout, stderr, returncode = self._run_exec(args=args, input_=input_, timeout=timeout) c_helper.py:85: in _run_exec return _exec([os.path.join(\".\", self.executable_name)] + (args or []), **kwargs) c_helper.py:475: in _exec raise e from e c_helper.py:471: in _exec stdout, stderr = ", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the | Code context (simplify for kids): int main() { char phone[11]; int i; scanf(\"%s\", phone); do { scanf(\"%d\", &i); if (i == -1) { printf(\"%s\\n\", phone); } else if (0 <= i && i <= 9) { printf(\"%c\\n\", phone[i]); } else { printf(\"ERROR\"); return 1; } } while (i != 1); return 0; }", "question": "", "intention": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the | Code context (simplify for kids): int main() { char phone[11]; int i; int result_to_check; scanf(\"%s\", phone); do { result_to_check = scanf(\"%d\", &i); if (i == -1) { printf(\"%s\\n\", phone); } else if (0 <= i && i <= 9) { printf(\"%c\\n\", phone[i]); } else { printf(\"ERROR\"); return 1; } } while (result_to_check != EOF); return 0; }", "question": "", "intention": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does ls -s do", "question": "what does ls -s do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the number next to total in the output of ls -l mean", "question": "what does the number next to total in the output of ls -l mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is strtod in c", "question": "what is strtod in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why is the first argument of argv indexed at 1", "question": "why is the first argument of argv indexed at 1", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when creating strings in C, do we need one extra element to hold any special characters?", "question": "when creating strings in C, do we need one extra element to hold any special characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I take in a string as an argument", "question": "how do I take in a string as an argument", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `fgets` with usage examples and explanations", "question": "generate a detailed documentation of `fgets` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I store a 5 length string from the command line argument", "question": "how do I store a 5 length string from the command line argument", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does c break conditionals early with &&", "question": "does c break conditionals early with &&", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I skip a line from the input with scanf", "question": "how do I skip a line from the input with scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I split a string", "question": "how do I split a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: string formatting doucmentation", "question": "string formatting doucmentation", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is this valid permission[10] = \"---------\\0\";", "question": "is this valid permission[10] = \"---------\\0\";", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: print without special characters", "question": "print without special characters", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you properly compare strings in c", "question": "how do you properly compare strings in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how would I properly point to the parameters | Code context (simplify for kids): int check_permissions(char *current_perms, char *required_perms){ int i; for (i = 0; i < 9; i++) { if (strcmp(required_perms[i], \"-\") == 0 && strcmp(current_perms[i], \"-\") == 0) { return 1; } } return 0; }", "question": "how would I properly point to the parameters", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I compare a string literal with a element of a char array", "question": "how do I compare a string literal with a element of a char array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this format mean | Code context (simplify for kids): %*[^\\n]", "question": "what does this format mean", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can you explain %*[^\\n] in detail", "question": "can you explain %*[^\\n] in detail", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: typecast bool to int in c", "question": "typecast bool to int in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I call helper functions from another file", "question": "how do I call helper functions from another file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does c automatically convert integers to bools in conditionals", "question": "does c automatically convert integers to bools in conditionals", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: provide documentation for strncmp", "question": "provide documentation for strncmp", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does argc include the name of the file", "question": "does argc include the name of the file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: it should compare if the 2 strings are equal | Code context (simplify for kids): if (strlen(argv[1]) == strlen(argv[2]) && strncmp(argv[1], argv[2], strlen(argv[1]) == 0)) { printf(\"Same\\n\"); }", "question": "", "intention": "it should compare if the 2 strings are equal", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: difference between string literal and constant", "question": "difference between string literal and constant", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does adding a null terminator in the middle of a stack allocated string change the pointer of the stack", "question": "does adding a null terminator in the middle of a stack allocated string change the pointer of the stack", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you check if 2 strings are equal", "question": "how do you check if 2 strings are equal", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *a = argv[1]; char *b = argv[2]; if (*a == *b) { printf(\"Same\\n\"); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I check for memory leaks", "question": "how do I check for memory leaks", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: provide code for basic linked list traversal pattern", "question": "provide code for basic linked list traversal pattern", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: c do while", "question": "c do while", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you vie stderror", "question": "how do you vie stderror", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: waht does const do in parameter type", "question": "waht does const do in parameter type", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use time()", "question": "how to use time()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you free a struct", "question": "how do you free a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can I free a pointer but not the object it refers too if I have a copy of the pointer", "question": "can I free a pointer but not the object it refers too if I have a copy of the pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does freeing a char array free the whole array", "question": "does freeing a char array free the whole array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why does fork() not loop infinitely in a program", "question": "why does fork() not loop infinitely in a program", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how do you allocate tokens from strtok into an array", "question": "", "intention": "", "task_description": "how do you allocate tokens from strtok into an array", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): /****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press \"Run\" button to compile and execute it. *************************************************************************", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: In the space below, write a small program that allocates an array of integers in the main function and passes that array to a function called change. (You’ll also need to pass in the length of the array – why?) The function should do two things: • Add 10 to each element of the array. • Return the average of the new contents of the array. | Code context (simplify for kids): /****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press \"Run\" button to compile and execute it. *************************************************************************", "question": "", "intention": "In the space below, write a small program that allocates an array of integers in the main function and passes that array to a function called change. (You’ll also need to pass in the length of the array – why?) The function should do two things: • Add 10 to each element of the array. • Return the average of the new contents of the array.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I use fgets on an int", "question": "How do I use fgets on an int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "question": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the man page for scanf to determine the return value when the input stream is closed.) After each intege", "question": "", "intention": "", "task_description": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the man page for scanf to determine the return value when the input stream is closed.) After each intege", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. The first is a 10 character string and the second is an integer. The program takes no command-line arguments. (You will write this program from scratch, so remember to add, commit, and push.) If the integer is -1, the program prints the full string to stdout. If the integer i is between 0 | Code context (simplify for kids): // Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. #include int main() { char phone[11]; printf(\"Type in a phone number:\\n\"); fgets(phone, 11, stdin); int number; printf(\"Type in a number:\\n\"); scanf(\"%d\", &number); if (number ", "question": "", "intention": "Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. The first is a 10 character string and the second is an integer. The program takes no command-line arguments. (You will write this program from scratch, so remember to add, commit, and push.) If the integer is -1, the program prints the full string to stdout. If the integer i is between 0", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It is supposed to print the digit of the phone number corresponding to the variable number | Code context (simplify for kids): // Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. #include int main() { char phone[11]; printf(\"Type in a phone number:\\n\"); fgets(phone, 11, stdin); int number; printf(\"Type in a number:\\n\"); scanf(\"%d\", &number); if (number ", "question": "", "intention": "It is supposed to print the digit of the phone number corresponding to the variable number", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. char* perms = argv[0]; int sizeLimit = stol(argv[1]) // TODO: Call check_permissions as part of your solution to count t", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *){ }; int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *perm1, char *perm2){ for(int i = 0; i < 10; i++){ if (perm1[i] == '-'){ continue; } if (perm1[i] != perm2[i]){ return 0; } } return 1; }; int main(", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *perm1, char *perm2){ for(int i = 0; i < 10; i++){ if (perm1[i] == '-'){ continue; } if (perm1[i] != perm2[i]){ return 0; } } return 1; }; int main(", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *perm1, char *perm2){ for(int i = 0; i < 10; i++){ if (perm1[i] == '-'){ continue; } if (perm1[i] != perm2[i]){ return 0; } } return 1; }; int main(", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *perm1, char *perm2){ for(int i = 0; i < 10; i++){ if (perm1[i] == '-'){ continue; } if (perm1[i] != perm2[i]){ return 0; } } return 1; }; int main(", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: work | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *perm1, char *perm2){ for(int i = 0; i < 10; i++){ if (perm2[i] == '-'){ continue; } if (perm1[i] != perm2[i]){ return 0; } } return 1; }; int main(", "question": "", "intention": "work", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I use functions defined in another file?", "question": "How do I use functions defined in another file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When do I use -> vs .", "question": "When do I use -> vs .", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When do I use -> vs . ? Provide examples", "question": "When do I use -> vs . ? Provide examples", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are default values for variables in C", "question": "What are default values for variables in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does a program terminate when main returns? Justify your answer.", "question": "Does a program terminate when main returns? Justify your answer.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this work | Code context (simplify for kids): int** code = {{0, 1}, {1, 2}}; int num = code[0][0]; int*** codeptr = &#", "question": "Does this work", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why doesn't this work | Code context (simplify for kids): int** code = {{0, 1}, {1, 2}}; int num = code[0][0]; int*** codeptr = &#", "question": "Why doesn't this work", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is line 3 invalid? Explain using 3-5 sentences. | Code context (simplify for kids): int** code[2][2] = {{0, 1}, {1, 2}}; int num = code[0][0]; int*** codeptr = &#", "question": "Why is line 3 invalid? Explain using 3-5 sentences.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this work? Explain in 3-5 sentences. | Code context (simplify for kids): int** code[2][2] = {{0, 1}, {1, 2}}; int num = code[0][0]; int** codeptr = &#", "question": "Does this work? Explain in 3-5 sentences.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this work? | Code context (simplify for kids): int code[2][2] = {{0, 1}, {1, 2}}; int num = code[0][0]; int** codeptr = &#", "question": "Does this work?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Explain why this code does not work in 3-5 sentences. | Code context (simplify for kids): int code[2][2] = {{0, 1}, {1, 2}}; int num = code[0][0]; int** codeptr = &#", "question": "Explain why this code does not work in 3-5 sentences.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this work? | Code context (simplify for kids): int code[2][2] = {{0, 1}, {1, 2}}; int num = code[0][0]; int** codeptr = &&#", "question": "Does this work?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Can I ever have 2 or more & in a row?", "question": "Can I ever have 2 or more & in a row?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): char** parseLine(char* line) { // Parse the line char** args = malloc(sizeof(char**)); char* arg = strtok(line, \" \"); // Parse the arguments and add them to args while (arg != NULL) { args = realloc(args, sizeof(char**) * (sizeof(args) + 1)); args[sizeof(args)] = arg; arg = strtok(NULL, \" \"); } retu", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This should read the characters from line and generate an array of strings, one per argument | Code context (simplify for kids): char** parseLine(char* line) { // Parse the line char** args = malloc(sizeof(char**)); char* arg = strtok(line, \" \"); // Parse the arguments and add them to args while (arg != NULL) { args = realloc(args, sizeof(char**) * (sizeof(args) + 1)); args[sizeof(args)] = arg; arg = strtok(NULL, \" \"); } retu", "question": "This should read the characters from line and generate an array of strings, one per argument", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Does this work? | Code context (simplify for kids): cur_dep->rule = makeRule(); cur->next_rule = cur_dep->rule; cur = cur->next_rule;", "question": "Does this work?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: compile | Code context (simplify for kids): char* list_users(const User *curr) { const User *og_user = curr; char *user_list = NULL; int size = 11; while (curr != NULL) { size += strlen(curr->name) + 3; curr = curr->next; } user_list = malloc(sizeof(char)*size); if (user_list == NULL) { perror(\"malloc\"); exit(1); } else { strcat(user_list, \"U", "question": "compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i do stuff for sockets", "question": "how do i do stuff for sockets", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When I call gcc on a c file in the terminal, what file type is the output?", "question": "When I call gcc on a c file in the terminal, what file type is the output?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a pointer variable?", "question": "what is a pointer variable?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: are there any bugs? | Code context (simplify for kids): int main() { char phone[11]; int i; scanf(\"%s\", phone); scanf(\"%d\", &i); if (i < -1 || i > 9) { printf(\"ERROR\"); return 1; } else if (i == -1) { printf(\"%s\", phone); } else { printf(\"%c\", phone[i]); } return 0; }", "question": "are there any bugs?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: this is not working | Code context (simplify for kids): int **split_array(const int *s, int length) { int arr[2]; int numEven, numOdd; numOdd = length / 2; if (length % 2 == 0) { numEven = length / 2; } else { numEven = (length / 2) + 1; } arr[0] = malloc(sizeof(int) * numEven); arr[1] = malloc(sizeof(int) * numOdd); for (int i = 0; i < length; i = i + 2", "question": "this is not working", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: not working | Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr[2]; int numEven, numOdd; numOdd = length / 2; if (length % 2 == 0) { numEven = length / 2; } else { numEven = (length / 2) + 1; } arr[0] = malloc(sizeof(int) * numEven); arr[1] = malloc(sizeof(int) * numOdd); for (int i = 0; i < length; i = i +", "question": "not working", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: not working | Code context (simplify for kids): int **split_array(const int *s, int length) { int *arr[2]; int numEven, numOdd; numOdd = length / 2; if (length % 2 == 0) { numEven = length / 2; } else { numEven = (length / 2) + 1; } arr[0] = malloc(sizeof(int) * numEven); arr[1] = malloc(sizeof(int) * numOdd); for (int i = 0; i < length; i = i + ", "question": "not working", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: not working | Code context (simplify for kids): int **split_array(const int *s, int length) { int *arr[2]; int numEven, numOdd; numOdd = length / 2; if (length % 2 == 0) { numEven = length / 2; } else { numEven = (length / 2) + 1; } arr[0] = malloc(sizeof(int) * numEven); arr[1] = malloc(sizeof(int) * numOdd); for (int i = 0; i < length; i = i + ", "question": "not working", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr = malloc(sizeof(int *) * 2); int numEven, numOdd; numOdd = length / 2; if (length % 2 == 0) { numEven = length / 2; } else { numEven = (length / 2) + 1; } arr[0] = malloc(sizeof(int) * numEven); arr[1] = malloc(sizeof(int) * numOdd); for (int i", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: give an example of a program that uses both scanf and command-line arguments", "question": "give an example of a program that uses both scanf and command-line arguments", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: given an example of a program that uses scanf for several lines of input", "question": "given an example of a program that uses scanf for several lines of input", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: give an example of a program that uses scanf", "question": "give an example of a program that uses scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how many processes are forked? | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int original_process = getpid(); for (int i = 0; i < iterations; i++) { if (getpid()", "question": "how many processes are forked?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: describe the processes and their relationship to each other | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int original_process = getpid(); for (int i = 0; i < iterations; i++) { if (getpid()", "question": "describe the processes and their relationship to each other", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: describe the processes and their relationship to each other | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "describe the processes and their relationship to each other", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i use dup2", "question": "how do i use dup2", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i make the child process read two lines of pipe from the parent process in an execl call?", "question": "how can i make the child process read two lines of pipe from the parent process in an execl call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i use the execl call for standard input", "question": "how can i use the execl call for standard input", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: i want to pass standard input from the parent process to a program being called in the child process using the execl call", "question": "i want to pass standard input from the parent process to a program being called in the child process using the execl call", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: i have an execl call in my child process that reads from standard input. where do i close my file descriptors?", "question": "i have an execl call in my child process that reads from standard input. where do i close my file descriptors?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i get a slice of an array in c", "question": "how do i get a slice of an array in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i convert a char array to a string array in c", "question": "how do i convert a char array to a string array in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between * and &?", "question": "what is the difference between * and &?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i set a time_t?", "question": "how do i set a time_t?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include int main() { char c = 'b'; // declare and set variable c_ptr so that the code below prints 'b' // Submitted code below int *c_ptr = &c; // Submitted code above printf(\"%c\", *c_ptr); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: I received an error when trying to run my executable on teach.cs, a shared Linux system. What is this error? How can it be fixed? /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found", "question": "I received an error when trying to run my executable on teach.cs, a shared Linux system. What is this error? How can it be fixed? /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): int main(){ char phone[11]; int num; scanf(\"%s\", phone); scanf(\"%d\", &num); if (num == -1){ printf(\"%s\\n\", phone); return 0; } else if (num < -1 || num > 9){ printf(\"ERROR\\n\"); return 1; } else{ printf(\"%c\\n\", phone[num]); return 0; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the man page for scanf to determine the return value when t | Code context (simplify for kids): int main(){ char phone[11]; int num; scanf(\"%s\", phone); scanf(\"%d\", &num); if (num == -1){ printf(\"%s\\n\", phone); return 0; } else if (num < -1 || num > 9){ printf(\"ERROR\\n\"); return 1; } else{ printf(\"%c\\n\", phone[num]); return 0; } }", "question": "", "intention": "This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the man page for scanf to determine the return value when t", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): (var) |= 1 << (flag)", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is static inline?", "question": "what is static inline?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char * (*x) (char *) = my_func;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: strtol does not set errno when it fails because it isn't a system call. why the above sentence wrong", "question": "strtol does not set errno when it fails because it isn't a system call. why the above sentence wrong", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: strtol does not set errno when it fails because it isn't a system call.", "question": "strtol does not set errno when it fails because it isn't a system call.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: will system call set errno?", "question": "will system call set errno?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char name[5]; strncat(name, \"Hi\", 2);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How many processes are created, including the original parent, when the program is called with 2, 3, and 4 as arguments? n arguments? | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "How many processes are created, including the original parent, when the program is called with 2, 3, and 4 as arguments? n arguments?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what value stores in y at the end | Code context (simplify for kids): char *result[2]; x = result[0]; result[0] = \"read only\"; y = x[0];", "question": "what value stores in y at the end", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Is string literal differ than a char", "question": "Is string literal differ than a char", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: When call fun('a') in main stack, will it allocate space for 'a'? | Code context (simplify for kids): int fun(char i) { ... } int main() { fun(’a’); }", "question": "When call fun('a') in main stack, will it allocate space for 'a'?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what kind of error will the code has? what is the difference between run-time error and compile error? | Code context (simplify for kids): char *third = malloc(sizeof(char) * 10); third = \"Wednesday\"; third[0] = 'w';", "question": "what kind of error will the code has? what is the difference between run-time error and compile error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: if argv[1] is zero, what kind of error will it incur | Code context (simplify for kids): int main(int argc, char **argv) { char *next = NULL; errno = 0; long longi = strtol(argv[1], &next, 0); int i = longi; printf(\"longi: %ld\\n\", longi); printf(\"i: %d\\n\", i); printf(\"next is |%s|\\n\", next); if (errno != 0) { perror(\"strtol\"); } return 0; }", "question": "if argv[1] is zero, what kind of error will it incur", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between execl and execvp", "question": "what is the difference between execl and execvp", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does dup2 do", "question": "what does dup2 do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what do signal mask do", "question": "what do signal mask do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does accpet() do", "question": "what does accpet() do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does sprintf() do", "question": "what does sprintf() do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when will read() block", "question": "when will read() block", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does htons() do", "question": "what does htons() do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what kind of error will occur is we do not double quote filename in shell programming?", "question": "what kind of error will occur is we do not double quote filename in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are the attributes in struct called", "question": "what are the attributes in struct called", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does socket do", "question": "what does socket do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does port do", "question": "what does port do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does listen() do", "question": "what does listen() do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does dup2() do", "question": "what does dup2() do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why we use fprintf to output stderr", "question": "why we use fprintf to output stderr", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: will main function always return int or can we set to be void", "question": "will main function always return int or can we set to be void", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does sizeof int different on different machine", "question": "does sizeof int different on different machine", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to send SIGUSR1 signal to a process in command line", "question": "how to send SIGUSR1 signal to a process in command line", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If we want to modify permission of myscript.sh, when we use chmod, why we just write myscript rather than myscript.sh", "question": "If we want to modify permission of myscript.sh, when we use chmod, why we just write myscript rather than myscript.sh", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does each of three permissions mean", "question": "what does each of three permissions mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does /dev/null 2 /dev/null mean", "question": "what does /dev/null 2 /dev/null mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: in shell programming, when to use test and when do not", "question": "in shell programming, when to use test and when do not", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you show the process and the steps of creating and setting up a socket", "question": "can you show the process and the steps of creating and setting up a socket", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why the code below copies the fields of b into a. | Code context (simplify for kids): struct node a, b; a = b;", "question": "why the code below copies the fields of b into a.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why this does not cause memory leak | Code context (simplify for kids): struct node { int val; struct node *next; }; void free_list(struct node *head) { while (head != NULL) { free(head); head = head->next; }", "question": "why this does not cause memory leak", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: will exit after execl executed?", "question": "will exit after execl executed?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between execl, execlp, execv, execvp", "question": "what is the difference between execl, execlp, execv, execvp", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when calling select, what kind of fds will remain in the set", "question": "when calling select, what kind of fds will remain in the set", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this code mean | Code context (simplify for kids): list(product(self.NodeType, repeat = 2))", "question": "what does this code mean", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char **last_names; last_names = malloc(sizeof(char*) * 4); last_names[0] = malloc(sizeof(char)* 20); last_names[1] = malloc(sizeof(char) * 20); last_names[2] = malloc(sizeof(char) * 20); last_names[3] = malloc(sizeof(char) * 20);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: explain **last_names", "question": "explain **last_names", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: would this allocate the exact amount of memory of a float to allocated_amount | Code context (simplify for kids): allocated_amount = malloc(sizeof(float));", "question": "would this allocate the exact amount of memory of a float to allocated_amount", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do you set the a variable x to the exact amount of space that should be allocated and pointed to by float *rainfall. | Code context (simplify for kids): float *rainfall = null;", "question": "how do you set the a variable x to the exact amount of space that should be allocated and pointed to by float *rainfall.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this program compile | Code context (simplify for kids): void main(int arc, char**argv) { char *size = argv[1]; if(argv == 3) { char*x = argv[2]; } }", "question": "will this program compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this compile | Code context (simplify for kids): void main(int arc, char**argv) { char *size = argv[1]; if(argc == 3) { char*x = argv[2]; } }", "question": "will this compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this compile | Code context (simplify for kids): int main(int argc, char**argv) { if (!(argc == 2 || argc ==3)) { fprintf(stderr, \"x\"); return 1; } char *size = argv[1]; if(argc == 3) { char*x = argv[2]; } return 0; }", "question": "will this compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How would i redirect information from a file as standard input using scanf?", "question": "How would i redirect information from a file as standard input using scanf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How would i redirect information from a file as standard input using scanf when i do not know the name of the file?", "question": "How would i redirect information from a file as standard input using scanf when i do not know the name of the file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: You should use scanf to read the input. Since your program reads from standard input, it would be possible to type all the input to your program from the keyboard. But typing in a listing that looks like the output from ls -l even once would be awful. Instead you could run ls -l and pipe its output to your program. Make sure you understand that last sentence and try it out. Even better, you should run ls -l and redirect its output to another file. Then edit that file to create different versions", "question": "", "intention": "", "task_description": "You should use scanf to read the input. Since your program reads from standard input, it would be possible to type all the input to your program from the keyboard. But typing in a listing that looks like the output from ls -l even once would be awful. Instead you could run ls -l and pipe its output to your program. Make sure you understand that last sentence and try it out. Even better, you should run ls -l and redirect its output to another file. Then edit that file to create different versions", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i use scanf to read what i redirected to standard input", "question": "how do i use scanf to read what i redirected to standard input", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what will this code do", "question": "what will this code do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what parameters should i be putting into full_array and result? | Code context (simplify for kids): int main(int argc, char **argv) { /* Replace the comments in the next two lines with the appropriate arguments. Do not add any additional lines of code to the main function or make other changes. */ int *full_array = build_array(argv[1], sizeof(argv[1]) / sizeof(argv[1][0])); int **result = split_ar", "question": "what parameters should i be putting into full_array and result?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix this so my code compiles without error | Code context (simplify for kids): int main(int argc, char **argv) { /* Replace the comments in the next two lines with the appropriate arguments. Do not add any additional lines of code to the main function or make other changes. */ int *full_array = build_array(argv[1], argc - 1); int **result = split_array(full_array, sizeof(full_", "question": "how can i fix this so my code compiles without error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how would i find the size of a pointer to an array", "question": "how would i find the size of a pointer to an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: would this compile | Code context (simplify for kids): int main(int argc, char **argv) { /* Replace the comments in the next two lines with the appropriate arguments. Do not add any additional lines of code to the main function or make other changes. */ int *full_array = build_array(argv[1], argc - 1); int **result = split_array(full_array, sizeof(full_", "question": "would this compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i find the size of an array of int *", "question": "how do i find the size of an array of int *", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print out the array at odd and even indices | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "", "intention": "print out the array at odd and even indices", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what parameters should be passed to full_array and result? | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "what parameters should be passed to full_array and result?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what stops this from compiling | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "what stops this from compiling", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the type of argv[1] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "what is the type of argv[1]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this compile | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "will this compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this compile | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "will this compile", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i make sure that memory is allocated and free correctly | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "how can i make sure that memory is allocated and free correctly", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix this code to ensure my memory is freed correctly | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { arr[i] = strtol(strs[i], NULL, 10); } return arr; } int **split_array(const int *s, int length) { int **arrays = malloc(sizeof(int *) * 2); int *arr_even = malloc(sizeof(int) * ((length ", "question": "how can i fix this code to ensure my memory is freed correctly", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: given a program where a pointer to an array of char pointers is passed as an argument, how can i print out the first 5 characters?", "question": "given a program where a pointer to an array of char pointers is passed as an argument, how can i print out the first 5 characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i index input to get the first character | Code context (simplify for kids): int check_permissions(char *permission_field, char *required_permissions) { for (int i = 0; i < 9; i++) { if (required_permissions[i] == 'w' && permission_field[i] != 'w') { return 1; } else if (required_permissions[i] == 'r' && permission_field[i] != 'r') { return 1; } else if (required_permissions", "question": "how can i index input to get the first character", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i make permissions equal to the last 9 characters of input | Code context (simplify for kids): int check_permissions(char *permission_field, char *required_permissions) { for (int i = 0; i < 9; i++) { if (required_permissions[i] == 'w' && permission_field[i] != 'w') { return 1; } else if (required_permissions[i] == 'r' && permission_field[i] != 'r') { return 1; } else if (required_permissions", "question": "how can i make permissions equal to the last 9 characters of input", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: why is it that when i index a pointer to a char array at index n, it gives me the same array starting from index n to the end?", "question": "why is it that when i index a pointer to a char array at index n, it gives me the same array starting from index n to the end?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Modify s so it becomes the first n characters of s, and return how many letters in s were removed | Code context (simplify for kids): int truncate(char *s, int n) { char new_str[strlen(s)]; strncpy(new_str, s, n); new_str[strlen(s) - 1] = '\\0'; s = new_str; return strlen(s) - n; }", "question": "", "intention": "Modify s so it becomes the first n characters of s, and return how many letters in s were removed", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * Read in the location of the pixel array, the image width, and the image * height in the given bitmap file. */ | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image,10, SEEK_SET); fread(&pixel_array_offset, sizeof(int), 1, image); fseek(image, 18, SEEK_SET); fread(&width, sizeof(int), 1, image); fseek(image, 22, SEEK_SET); fread(&height, sizeof(int), 1, image)", "question": "", "intention": "/* * Read in the location of the pixel array, the image width, and the image * height in the given bitmap file. */", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do i get a segmentation fault when i try to print the contents of the file? how can i fix it? | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL) { return 1; } FILE *file; file = fopen(user->profile_pic, \"r\"); char line[10]; while (fgets(line, 10, file) != NULL) { printf(\"%s\", line); } fclose(file); printf(\"Name: %s\\n\", (char *)user->name); printf(\"------------------------------------------", "question": "why do i get a segmentation fault when i try to print the contents of the file? how can i fix it?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what can i change to get rid of the makes pointer from integer without a cast error | Code context (simplify for kids): time_t curr_time = sizeof(time(NULL)); time(&curr_time); new_post->date = curr_time;", "question": "what can i change to get rid of the makes pointer from integer without a cast error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what can i do to fix the makes pointer from integer without a cast error | Code context (simplify for kids): time_t curr_time = time(NULL); time(&curr_time); new_post->date = curr_time;", "question": "what can i do to fix the makes pointer from integer without a cast error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i remove the segfault | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // If 1 element in the list if (curr->next == NULL) { if (strcmp(curr->name, name) == 0) { *user_ptr_del = NULL; free(curr); } else { return 1; } } while (strcmp(curr->next->name, name) != 0", "question": "how do i remove the segfault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Return: * - 0 on success. * - 1 if a user with this name does not exist. */ | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // If 1 element in the list if (curr->next == NULL) { if (strcmp(curr->name, name) == 0) { *user_ptr_del = NULL; free(curr); return 0; } else { return 1; } } while (strcmp(curr->next->name, ", "question": "", "intention": "/* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Return: * - 0 on success. * - 1 if a user with this name does not exist. */", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Return: * - 0 on success. * - 1 if a user with this name does not exist. */ | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // If 1 element in the list if (curr->next == NULL) { if (strcmp(curr->name, name) == 0) { *user_ptr_del = NULL; free(curr); return 0; } else { return 1; } } while (strcmp(curr->next->name, ", "question": "", "intention": "/* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Return: * - 0 on success. * - 1 if a user with this name does not exist. */", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. */ | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; User *temp = *user_ptr_del; // If 1 element in the list if (curr->next == NULL) { if (strcmp(curr->name, name) == 0) { temp = *user_ptr_del; } else { return 1; } } while (strcmp(curr->next->", "question": "", "intention": "/* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. */", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove the deleted user from the friendlist | Code context (simplify for kids): void remove_friend(const char *name, User *ptr_friend_user, int index) { User *friend = ptr_friend_user; for (int i = index; i < MAX_FRIENDS - 1; i++) { friend->friends[i] = friend->friends[i + 1]; } } void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; for (int i = 0;", "question": "", "intention": "remove the deleted user from the friendlist", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove the deleted user from the friendlist | Code context (simplify for kids): void remove_friend(const char *name, User *ptr_friend_user, int index) { User *friend = ptr_friend_user; for (int i = index; i < MAX_FRIENDS - 1; i++) { friend->friends[i] = friend->friends[i + 1]; } } void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != ", "question": "", "intention": "remove the deleted user from the friendlist", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove the deleted user from the friendlist | Code context (simplify for kids): void remove_friend(const char *name, User *ptr_friend_user, int index) { User *friend = ptr_friend_user; for (int i = index; i < MAX_FRIENDS - 1; i++) { friend->friends[i] = friend->friends[i + 1]; } friend->friends[MAX_FRIENDS - 1] = NULL; } void remove_friends(const char *name, User **ptr_users) {", "question": "", "intention": "remove the deleted user from the friendlist", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what can i do to fix this so that a user is removed from the friendslist of all users | Code context (simplify for kids): void remove_friend(const char *name, User *ptr_friend_user, int index) { User *friend = ptr_friend_user; for (int i = index; i < MAX_FRIENDS - 1; i++) { friend->friends[i] = friend->friends[i + 1]; } friend->friends[MAX_FRIENDS - 1] = NULL; } void remove_friends(const char *name, User **ptr_users) {", "question": "what can i do to fix this so that a user is removed from the friendslist of all users", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete the user in every friendlist | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { for (int i = 0; i < MAX_FRIENDS; i++) { if (strcmp(curr->friends[i]->name, name) == 0) { for (int j = i; i < MAX_FRIENDS - 1; j ++) { curr->friends[j] = curr->friends[j + 1]; } curr->friends[MAX", "question": "", "intention": "delete the user in every friendlist", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this remove the friend from the friendlist of every user? and if not how can i fix it | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { for (int i = 0; i < MAX_FRIENDS; i++) { if (strcmp(curr->friends[i]->name, name) == 0) { for (int j = i; i < MAX_FRIENDS - 1; j ++) { curr->friends[j] = curr->friends[j + 1]; } curr->friends[MAX", "question": "does this remove the friend from the friendlist of every user? and if not how can i fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this remove the deleted user from all user's friendlists? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { for (int i = 0; i < MAX_FRIENDS; i++) { if (strcmp(curr->friends[i]->name, name) == 0) { for (int j = i; i < MAX_FRIENDS - 1; j ++) { curr->friends[j] = curr->friends[j + 1]; } curr->friends[MAX", "question": "will this remove the deleted user from all user's friendlists?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code remove the user from every friendlist? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "will this code remove the user from every friendlist?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: * Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Check for User Non-existence // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "", "intention": "* Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the ", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this properly shit all the friends after user in the list by one? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "does this properly shit all the friends after user in the list by one?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this code properly remove a friend from friendlists of all the users by shifting the list to the left by one after in the list after the user we want to remove? if not how can i fix it | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "does this code properly remove a friend from friendlists of all the users by shifting the list to the left by one after in the list after the user we want to remove? if not how can i fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do lines 4-14 properly assign variable u_count to the position of the user by the name name in the friends list, and f_count to the number of friends in the friendslist? do lines 16-19 then properly remove the user from the friendlist of the users? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "do lines 4-14 properly assign variable u_count to the position of the user by the name name in the friends list, and f_count to the number of friends in the friendslist? do lines 16-19 then properly remove the user from the friendlist of the users?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i properly assign u_count to the index of the removed user in the friendslist? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "how do i properly assign u_count to the index of the removed user in the friendslist?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do lines 4-14 properly assign variable u_count to the position of the user by the name name in the friends list, and f_count to the number of friends in the friendslist? if not, what can i change? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "do lines 4-14 properly assign variable u_count to the position of the user by the name name in the friends list, and f_count to the number of friends in the friendslist? if not, what can i change?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do lines 16-19 then properly remove the user from the friendlist of the users? if not what can i change | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } for", "question": "do lines 16-19 then properly remove the user from the friendlist of the users? if not what can i change", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to delete the memory of the removed user in friendslist? and if so how? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { printf(\"bye\"); User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_c", "question": "do i need to delete the memory of the removed user in friendslist? and if so how?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this code properly remove friends from the friendlist? what do i need to change or add? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { printf(\"bye\"); User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_c", "question": "Does this code properly remove friends from the friendlist? what do i need to change or add?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix this so i remove the user from the friendlists? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { printf(\"bye\"); User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_c", "question": "how can i fix this so i remove the user from the friendlists?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i delete the user from the friendslist if there is only one friend in the friendslist? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { printf(\"bye\"); User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_c", "question": "how do i delete the user from the friendslist if there is only one friend in the friendslist?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove the user from all the friendlists of the list of users | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "", "intention": "remove the user from all the friendlists of the list of users", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this properly remove the user from a 1 element long friendlist of a user? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "will this properly remove the user from a 1 element long friendlist of a user?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "is this code correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to do to fix this | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "what do i need to do to fix this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code correctly remove a user from all friendlists? if not, how can i fix it | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "will this code correctly remove a user from all friendlists? if not, how can i fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this correct | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "is this correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code properly remove the user from a friendlist of length 1? if not, why? | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "will this code properly remove the user from a friendlist of length 1? if not, why?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i remove a user from a friendlist of lenght 1 | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "how do i remove a user from a friendlist of lenght 1", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code properly remove the user from a friendlist of length 1? if not, what can i do to fix it | Code context (simplify for kids): void remove_friends(const char *name, User **ptr_users) { User *curr = *ptr_users; while (curr != NULL) { int f_count = 0; int u_count = 0; for (int i = 0; i < MAX_FRIENDS; i++) { if (curr->friends[i] != NULL) { f_count++; if (strcmp(curr->friends[i]->name, name) == 0) { u_count = f_count; } } } if ", "question": "will this code properly remove the user from a friendlist of length 1? if not, what can i do to fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i initialize time_t properly so i can get the current time", "question": "how do i initialize time_t properly so i can get the current time", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: will this properly set curr_time to the current time without junk bites? how can i fix it | Code context (simplify for kids): time_t curr_time = sizeof(time_t); time(&curr_time); new_post->date = &curr_time;", "question": "will this properly set curr_time to the current time without junk bites? how can i fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do i keep getting the wrong date with this | Code context (simplify for kids): time_t curr_time; time(&curr_time); new_post->date = &curr_time;", "question": "why do i keep getting the wrong date with this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to change to get the right time | Code context (simplify for kids): time_t curr_time; time(&curr_time); new_post->date = &curr_time;", "question": "what do i need to change to get the right time", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i allocate space for a time_t date", "question": "how can i allocate space for a time_t date", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to change so the current time is stored in new_post->date, a time_t variable? | Code context (simplify for kids): time_t *curr_time = malloc(sizeof(time_t)); time(curr_time) ; new_post->date = curr_time; free(curr_time);", "question": "what do i need to change so the current time is stored in new_post->date, a time_t variable?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to dereference curr_time when iassign it to new_post->date? how do i do that | Code context (simplify for kids): time_t *curr_time = malloc(sizeof(time_t)); time(curr_time) ; new_post->date = curr_time; free(curr_time);", "question": "do i need to dereference curr_time when iassign it to new_post->date? how do i do that", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: on which line do i reference curr_time | Code context (simplify for kids): time_t *curr_time = malloc(sizeof(time_t)); time(curr_time) ; new_post->date = curr_time; free(curr_time);", "question": "on which line do i reference curr_time", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: on which line do i need to reference curr_time so this program gives me the correct time | Code context (simplify for kids): time_t *curr_time = malloc(sizeof(time_t)); time(curr_time) ; new_post->date = curr_time; free(curr_time);", "question": "on which line do i need to reference curr_time so this program gives me the correct time", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can i have more free calls than free calls in a function if i called malloc without calling free in another function?", "question": "can i have more free calls than free calls in a function if i called malloc without calling free in another function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does this code properly free all memory from the linked list | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = NULL; curr_post = curr_post->next; }", "question": "does this code properly free all memory from the linked list", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i make the code free all memory from the linked list | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = NULL; curr_post = curr_post->next; }", "question": "how can i make the code free all memory from the linked list", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to free next | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = NULL; curr_post = curr_post->next; }", "question": "do i need to free next", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = NULL; curr_post = curr_post->next; }", "question": "is this code correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = curr_post->next; }", "question": "is this code correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is memory properly freed here | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = curr_post->next; }", "question": "is memory properly freed here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: am i traversing the list properly and deleting the memory properly | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { free(curr_post->date); free(curr_post); curr_post = curr_post->next; }", "question": "am i traversing the list properly and deleting the memory properly", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: do we always need the same number of malloc calls as free calls? what if there were multiple return statements in if statements and multiple free cals within if statements?", "question": "do we always need the same number of malloc calls as free calls? what if there were multiple return statements in if statements and multiple free cals within if statements?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code cause memory leaks? if so, where? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "will this code cause memory leaks? if so, where?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix the memory leak | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "how can i fix the memory leak", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: am i missing any free(temp) statements? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "am i missing any free(temp) statements?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if i have a struct and i allocated memory for the struct, will i have to free the memory for that struct only, or every attribute of the struct as well?", "question": "if i have a struct and i allocated memory for the struct, will i have to free the memory for that struct only, or every attribute of the struct as well?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: where are the memory leaks | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "where are the memory leaks", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: are there memory leaks in lines 56-62 | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "are there memory leaks in lines 56-62", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to change to ensure the memory of the posts are being freed | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "what do i need to change to ensure the memory of the posts are being freed", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do lines 56-62 properly free the post memory? if not, how can i fix this? what line do i need to add or change and where? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "do lines 56-62 properly free the post memory? if not, how can i fix this? what line do i need to add or change and where?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: on which lines do the memory leaks occur? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "on which lines do the memory leaks occur?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how would i free all the memory by traversing through a linked list? what code should i write?", "question": "how would i free all the memory by traversing through a linked list? what code should i write?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why is there a memory leak after freeing the posts? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "why is there a memory leak after freeing the posts?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix the memory leak when freeing the posts | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "how can i fix the memory leak when freeing the posts", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: the memory leak is caused by the if (curr_post != NULL) statement. how can i fix this | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list // Create a variable to traverse the list User *curr = *user_ptr_del; // Create a variable to hold the deleted user User *temp = *user_ptr_del; // Check for empty users list if (*user_ptr_del == NULL) { return 1; } rem", "question": "the memory leak is caused by the if (curr_post != NULL) statement. how can i fix this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete all posts and free the memory | Code context (simplify for kids): Post *curr_post = temp->first_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { free(curr_post->date); free(curr_post); curr_post = curr_post->next; } free(curr_post->date); free(curr_post); }", "question": "", "intention": "delete all posts and free the memory", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete all posts and free the memory | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = temp->first_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post free(curr_post->date); free(curr_post); curr", "question": "", "intention": "delete all posts and free the memory", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete all posts and free the memory | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = temp->first_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; free(curr_post->date); free(curr_post); cur", "question": "", "intention": "delete all posts and free the memory", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete all posts and free the memory | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; free(curr_post->date); free(curr_post); curr_post ", "question": "", "intention": "delete all posts and free the memory", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix the segmentation fault | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; free(curr_post->date); free(curr_post); curr_post ", "question": "how can i fix the segmentation fault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this give me a segfault? if so, how can i fix it | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; free(temp->date); free(temp); curr_post = curr_pos", "question": "will this give me a segfault? if so, how can i fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i fix the segfault | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; free(temp_post->date); free(temp_post); curr_post ", "question": "how do i fix the segfault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what causes the segfault | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; curr_post = curr_post->next; free(temp_post->date)", "question": "what causes the segfault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i free the last post | Code context (simplify for kids): // Free post memory Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; curr_post = curr_post->next; free(temp_post->date)", "question": "how do i free the last post", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct | Code context (simplify for kids): Post *curr_post = temp->first_post; Post *temp_post = curr_post; if (curr_post->next == NULL) { free(curr_post->date); free(curr_post); } else if (curr_post->next !=NULL) { while (curr_post->next != NULL) { temp_post = curr_post; curr_post = curr_post->next; free(temp_post->date); free(temp_post); i", "question": "is this code correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code properly remove the last post? | Code context (simplify for kids): Post *curr_post = temp->first_post; while (curr_post != NULL) { Post *temp_post = curr_post; curr_post = curr_post->next; free(temp_post->date); free(temp_post); }", "question": "will this code properly remove the last post?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this properly check for a full friendlist | Code context (simplify for kids): // Check for full friends list if (friend1->friends[MAX_FRIENDS - 1] != NULL || friend2->friends[MAX_FRIENDS - 1] != NULL) { return 2; }", "question": "will this properly check for a full friendlist", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this properly check if at least one of the users have a full friendslist | Code context (simplify for kids): // Check for full friends list if (friend1->friends[MAX_FRIENDS - 1] != NULL || friend2->friends[MAX_FRIENDS - 1] != NULL) { return 2; }", "question": "will this properly check if at least one of the users have a full friendslist", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code work as intended: Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "will this code work as intended: Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the sa | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "", "intention": "Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the sa", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does the first element of friendlist get added to the end of the list when i add the MAX_FRIEND th friend to a friendlist | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "why does the first element of friendlist get added to the end of the list when i add the MAX_FRIEND th friend to a friendlist", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i check if the friendlist is already full | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "how can i check if the friendlist is already full", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: should i check if the MAX_FRIEND th number or the MAX_FRIEND - 1 th number of the friendlist is null | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "should i check if the MAX_FRIEND th number or the MAX_FRIEND - 1 th number of the friendlist is null", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: an extra element is added everytime i added the MAX_FRIENDS th friend. do you know why | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "an extra element is added everytime i added the MAX_FRIENDS th friend. do you know why", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why will The while loop always run at least once, even if f1_added and f2_added are both 1? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "why will The while loop always run at least once, even if f1_added and f2_added are both 1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to change so that an extra element isnt added everytime i added the MAX_FRIENDS th friend | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "what do i need to change so that an extra element isnt added everytime i added the MAX_FRIENDS th friend", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what do i need to change so that an extra element isnt added everytime i added the MAX_FRIENDS th friend? is this code correct? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "what do i need to change so that an extra element isnt added everytime i added the MAX_FRIENDS th friend? is this code correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does my code properly check for if the friendlist is full, or if the friend already exists | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "does my code properly check for if the friendlist is full, or if the friend already exists", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is it possible for a friend to be added to the same list twice in my code | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "is it possible for a friend to be added to the same list twice in my code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct? if not what do i need to to do to fix it | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "is this code correct? if not what do i need to to do to fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when i run the program, when i add the MAX_FRIEND th name, the first element is added as the MAX_FRIEND th + 1 element. is this function causing that kind of error? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "when i run the program, when i add the MAX_FRIEND th name, the first element is added as the MAX_FRIEND th + 1 element. is this function causing that kind of error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when i run the program, when i add the MAX_FRIEND th name, the first element is added as the MAX_FRIEND th + 1 element. why might the find_user function cause this? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "when i run the program, when i add the MAX_FRIEND th name, the first element is added as the MAX_FRIEND th + 1 element. why might the find_user function cause this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct? | Code context (simplify for kids): // Keep looping so long as a new friend is not added to both users while ((f1_added == 0 || f2_added == 0) && count < MAX_FRIENDS) { if (friend1->friends[count] == NULL && f1_added == 0) { friend1->friends[count] = friend2; f1_added = 1; // Track that friend2 was added to friend1's friendlist } if (", "question": "is this code correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: could this code be the reason why the first element of the list is added to the end of the list when the MAX_FRIEND th element is added to a list? | Code context (simplify for kids): // Keep looping so long as a new friend is not added to both users while ((f1_added == 0 || f2_added == 0) && count < MAX_FRIENDS) { if (friend1->friends[count] == NULL && f1_added == 0) { friend1->friends[count] = friend2; f1_added = 1; // Track that friend2 was added to friend1's friendlist } if (", "question": "could this code be the reason why the first element of the list is added to the end of the list when the MAX_FRIEND th element is added to a list?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: could this code be the reason why the first element of the list is added to the end of the list when the MAX_FRIEND th element is added to a list? what do i need to add to fix it | Code context (simplify for kids): // Keep looping so long as a new friend is not added to both users while ((f1_added == 0 || f2_added == 0) && count < MAX_FRIENDS) { if (friend1->friends[count] == NULL && f1_added == 0) { friend1->friends[count] = friend2; f1_added = 1; // Track that friend2 was added to friend1's friendlist } if (", "question": "could this code be the reason why the first element of the list is added to the end of the list when the MAX_FRIEND th element is added to a list? what do i need to add to fix it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: i dont understand why when i add the MAX_FRIENDS th friend, the first element is added to the end of the list (so it appears twice) | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "i dont understand why when i add the MAX_FRIENDS th friend, the first element is added to the end of the list (so it appears twice)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the sa | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "", "intention": "Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if the sa", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code always work as inteneded? Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already h | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "will this code always work as inteneded? Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already h", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code always work as inteneded? Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already h | Code context (simplify for kids): /* * Helper function that determines if users are already friends */ int check_if_not_friends(User *user1, User *user2) { for (int i = 0; i < MAX_FRIENDS; i++) { if (user1->friends[i] == user2) { return 1; // If user already exists } } return 0; // If user does not exist in friendlist } int make_fri", "question": "will this code always work as inteneded? Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already h", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is a better more correct way to do this? | Code context (simplify for kids): // Create variables to track if the friends were added to each other's // friend lists int f1_added = 0; int f2_added = 0; // Create a counter to track list index int count = 0; // Keep looping so long as a new friend is not added to both users while ((f1_added == 0 || f2_added == 0) && count < MAX_", "question": "what is a better more correct way to do this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this code correct | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "is this code correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this correct | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "is this correct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: I have a program that allows you to create users and make them friends with each other. There is a maximum number of friends allowed for each user. when i make two users friends and one of the friend's friendlist is now full, for some reason, in addition to the added friend being added to the friendlist, the first friend that was added to their friendlist is duplicated and added to the very end of", "question": "I have a program that allows you to create users and make them friends with each other. There is a maximum number of friends allowed for each user. when i make two users friends and one of the friend's friendlist is now full, for some reason, in addition to the added friend being added to the friendlist, the first friend that was added to their friendlist is duplicated and added to the very end of", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: I have a program that allows you to create users and make them friends with each other. There is a maximum number of friends allowed for each user. when i make two users friends and one of the friend's friendlist is now full, for some reason, in addition to the added friend being added to the friendlist, the first friend that was added to their friendlist is duplicated and added to the very end of | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "I have a program that allows you to create users and make them friends with each other. There is a maximum number of friends allowed for each user. when i make two users friends and one of the friend's friendlist is now full, for some reason, in addition to the added friend being added to the friendlist, the first friend that was added to their friendlist is duplicated and added to the very end of", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is this the case?: If friend1 is added to friend2's friendlist and friend2 is added to friend1's friendlist, then friend1 is added to friend1's friendlist. | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "why is this the case?: If friend1 is added to friend2's friendlist and friend2 is added to friend1's friendlist, then friend1 is added to friend1's friendlist.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: in which cases will this code be wrong? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "in which cases will this code be wrong?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when the MAX_FRIEND th element is added, the first element of the friendlist is added too. why are two friends being added when the last element of friendlist is being set? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "when the MAX_FRIEND th element is added, the first element of the friendlist is added too. why are two friends being added when the last element of friendlist is being set?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is it possible that this function could add 2 elements to the array of friends instead of 1? when does this happen? how can i prevent this | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "is it possible that this function could add 2 elements to the array of friends instead of 1? when does this happen? how can i prevent this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is it that friend1->friends[i]->name is null when the code runs | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { // Create users friend1 and friend2 User *friend1 = find_user(name1, head); User *friend2 = find_user(name2, head); // Check for user non-existence if (friend1 == NULL || friend2 == NULL) { return 4; } // Check for same user passed", "question": "why is it that friend1->friends[i]->name is null when the code runs", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this correctly remove the data in post? should i set it to null as well? | Code context (simplify for kids): void free_posts(Post *post_ptr) { Post *curr = post_ptr; // Create a variable to traverse the linked list while (curr != NULL) { Post *temp_post = curr; // Create a temporary variable to hold a post curr = curr->next; if (temp_post != NULL) { // If the post is not null, free the post and its content", "question": "will this correctly remove the data in post? should i set it to null as well?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: will this correctly remove the user and their posts | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // Variable to traverse the list User *temp = curr; // Variable to hold the deleted user // Check for empty users list if (*user_ptr_del == NULL) { return 1; } // Remove the user from all fr", "question": "will this correctly remove the user and their posts", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is it that when i add a post to the user, delete the user and add back the user with the same name,their posts are still there | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // Variable to traverse the list User *temp = curr; // Variable to hold the deleted user // Check for empty users list if (*user_ptr_del == NULL) { return 1; } // Remove the user from all fr", "question": "why is it that when i add a post to the user, delete the user and add back the user with the same name,their posts are still there", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to call free_posts anywhere else to correctly remove the posts from the deleted user? | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // Delete user from list User *curr = *user_ptr_del; // Variable to traverse the list User *temp = curr; // Variable to hold the deleted user // Check for empty users list if (*user_ptr_del == NULL) { return 1; } // Remove the user from all fr", "question": "do i need to call free_posts anywhere else to correctly remove the posts from the deleted user?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how does strncpy work", "question": "how does strncpy work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do i need to free memset", "question": "do i need to free memset", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i initialize user_ptr_add", "question": "how do i initialize user_ptr_add", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 5 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is this code doing | Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 5 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "what is this code doing", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Now start gdb again but before you start, run script gdb_example.txt to record your interaction. (You'll submit this interaction.) This time make sure you watch the array after. It is pretty slow to step through every line of your code, so use list to find the line number of the for loop where we start to assign values to the array. Set a breakpoint on that line number and also set a breakpoint somewhere before that line. Start your program using run and it should run up to the first breakpoint.", "question": "", "intention": "", "task_description": "Now start gdb again but before you start, run script gdb_example.txt to record your interaction. (You'll submit this interaction.) This time make sure you watch the array after. It is pretty slow to step through every line of your code, so use list to find the line number of the for loop where we start to assign values to the array. Set a breakpoint on that line number and also set a breakpoint somewhere before that line. Start your program using run and it should run up to the first breakpoint.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you read from an open file passed into as a parameter", "question": "how do you read from an open file passed into as a parameter", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when do we dereference variables?", "question": "when do we dereference variables?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: in this code, why do we put a * in front of pt on line 5? | Code context (simplify for kids): int num = 40; int *pt; pt = # int *anotherpt = # *pt = 30; printf(\"%d\\n\", *anotherpt); return 0;", "question": "in this code, why do we put a * in front of pt on line 5?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what if we did pt = 30? does that work and why? | Code context (simplify for kids): int num = 40; int *pt; pt = # int *anotherpt = # *pt = 30; printf(\"%d\\n\", *anotherpt); return 0;", "question": "what if we did pt = 30? does that work and why?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when do we use &?", "question": "when do we use &?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what would be the value of x[0] | Code context (simplify for kids): char *result[2]; x = result[0]; // some hidden code result[0] = \"read only\"; y = x[0];", "question": "what would be the value of x[0]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why dont we pass in &arr to function change | Code context (simplify for kids): nt arr[3] = {1, 2, 3}; double result = change(arr, 3); // Comment the above, and uncomment the below, to see // change only work on the 2nd and 3rd integers // double result = change(arr + 1, 2); printf(\"The array is now: \"); for(int i = 0; i < 3; i++) { printf(\"%d \", arr[i]); } printf(\"\\nAnd the av", "question": "why dont we pass in &arr to function change", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: whats wrong with this code | Code context (simplify for kids): int *mkarray(int a, int b, int c) { int arr[3]; arr[0] = a; arr[1] = b; arr[2] = c; int *p = arr; return p; } // Code for other_function() omitted. int main() { int *ptr = mkarray(10, 20, 30); other_function(); printf(\"%d %d %d\\n\", ptr[0], ptr[1], ptr[2]); }", "question": "whats wrong with this code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when should we be allocating heap space", "question": "when should we be allocating heap space", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why doesnt this need malloc | Code context (simplify for kids): double change(int *a, int size) { double sum = 0.0; for(int i = 0; i < size; i++) { a[i] += 10; sum += a[i]; } return sum / size; // assume size > 0 } int main() { int arr[3] = {1, 2, 3}; double result = change(arr, 3); // Comment the above, and uncomment the below, to see // change only work on the", "question": "why doesnt this need malloc", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: So is it true that we only need to allocate space on the heap when variables with data that we want to persist throughout the program are created in the helper functions?", "question": "So is it true that we only need to allocate space on the heap when variables with data that we want to persist throughout the program are created in the helper functions?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: if car.color had pointed to &color_ptr instead, would it change to Blue? | Code context (simplify for kids): struct Car car; char *color_ptr = \"Green\"; car.color = color_ptr; car.mileage = 1000; color_ptr = \"Blue\"; struct Car *car_ptr = &car;", "question": "if car.color had pointed to &color_ptr instead, would it change to Blue?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is there a way to change car.color to blue | Code context (simplify for kids): struct Car car; char *color_ptr = \"Green\"; car.color = color_ptr; car.mileage = 1000; color_ptr = \"Blue\"; struct Car *car_ptr = &car;", "question": "is there a way to change car.color to blue", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. The resulting diagram will look something like the following when parentcreates 3 is run. In this case, the parent process creates 3 child processes. Note that the child process ids will not necessarily be in sequence. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol (argv[1], NULL, 10); int is_parent = 0; for (int i = 0; i < iterations; i++) { if (is_parent == 0) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } if (n ", "question": "", "intention": "modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. The resulting diagram will look something like the following when parentcreates 3 is run. In this case, the parent process creates 3 child processes. Note that the child process ids will not necessarily be in sequence.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. The resulting diagram will look something like the following when parentcreates 3 is run. In this case, the parent process creates 3 child processes. Note that the child process ids will not necessarily be in sequence. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol (argv[1], NULL, 10); int is_parent = 0; for (int i = 0; i < iterations; i++) { if (is_parent == 0) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } if (n ", "question": "", "intention": "modify the program so that the new children do not create additional processes. Only the original parent calls fork. Keep the printf call for all processes. The resulting diagram will look something like the following when parentcreates 3 is run. In this case, the parent process creates 3 child processes. Note that the child process ids will not necessarily be in sequence.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Create a copy of forkloop.c called childcreates.c. In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. | Code context (simplify for kids): if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { if (getppid() == getpid()) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(), ", "question": "", "intention": "Create a copy of forkloop.c called childcreates.c. In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i read a file line by line if i dont know the line length, only the max line length?", "question": "how can i read a file line by line if i dont know the line length, only the max line length?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: each process creates exactly one new process | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int child_count = 0; for (int i = 0; i < iterations; i++) { if (child_count == i) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } els", "question": "", "intention": "each process creates exactly one new process", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "question": "", "intention": "", "task_description": "Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you call wait", "question": "how do you call wait", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i perform write on a newline", "question": "how do i perform write on a newline", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i get rid of the error | Code context (simplify for kids): write(fd[1], '\\n', sizeof(char)); // Write the newline", "question": "how can i get rid of the error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i get rid of the error | Code context (simplify for kids): execl(\"./validate\", \"validate\", user_id, password);", "question": "how can i get rid of the error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why doesn't it properly check if the input is too long | Code context (simplify for kids): if (write(fd[1], password, MAXLINE) == -1) { // Write the password perror(\"write to pipe\"); } if ((close(fd[1])) == -1) { // Close the write perror(\"close\"); } wait(&status); // wait if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { // If it is equal to 0 printf(SUCCESS); } else { printf(INVALID)", "question": "why doesn't it properly check if the input is too long", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful. | Code context (simplify for kids): if (write(fd[1], password, MAXLINE) == -1) { // Write the password perror(\"write to pipe\"); } if ((close(fd[1])) == -1) { // Close the write perror(\"close\"); } wait(&status); // wait if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { // If it is equal to 0 printf(SUCCESS); } else { printf(INVALID)", "question": "Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: would this code snippet correctly check for the status | Code context (simplify for kids): wait(&status); // wait if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { // If it is equal to 0 printf(SUCCESS); } else { printf(INVALID); }", "question": "would this code snippet correctly check for the status", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "question": "", "intention": "", "task_description": "Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this right | Code context (simplify for kids): if ((r = fork()) > 0) { // If parent process if ((close(fd[0])) == -1) { // Close the read perror(\"close\"); } if (write(fd[1], user_id, MAXLINE) == -1) { // Write the user id perror(\"write to pipe\"); } if (write(fd[1], password, MAXLINE) == -1) { // Write the password perror(\"write to pipe\"); } if (", "question": "is this right", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is user_id properly written to the pipe but password is not | Code context (simplify for kids): if ((r = fork()) > 0) { // If parent process if ((close(fd[0])) == -1) { // Close the read perror(\"close\"); } if (write(fd[1], user_id, MAXLINE) == -1) { // Write the user id perror(\"write to pipe\"); } if (write(fd[1], password, MAXLINE) == -1) { // Write the password perror(\"write to pipe\"); } if (", "question": "why is user_id properly written to the pipe but password is not", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: would this code properly read 2 things that were written to it | Code context (simplify for kids): } else if (r == 0) { // If child process if ((dup2(fd[0], fileno(stdin))) == -1) { // So it can read from pipe perror(\"dup2\"); exit(1); } if ((close(fd[1])) == -1) { perror(\"close\"); } if ((close(fd[0])) == -1) { perror(\"close\"); } execl(\"./validate\", \"validate\", NULL); // Validate } else { perror(\"", "question": "would this code properly read 2 things that were written to it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i remove newline characters after calling fgets", "question": "how can i remove newline characters after calling fgets", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what can i use to make a copy of a string", "question": "what can i use to make a copy of a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this code do | Code context (simplify for kids): if (line[0] == '\\0') { continue; }", "question": "what does this code do", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: A rule is evaluated using the following steps: Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "question": "", "intention": "", "task_description": "A rule is evaluated using the following steps: Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: A rule is evaluated using the following steps: Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "question": "", "intention": "", "task_description": "A rule is evaluated using the following steps: Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "question": "", "intention": "", "task_description": "Update each of the dependencies. In other words, recursively evaluate each dependency rule. Compare the last modified time for each of the dependencies to the target. If the target does not exist, or at least one of the dependencies refers to a file with a last modified time more recent than the target, execute the rule's actions.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you use stat with examples", "question": "how do you use stat with examples", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if im writing a make system, can i: -code a while loop to iterate through the dependencies and recursively call the program on them -after the while loop is finished, check if target exists. if not, execute the rule's' actions -if it does exist, create a struct using stat to hold the modification time of the target rule. loop through its dependencies and check for their modification times. if the ", "question": "if im writing a make system, can i: -code a while loop to iterate through the dependencies and recursively call the program on them -after the while loop is finished, check if target exists. if not, execute the rule's' actions -if it does exist, create a struct using stat to hold the modification time of the target rule. loop through its dependencies and check for their modification times. if the ", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you know if If the child terminates with a non-zero exit status", "question": "how do you know if If the child terminates with a non-zero exit status", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you know if If the child terminates with a non-zero exit status after using execvp", "question": "how do you know if If the child terminates with a non-zero exit status after using execvp", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you print out multiple strings in an array into one line", "question": "how do you print out multiple strings in an array into one line", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i concatenate many strings together", "question": "how do i concatenate many strings together", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initiliaze a string array", "question": "how to initiliaze a string array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you explain this to me: When pmake is run with the -p option, a child should be created to update each dependency. The parent will create one child process for each dependency and after it has created all of them, the parent will wait for all children to terminate successfully before determining whether it needs to execute the actions.", "question": "can you explain this to me: When pmake is run with the -p option, a child should be created to update each dependency. The parent will create one child process for each dependency and after it has created all of them, the parent will wait for all children to terminate successfully before determining whether it needs to execute the actions.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i check if a file/target exists", "question": "how do i check if a file/target exists", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: When pmake is run with the -p option, a child should be created to update each dependency. The parent will create one child process for each dependency and after it has created all of them, the parent will wait for all children to terminate successfully before determining whether it needs to execute the actions.", "question": "", "intention": "", "task_description": "When pmake is run with the -p option, a child should be created to update each dependency. The parent will create one child process for each dependency and after it has created all of them, the parent will wait for all children to terminate successfully before determining whether it needs to execute the actions.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i do this to parallelize a makefile: 1. iterate through the dependencies, and at each dependency, fork the process. If its a child process, recursively call the program, then exit. if it is a parent, then wait. if so, what steps come next?", "question": "can i do this to parallelize a makefile: 1. iterate through the dependencies, and at each dependency, fork the process. If its a child process, recursively call the program, then exit. if it is a parent, then wait. if so, what steps come next?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); // POSITION A struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); // POSITION B x += 2; // POSITION C fprintf", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if im writing a program that executes makefiles, when executing multiple actions, do i need to loop through the actions and then fork once per action?", "question": "if im writing a program that executes makefiles, when executing multiple actions, do i need to loop through the actions and then fork once per action?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: run make in parallel | Code context (simplify for kids): Dependency *curr_dep = rule->dependencies; int num_dep = 0; while (curr_dep != NULL) { num_dep++; curr_dep = curr_dep->next_dep; } int child_pid_list[num_dep]; // Create a list to store the pid's of child processes int child_count = 0; // Create a variable to hold the number of children curr_dep = r", "question": "run make in parallel", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i put a function prototype in another file", "question": "how do i put a function prototype in another file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i put a function prototype in another file without a header file", "question": "how do i put a function prototype in another file without a header file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i put a function prototype in another file without a header file and without extern", "question": "how do i put a function prototype in another file without a header file and without extern", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i put a function prototype in another file without a header file and without extern", "question": "how do i put a function prototype in another file without a header file and without extern", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does this parallelize make? Note that i later have a for loop that calls waitpid on the list of child_pids | Code context (simplify for kids): if (rule == NULL) { // Base case for recursion return; } // Iterate through dependencies to get the number of dependencies if (rule->dependencies != NULL) { // Check if dependencies exist Dependency *curr_dep = rule->dependencies; int num_dep = 0; while (curr_dep != NULL) { num_dep++; curr_dep = cur", "question": "does this parallelize make? Note that i later have a for loop that calls waitpid on the list of child_pids", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this parallelizeing make? | Code context (simplify for kids): if (rule == NULL) { // Base case for recursion return; } // Iterate through dependencies to get the number of dependencies if (rule->dependencies != NULL) { // Check if dependencies exist Dependency *curr_dep = rule->dependencies; int num_dep = 0; while (curr_dep != NULL) { num_dep++; curr_dep = cur", "question": "is this parallelizeing make?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you use sigaction to handle sigprofs", "question": "how do you use sigaction to handle sigprofs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does updating inbuf mean", "question": "what does updating inbuf mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what do i need to do here: / You want to move the stuff after the full line to the beginning // of the buffer. A loop can do it, or you can use memmove. // memmove(destination, source, number_of_bytes)", "question": "what do i need to do here: / You want to move the stuff after the full line to the beginning // of the buffer. A loop can do it, or you can use memmove. // memmove(destination, source, number_of_bytes)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this right so far? | Code context (simplify for kids): while ((nbytes = read(fd, after, room)) > 0) { // Step 1: update inbuf (how many bytes were just added?) inbuf = nbytes; int where; // Step 2: the loop condition below calls find_network_newline // to determine if a full line has been read from the client. // Your next task should be to implement fi", "question": "is this right so far?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: did i correctly update inbuf to the correct value | Code context (simplify for kids): char buf[BUFSIZE] = {'\\0'}; int inbuf = 0; // How many bytes currently in buffer? int room = sizeof(buf); // How many bytes remaining in buffer? char *after = buf; // Pointer to position after the data in buf int nbytes; while ((nbytes = read(fd, after, room)) > 0) { // Step 1: update inbuf (how man", "question": "did i correctly update inbuf to the correct value", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is the correct message being printed | Code context (simplify for kids): while ((where = find_network_newline(buf, inbuf)) > 0) { // where is now the index into buf immediately after // the first network newline // Step 3: Okay, we have a full line. // Output the full line, not including the \"\\r\\n\", // using print statement below. // Be sure to put a '\\0' in the correct ", "question": "is the correct message being printed", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is the stuff after the full line moved to the beginning of the buffer and is after and room being correctly updated | Code context (simplify for kids): // Note that we could have also used write to avoid having to // put the '\\0' in the buffer. Try using write later! // Step 4: update inbuf and remove the full line from the buffer // There might be stuff after the line, so don't just do inbuf = 0. // You want to move the stuff after the full line t", "question": "is the stuff after the full line moved to the beginning of the buffer and is after and room being correctly updated", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i do this: Change the code to broadcast to all connected clients", "question": "how do i do this: Change the code to broadcast to all connected clients", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: client: connect: Connection refused how to fix", "question": "client: connect: Connection refused how to fix", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what steps can i take to fix the error client: connect: Connection refused", "question": "what steps can i take to fix the error client: connect: Connection refused", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how to change the error: initialization discards ‘const’ qualifier from pointer target type error | Code context (simplify for kids): char *list_users(const User *curr) { // Get the length of the returned string int num_char = 0; User *curr_user = curr;", "question": "how to change the error: initialization discards ‘const’ qualifier from pointer target type error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: help me fix this error | Code context (simplify for kids): friends.c : 251 : 9 : error : format not a string literal and no format arguments[-Werror = format - security] 251 | num_bytes_written += snprintf(user_buf + num_bytes_written, num_char - num_bytes_written, print_post(curr)); // Append the post contents", "question": "help me fix this error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you use EWOULDBLOCK or EAGAIN to make sure read does not block", "question": "How do you use EWOULDBLOCK or EAGAIN to make sure read does not block", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do i need to deal with the remaining data in buffer if I'm reading one line doing partial reads", "question": "do i need to deal with the remaining data in buffer if I'm reading one line doing partial reads", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: am i passing in the correct user name into process_args | Code context (simplify for kids): while (curr_client != NULL) { if (curr_client->client_soc > -1 && FD_ISSET(curr_client->client_soc, &all_fds)) { char *input = read_input(curr_client->client_soc); if (input == NULL) { // If connection closed printf(\"Client %d disconnected\\n\", client_count); } else if (read_from(client_count, users,", "question": "am i passing in the correct user name into process_args", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how will the server know which user is using it | Code context (simplify for kids): while (curr_client != NULL) { if (curr_client->client_soc > -1 && FD_ISSET(curr_client->client_soc, &all_fds)) { char *input = read_input(curr_client->client_soc); if (input == NULL) { // If connection closed printf(\"Client %d disconnected\\n\", client_count); } else if (read_from(client_count, users,", "question": "how will the server know which user is using it", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: a function called read_input that handles partial reads and returns 1 full line (newline terminated) of input", "question": "", "intention": "", "task_description": "a function called read_input that handles partial reads and returns 1 full line (newline terminated) of input", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a pointer", "question": "what is a pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I want to assign the second value of the array to 1. | Code context (simplify for kids): void fib(int **arr, int n){ *arr = malloc(sizeof(int)*(n)); for (int x = 0; x < n; x++){ if (x == 0){ *arr[x] = 0; } if (x == 1){ *arr[x] = 1; } }", "question": "", "intention": "I want to assign the second value of the array to 1.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I'm getting a cygwin_exception::open_stackdumpfile error | Code context (simplify for kids): void fib(int **arr, int n){ *arr = malloc(sizeof(int)*(n)); for (int x = 0; x < n; x++){ if (x == 0){ *arr[x] = 0; } if (x == 1){ *arr[x] = 1; } }", "question": "", "intention": "I'm getting a cygwin_exception::open_stackdumpfile error", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void fib(int **arr, int n){ *arr = malloc(sizeof(int)*(n)); for (int x = 0; x < n; x++){ if (x == 0){ *arr[x] = 0; } else if (x == 1){ *arr[x] = 1; } else { *arr[x] = *arr[x-1] + *arr[x-2]; printf(\"%d\\n\", *arr[x]); } } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Am I casting a constant to head? | Code context (simplify for kids): User *find_user(const char *name, const User *head) { while (head != NULL){ if (strncmp(name, head->name, MAX_NAME) == 0){ return (const User*)head; } head = head->next; } return NULL; }", "question": "Am I casting a constant to head?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): int sum_card(int **score_card, int size) { // TODO: write the body of sum_card according to its description. int sum = 0; for (i=0; i<=size; i++) { sum += **score_card[i]; } return sum; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): int sum_card(int **score_card, int size) { // TODO: write the body of sum_card according to its description. int sum = 0; for (i=0; i<=size; i++) { sum += *score_card[i]; } return sum; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): int sum_card(int **score_card, int size) { // TODO: write the body of sum_card according to its description. int sum = 0; for (i=0; i<=size; i++) { sum += *score_card[i]; } return sum; } /* * NOTE: don't change the main function! * The command line arguments are a sequence of integers that will be *", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): int sum_card(int **score_card, int size) { // TODO: write the body of sum_card according to its description. int sum = 0; for (int i=0; i<=size; i++) { sum += *score_card[i]; } return sum; } /* * NOTE: don't change the main function! * The command line arguments are a sequence of integers that will ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char **argv) { int size = argc - 1; int *score_card[size]; for (int i = 0; i < size; i++) { // NOTE: We haven't covered malloc yet, so don't worry about this line. score_card[i] = malloc(sizeof(int)); *(score_card[i]) = strtol(argv[i + 1], NULL, 10); } printf(\"Sum: %d\\n\", sum_card", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int sum_card(int **score_card, int size) { // TODO: write the body of sum_card according to its description. int sum = 0; for (int i=0; i<=size; i++) { sum += score_card[i]; } return sum; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Is this a valid way to truncate a string | Code context (simplify for kids): strncpy(s, s, n);", "question": "Is this a valid way to truncate a string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void list_users(const User *curr) { while (curr != NULL) { printf(curr->name); curr = curr->next; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print the usernames of all users in the list starting at curr. Names should be printed to standard output, one per line. Is there anything to be fixed? | Code context (simplify for kids): void list_users(const User *curr) { while (curr != NULL) { printf(curr->name); curr = curr->next; } }", "question": "", "intention": "Print the usernames of all users in the list starting at curr. Names should be printed to standard output, one per line. Is there anything to be fixed?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Change the filename for the profile pic of the given user. Return: - 0 on success. - 1 if the file does not exist or cannot be opened. - 2 if the filename is too long. | Code context (simplify for kids): int update_pic(User *user, const char *filename) { /* Check if filename is too long. */ if (strlen(filename) > sizeof(user->profile_pic) - 1) { return 2; } elif (fopen(filename, \"r\") == NULL) { return 1; } else { user->profile_pic = filename; return 0; } }", "question": "", "intention": "Change the filename for the profile pic of the given user. Return: - 0 on success. - 1 if the file does not exist or cannot be opened. - 2 if the filename is too long.", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int update_pic(User *user, const char *filename) { /* Check if filename is too long. */ if (strlen(filename) > sizeof(user->profile_pic) - 1) { return 2; } else if (fopen(filename, \"r\") == NULL) { return 1; } else { strncpy(user->profile_pic, filename, sizeof(user->profile_pic)); return 0; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: If the file does not exist, will fopen() also return NULL? | Code context (simplify for kids): int update_pic(User *user, const char *filename) { /* Check if filename is too long. */ if (strlen(filename) > sizeof(user->profile_pic) - 1) { return 2; } else if (fopen(filename, \"r\") == NULL) { return 1; } else { strncpy(user->profile_pic, filename, sizeof(user->profile_pic)); return 0; } }", "question": "If the file does not exist, will fopen() also return NULL?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if I have an array of pointers, how can I determine its size?", "question": "if I have an array of pointers, how can I determine its size?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I keep getting a seg fault in line 22 where I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list. | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; int delete_user(const char *name, User **user_ptr_del) { User *this_user = find_user(name, *us", "question": "", "intention": "I keep getting a seg fault in line 22 where I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I keep getting a seg fault in line 22 where I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list. | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; int delete_user(const char *name, User **user_ptr_del) { User *this_user = find_user(name, *us", "question": "", "intention": "I keep getting a seg fault in line 22 where I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I keep getting a seg fault in line 22. I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list. | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; int delete_user(const char *name, User **user_ptr_del) { User *this_user = find_user(name, *us", "question": "I keep getting a seg fault in line 22. I want to take this_user's friend list, loop through each friend, and find this_user's index in the friend's friend list.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I want to free the memory in the heap but I am getting a memory leak. | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "I want to free the memory in the heap but I am getting a memory leak.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Still getting a memory leak | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "Still getting a memory leak", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this code have the same implementation as strncpy? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } // Case 2: dest > src; have space left in dest // Already memset so n", "question": "does this code have the same implementation as strncpy?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } // Case 2: dest > src; have space left in dest // Already memset so n", "question": "Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } dest[-1] = '\\0'; // Case 2: dest > src; have space left in dest // Al", "question": "Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity; i++) { dest[i] = src[i]; } dest[-1] = '\\0'; // Case 2: dest > src; have space left in dest // Already memset so no", "question": "Does this code do what it is supposed to do: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity; i++) { dest[i] = src[i]; } dest[-1] = '\\0'; // Case 2: dest > src; have space left in dest // Already memset so no", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } dest[-1] = '\\0'; // Case 2: dest > src; have space left in dest // Al", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } dest[capacity] = '\\0'; // Case 2: dest > src; have space left in dest", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. How can I fix the code?", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I add a null terminator to the end of the string? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { memset(dest, '\\0', capacity); // Case 1: dest < src; cannot fully copy over, need to null terminate for (int i = 0; i < capacity && src[i] != '\\0'; i++) { dest[i] = src[i]; } dest[capacity] = '\\0'; // Case 2: dest > src; have space left in dest", "question": "How do I add a null terminator to the end of the string?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I add a null terminator to the end of the string? | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "How do I add a null terminator to the end of the string?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do? | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do?", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do? | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do? | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. Does this code do what it is supposed to do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. | Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest.", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): /* Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I am trying to make it such that only the parent can call fork(), but I am stuck. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid; for (int i = 0; i < iterations; i++) { if (i = 0) { int n = fork(); if (n != 0) { pid = getppid(); } } int n = fork(); if (n < 0) { pe", "question": "I am trying to make it such that only the parent can call fork(), but I am stuck.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I modify this code so that only the parent can call fork()? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(", "question": "How do I modify this code so that only the parent can call fork()?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid; int n; for (int i = 0; i < iterations; i++) { // if (i = 0) { // int n = fork(); // if (n != 0) { // pid = getppid(); // } // } if (n ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: the new children do not create additional processes. Only the original parent calls fork. But currently, I get one extra fork | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid; int n; for (int i = 0; i < iterations; i++) { if (n != 0) { n = fork(); } if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, p", "question": "", "intention": "the new children do not create additional processes. Only the original parent calls fork. But currently, I get one extra fork", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I want to make sure only the original parent calls fork. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid; int n; for (int i = 0; i < iterations; i++) { if (n != 0) { n = fork(); } if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, p", "question": "", "intention": "I want to make sure only the original parent calls fork.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I want to make it such that only child calls fork(). | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n == 0) { n = fork(); } if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, p", "question": "I want to make it such that only child calls fork().", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I would like to make sure only child calls fork() but now it only calls it once and terminates when i = 2. So I only get one process from the child instead of 2. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int n; fork(); for (int i = 0; i < iterations; i++) { if (n == 0) { n = fork(); } if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pi", "question": "", "intention": "I would like to make sure only child calls fork() but now it only calls it once and terminates when i = 2. So I only get one process from the child instead of 2.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I would like to make sure only child calls fork() but now it only calls it once and terminates when i = 2. So I only get one process from the child instead of 2. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int n; fork(); for (int i = 0; i < iterations; i++) { if (n == 0) { n = fork(); } if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pi", "question": "I would like to make sure only child calls fork() but now it only calls it once and terminates when i = 2. So I only get one process from the child instead of 2.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the vaue of ptr | Code context (simplify for kids): char *ptr;", "question": "what is the vaue of ptr", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of s | Code context (simplify for kids): char s;", "question": "what is the value of s", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: logical or in c", "question": "logical or in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialize a empty string?", "question": "how to initialize a empty string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of s | Code context (simplify for kids): char s[3] =\"\";", "question": "what is the value of s", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: logical not in c", "question": "logical not in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is not in C", "question": "what is not in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): bool t = not false;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is operator not different than logical operator !", "question": "is operator not different than logical operator !", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to declare a boolean type variable", "question": "how to declare a boolean type variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: value of false", "question": "value of false", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what type is false", "question": "what type is false", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): 0 and 0 == false;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): 0 || 1 == true;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: format specifier for boolean type", "question": "format specifier for boolean type", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is being compared when use == to compare two pointers", "question": "what is being compared when use == to compare two pointers", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are switch stateemnts", "question": "what are switch stateemnts", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does fclose return", "question": "what does fclose return", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how to initialize user.profile_pic to an empty array | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "how to initialize user.profile_pic to an empty array", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User user1; char user1.profile_pic[20];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: initialize user1.profile_pic to an empty array | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User user1; char user1.profile_pic[20];", "question": "", "intention": "initialize user1.profile_pic to an empty array", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: declare user1.profile_pic to be an array of char | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User user1; char user1.profile_pic[20];", "question": "", "intention": "declare user1.profile_pic to be an array of char", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: value of true", "question": "value of true", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): strlen(NULL);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char s[3]; sprintf(s, \"%s\", NULL);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Is there any problem of this code? | Code context (simplify for kids): int main() { return 0; }", "question": "Is there any problem of this code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: write a socket program that can transfer information", "question": "write a socket program that can transfer information", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do i need to free the pointer returned by ctime()", "question": "do i need to free the pointer returned by ctime()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a static variable?", "question": "what is a static variable?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does this code do? | Code context (simplify for kids): int (*complex(int index))(char *s, int l);", "question": "What does this code do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code generate a seg fault | Code context (simplify for kids): 8 void fib(int **fib_sequence, int n) { 19 *fib_sequence = malloc(sizeof(int) * n); 20 for (int i = 0; i < n; i++) { 21 if (i < 2) { 22 *fib_sequence[i] = i; 23 } else { 24 *fib_sequence[i] = *fib_sequence[i - 2] + *fib_sequence[i - 1]; 25 } 26 } 27 }", "question": "Why does this code generate a seg fault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code only look at the first argument of the list? | Code context (simplify for kids): int **split_array(const int *s, int length) { 14 int **main_array = malloc(sizeof(int *) * 2); 15 main_array[0] = malloc(sizeof(int) * length / 2); 16 main_array[1] = malloc(sizeof(int) * length / 2); 17 18 for (int i = 0; i < length; i++) { 19 if (i % 2 == 0) { 20 main_array[0][i] = s[i]; 21 } else", "question": "Why does this code only look at the first argument of the list?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why does this overallocate memory on odd length arrays | Code context (simplify for kids): int **split_array(const int *s, int length) { int **main_array = malloc(sizeof(int *) * 2); main_array[0] = malloc(sizeof(int) * (length / 2 + length % 2)); main_array[1] = malloc(sizeof(int) * (length / 2)); for (int i = 0; i < length; i++) { if (i % 2 == 0) { main_array[0][i / 2] = s[i]; } else { ", "question": "", "intention": "why does this overallocate memory on odd length arrays", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This code should allocate the correct amount of memory to each of the 2 arrays based on the length of the input array. For example, if the array is length 3, it should allocate sizeof(int) * 2 to the first array and sizeof(int) to the second | Code context (simplify for kids): int **split_array(const int *s, int length) { int **main_array = malloc(sizeof(int *) * 2); main_array[0] = malloc(sizeof(int) * (length / 2 + length % 2)); main_array[1] = malloc(sizeof(int) * (length / 2)); for (int i = 0; i < length; i++) { if (i % 2 == 0) { main_array[0][i / 2] = s[i]; } else { ", "question": "", "intention": "This code should allocate the correct amount of memory to each of the 2 arrays based on the length of the input array. For example, if the array is length 3, it should allocate sizeof(int) * 2 to the first array and sizeof(int) to the second", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: For some reason, this is not correctly adding a new user to the list of users | Code context (simplify for kids): int create_user(const char *name, User **user_ptr_add) { 17 18 // Check the sizeof the name array 19 if (strlen(name) > 31) { 20 // Name is too long 21 return 2; 22 } 23 24 // Initialize a new user with name pointing to NULL 25 User new_user; 26 strcpy(new_user.name, name); 27 new_user.next = NULL; ", "question": "", "intention": "For some reason, this is not correctly adding a new user to the list of users", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How do I allocate memory when creating the user struct | Code context (simplify for kids): int create_user(const char *name, User **user_ptr_add) { 17 18 // Check the sizeof the name array 19 if (strlen(name) > 31) { 20 // Name is too long 21 return 2; 22 } 23 24 // Initialize a new user with name pointing to NULL 25 User new_user; 26 strcpy(new_user.name, name); 27 new_user.next = NULL; ", "question": "", "intention": "How do I allocate memory when creating the user struct", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print the contents of an ASCII file | Code context (simplify for kids): char picture[MAX_NAME]; 262 FILE *profile = fopen(user->profile_pic, \"r\"); 263 fgets(picture, MAX_NAME, profile); 264 printf(\"%s\\n\", picture);", "question": "", "intention": "Print the contents of an ASCII file", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This code should print the entire file, but it only prints the first line | Code context (simplify for kids): char picture[MAX_NAME]; 262 FILE *profile = fopen(user->profile_pic, \"r\"); 263 fgets(picture, MAX_NAME, profile); 264 printf(\"%s\", picture);", "question": "", "intention": "This code should print the entire file, but it only prints the first line", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I am attempting to copy contents, which is type char * and allocated on the heap to contents, which is also type char * | Code context (simplify for kids): strcpy(new_post->contents, contents);", "question": "", "intention": "I am attempting to copy contents, which is type char * and allocated on the heap to contents, which is also type char *", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This should work just the same as strncpy | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { 16 17 int i; 18 for (i = 0; i < capacity && src[i] != '\\0'; i++) { 19 dest[i] = src[i]; 20 } 21 22 for (; i < capacity; i++) { 23 dest[i] = '\\0'; 24 } 25 26 return dest; 27 }", "question": "", "intention": "This should work just the same as strncpy", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: this code is meant to find the length of the string before the colon | Code context (simplify for kids): char *output; char *ptr = strchr(output, ':'); 32 33 // Copy the length of ptr - 1 to the target variable 34 int size = ptr - output;", "question": "", "intention": "this code is meant to find the length of the string before the colon", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: this code is meant to find the length of the string before the colon | Code context (simplify for kids): char *output; char *ptr = strchr(output, ':'); 32 33 // Copy the length of ptr - 1 to the target variable 34 int size = ptr - output - 1;", "question": "", "intention": "this code is meant to find the length of the string before the colon", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This code is meant to tokenize a word off spaces and build a list of rules and dependencies. Currently, it only does one iteration | Code context (simplify for kids): char *dep = strtok(NULL, \" \"); Rule *rule_adder = curr; Dependency *curr_dep; while (dep != NULL) { // Allocate space for the dependency Dependency *new_dep = malloc(sizeof(Dependency)); if (rule_adder->dependencies == NULL) { rule_adder->dependencies = new_dep; curr_dep = rule_adder->dependencies; ", "question": "This code is meant to tokenize a word off spaces and build a list of rules and dependencies. Currently, it only does one iteration", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: *pt[2] is equal to what expression in C", "question": "*pt[2] is equal to what expression in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why *pt[2] = malloc(2 * size(int)) is invalid expression in C", "question": "why *pt[2] = malloc(2 * size(int)) is invalid expression in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int **split_array(const int *s, int length) { int **pt; *pt = malloc(2 * sizeof(int *)); **pt = malloc((length / 2 ) * sizeof(int)); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int **split_array(const int *s, int length) { int **pt; *pt = malloc(2 * sizeof(int *)); pt = malloc((length / 2 ) * sizeof(int)); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Check whether the pt has structure pt[2][length / 2] | Code context (simplify for kids): int **split_array(const int *s, int length) { int **pt; *pt = malloc(2 * sizeof(int *)); pt = malloc((length / 2 ) * sizeof(int)); }", "question": "", "intention": "Check whether the pt has structure pt[2][length / 2]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why my racket program saying n unbound error | Code context (simplify for kids): (define (n-of n v) void) (if (zero? n) `() (cons(x xl) (n-of n-1 v)))", "question": "", "intention": "why my racket program saying n unbound error", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to implement greedy algorithm", "question": "How to implement greedy algorithm", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: You only know C?", "question": "You only know C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is write in memory when run int I=5;", "question": "What is write in memory when run int I=5;", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I read in la -l input to my files without using pipes", "question": "how do I read in la -l input to my files without using pipes", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I prevent segfaults?", "question": "How do I prevent segfaults?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf(\"%.8s\\n\",(char*)&_);}", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int arr[10];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int arr[];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How much memory is allocated? | Code context (simplify for kids): int arr[];", "question": "How much memory is allocated?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: remove target_client from the linked list, client | Code context (simplify for kids): /* * Remove target_client from the given clients and free the memory. * Return the fd of the client if it was removed successfully. * Return 0 otherwise. */ int remove_client(Client *target_client, Client **clients){ Client *curr_client = *clients; // return 0 if the list is empty if (curr_client ==", "question": "remove target_client from the linked list, client", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i find length of int as a string", "question": "how can i find length of int as a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do i use asprintf", "question": "How do i use asprintf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I've used malloc to allocate the memory in the heap for a local-scope variable, but that still gets destroyed after the function call. What went wrong?", "question": "I've used malloc to allocate the memory in the heap for a local-scope variable, but that still gets destroyed after the function call. What went wrong?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int on = 1; int status = setsockopt(soc, SOL_SOCKET, SO_REUSEADDR, (const char *)&on, sizeof(on)); if (status < 0) { perror(\"setsockopt\"); exit(1); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): if (bind(soc, (struct sockaddr *)self, sizeof(*self)) < 0) { // bind failed; could be because port is in use. perror(\"bind\"); exit(1); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int accept_connection(int listenfd) { struct sockaddr_in peer; unsigned int peer_len = sizeof(peer); peer.sin_family = AF_INET; fprintf(stderr, \"Waiting for a new connection...\\n\"); int client_socket = accept(listenfd, (struct sockaddr *)&peer, &peer_len); if (client_socket < 0) { perror(\"accept\"); ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): struct sockaddr_in addr; // Allow sockets across machines. addr.sin_family = AF_INET; // The port the server will be listening on. addr.sin_port = htons(port); // Clear this field; sin_zero is used for padding for the struct. memset(&(addr.sin_zero), 0, 8); // Lookup host IP address. struct hostent ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Accepted connection should be printed on line 181 | Code context (simplify for kids): int client_fd = accept(fd, NULL, NULL); if (client_fd < 0) { perror(\"server: accept\"); close(fd); exit(1); } // If this is a valid user users[user_index].sock_fd = client_fd; users[user_index].username = NULL;", "question": "Accepted connection should be printed on line 181", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *string; char array1[5] = \"Hola\"; strncpy(string, array1, 5);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: string should also be \"Hola\" | Code context (simplify for kids): char *string; char array1[5] = \"Hola\"; strncpy(string, array1, 5);", "question": "string should also be \"Hola\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: string should be \"Hola\" | Code context (simplify for kids): char *string = malloc(5); char array1[5] = \"Hola\"; strncpy(string, array1, 5);", "question": "string should be \"Hola\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): setbuf(stdout, NULL);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does socket() return upon success? | Code context (simplify for kids): int server_soc = socket(AF_INET, SOCK_STREAM, 0); if (server_soc < 0) { perror(\"Socket:\"); }", "question": "What does socket() return upon success?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Should I use select() for clients?", "question": "Should I use select() for clients?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should I use select() on client program?", "question": "Should I use select() on client program?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does 'return 0;' be read as 0 bytes for read()?", "question": "Does 'return 0;' be read as 0 bytes for read()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does FDSET() do?", "question": "what does FDSET() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I write nothing to write()?", "question": "Could I write nothing to write()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should I specify the size of an array first before using asprintf?", "question": "Should I specify the size of an array first before using asprintf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When should I clean up an array of char?", "question": "When should I clean up an array of char?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When should I use accept() when using select()?", "question": "When should I use accept() when using select()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can a server manage multiple connections by calling 1 accept()?", "question": "Can a server manage multiple connections by calling 1 accept()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check which fd is ready to read with FD_ISSET()?", "question": "How to check which fd is ready to read with FD_ISSET()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How can FD_ISSET() tell which client fd is ready?", "question": "How can FD_ISSET() tell which client fd is ready?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does inet_pton() do?", "question": "What does inet_pton() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does FD_SET() do?", "question": "What does FD_SET() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does select() return?", "question": "What does select() return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to tell which fd is ready to read after using select()?", "question": "how to tell which fd is ready to read after using select()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What members are in struct sockaddr_in?", "question": "What members are in struct sockaddr_in?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does connect() do to client socket fd?", "question": "What does connect() do to client socket fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I know server socket fd via connect()?", "question": "How do I know server socket fd via connect()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How does connect() work on client socket?", "question": "How does connect() work on client socket?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does a client know a server fd after connect()?", "question": "Does a client know a server fd after connect()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I dereference a header to the null linked list in c?", "question": "Can I dereference a header to the null linked list in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I always modify the size of waiting queue for listen()?", "question": "Can I always modify the size of waiting queue for listen()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use execl()?", "question": "How to use execl()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to run execl on one process and receive the return on the other process?", "question": "How to run execl on one process and receive the return on the other process?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use read() and write()?", "question": "How to use read() and write()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is each element in argv[] separated by blank space?", "question": "Is each element in argv[] separated by blank space?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does read() return 0?", "question": "When does read() return 0?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does read() return 0 in socket programming?", "question": "When does read() return 0 in socket programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Whatt does socket() return?", "question": "Whatt does socket() return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does accept() take on the server side?", "question": "What does accept() take on the server side?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is accept() only be used on server side?", "question": "Is accept() only be used on server side?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How can a client use accept()?", "question": "How can a client use accept()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How does a client use connect()?", "question": "How does a client use connect()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does accept() return client fd upon success?", "question": "Does accept() return client fd upon success?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I malloc a whole struct, is every member of it also malloced?", "question": "If I malloc a whole struct, is every member of it also malloced?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I get client fd in the waiting list from listen()?", "question": "How do I get client fd in the waiting list from listen()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to loop over set_fd?", "question": "How to loop over set_fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to find the second largest fd in fd_set?", "question": "How to find the second largest fd in fd_set?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could FD_ISSET() prevent the program from being blocked by read()?", "question": "Could FD_ISSET() prevent the program from being blocked by read()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to prevent a program from being blocked by accept()?", "question": "How to prevent a program from being blocked by accept()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to reconnect a client to their previous client fd?", "question": "How to reconnect a client to their previous client fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to avoid redefinition from a header file?", "question": "How to avoid redefinition from a header file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to avoid function redefinition from a header file?", "question": "How to avoid function redefinition from a header file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can a server keep track of multiple client sockets at once after calling select() and FD_ISSET()?", "question": "Can a server keep track of multiple client sockets at once after calling select() and FD_ISSET()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do I need to malloc an int member inside a struct?", "question": "Do I need to malloc an int member inside a struct?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Arguments of read()?", "question": "Arguments of read()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: new_user->sock_fd should be assigned with int fd | Code context (simplify for kids): Usersockname *new_user = to_malloc(sizeof(Usersockname)); // to_malloc is from friends.c new_user->username = to_malloc(strlen(name) + 1); new_user->sock_fd = to_malloc(sizeof(int)); new_user->next = to_malloc(sizeof(Usersockname)); // There was a previous check on length size, so no need to recheck", "question": "new_user->sock_fd should be assigned with int fd", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Malloc but still cannot hold memory", "question": "Malloc but still cannot hold memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it a good idea to use malloc() inside a local scope?", "question": "Is it a good idea to use malloc() inside a local scope?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How should I malloc the ptr to the first node of array list?", "question": "How should I malloc the ptr to the first node of array list?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How should I malloc the double ptr to the first node of array list?", "question": "How should I malloc the double ptr to the first node of array list?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to use dup2() instead of pipe()?", "question": "When to use dup2() instead of pipe()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to properly initialize an array of char without any garbage?", "question": "How to properly initialize an array of char without any garbage?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to avoid read() from reading a blank line?", "question": "How to avoid read() from reading a blank line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check for an empty line in C?", "question": "How to check for an empty line in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should I use fgets() in socket programming?", "question": "Should I use fgets() in socket programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use strtok() to filter out empty line?", "question": "How to use strtok() to filter out empty line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does FD_SET do?", "question": "What does FD_SET do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How can a server take care of multiple simultaneously requests from different clients at once?", "question": "How can a server take care of multiple simultaneously requests from different clients at once?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I used select(), FD_SET() and FD_ISSET() but server still ignores upcoming requests", "question": "I used select(), FD_SET() and FD_ISSET() but server still ignores upcoming requests", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should I malloc a char[]?", "question": "Should I malloc a char[]?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does read() return -1?", "question": "When does read() return -1?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Will close(fd) also close the pipe?", "question": "Will close(fd) also close the pipe?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why FD_SET() does not add new fd into fd_set?", "question": "Why FD_SET() does not add new fd into fd_set?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why double free or corruption (out) when I only free() for the first time?", "question": "why double free or corruption (out) when I only free() for the first time?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does free() gives corrupted error?", "question": "When does free() gives corrupted error?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I copy a malloced string to a stack-allocated string?", "question": "Could I copy a malloced string to a stack-allocated string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use strlen() on just dynamically allocated string without any input?", "question": "Could I use strlen() on just dynamically allocated string without any input?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to tell if a malloced string is empty or not?", "question": "How to tell if a malloced string is empty or not?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is all malloced string initialized with null characters?", "question": "Is all malloced string initialized with null characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does memset() affect malloced string?", "question": "Does memset() affect malloced string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Will strtok() return a stack-allocated string after tokenizing heap-allocated string?", "question": "Will strtok() return a stack-allocated string after tokenizing heap-allocated string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does select() return where there is a signal from a client?", "question": "What does select() return where there is a signal from a client?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to know how many clients are talking via select() and FD_ISSET()?", "question": "How to know how many clients are talking via select() and FD_ISSET()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should the server call accept() multiple times on the same client?", "question": "Should the server call accept() multiple times on the same client?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use the fcntl() function with the O_NONBLOCK flag for non-blocking select() call?", "question": "How to use the fcntl() function with the O_NONBLOCK flag for non-blocking select() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How should I use fcntl() in socket programming?", "question": "How should I use fcntl() in socket programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use fcntl() with multiple fds?", "question": "How to use fcntl() with multiple fds?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why fcntl() leads to broken pipe?", "question": "Why fcntl() leads to broken pipe?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to make a server unblocking on read() call from multiple clients?", "question": "How to make a server unblocking on read() call from multiple clients?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I used select() and FD_ISSET() but the server still blocks inputs from clients?", "question": "I used select() and FD_ISSET() but the server still blocks inputs from clients?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What makes select() call knows a client is ready to read?", "question": "What makes select() call knows a client is ready to read?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the point of using FD_ISSET() after select() call?", "question": "What is the point of using FD_ISSET() after select() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to make a read() call unblocking?", "question": "How to make a read() call unblocking?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use fcntl()?", "question": "How to use fcntl()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to know if the read() call is blocking?", "question": "How to know if the read() call is blocking?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is the server socket fd always set at 3?", "question": "Is the server socket fd always set at 3?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is select() a blocking function?", "question": "is select() a blocking function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to set out a timeout for select()?", "question": "How to set out a timeout for select()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does select() return after being timed out?", "question": "what does select() return after being timed out?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why the server keeps ignoring clients' call even though using select(), FD_iSSET() and reset the set_fd to the original set_fd?", "question": "Why the server keeps ignoring clients' call even though using select(), FD_iSSET() and reset the set_fd to the original set_fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use FD_COPY()?", "question": "How to use FD_COPY()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the parameters of FD_COPY()?", "question": "What are the parameters of FD_COPY()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to copy a set_fd object?", "question": "How to copy a set_fd object?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does select() save the ready-to-read fd to its parameters?", "question": "Does select() save the ready-to-read fd to its parameters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to print out every fd inside fd_set?", "question": "How to print out every fd inside fd_set?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why does strtol need pointer to char array?", "question": "why does strtol need pointer to char array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if I pass string of 0 to strtol?", "question": "What happens if I pass string of 0 to strtol?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if I pass a NULL endptr to strtol()?", "question": "What happens if I pass a NULL endptr to strtol()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does strtol read negative values?", "question": "Does strtol read negative values?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when does strtol return an error?", "question": "when does strtol return an error?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does strtol return an error if there is a non-numeric value in a string?", "question": "Does strtol return an error if there is a non-numeric value in a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if errno is not 0?", "question": "What happens if errno is not 0?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Which process id pick up orphanage processes?", "question": "Which process id pick up orphanage processes?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is waitpid() a blocking function?", "question": "Is waitpid() a blocking function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does waitpid return 0 mean that pid process is an orphan?", "question": "Does waitpid return 0 mean that pid process is an orphan?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What return status of waitpid indicate that pid process is a zombie?", "question": "What return status of waitpid indicate that pid process is a zombie?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do we call pipe in C?", "question": "How do we call pipe in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does pipe() return -1?", "question": "When does pipe() return -1?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is a newer pid always greater than the older ones?", "question": "Is a newer pid always greater than the older ones?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are system calls returning -1 as errors?", "question": "Are system calls returning -1 as errors?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if I close a closed fd?", "question": "What happens if I close a closed fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if I close a non-existent fd?", "question": "What happens if I close a non-existent fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to close all previously forked children processes?", "question": "How to close all previously forked children processes?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why do I need to pass in ptr to read() and write() call?", "question": "Why do I need to pass in ptr to read() and write() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does buffer do in write() and read()?", "question": "What does buffer do in write() and read()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does buffer do in read()?", "question": "What does buffer do in read()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does waitpid() return -1?", "question": "When does waitpid() return -1?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use WNOHANG with waitpid()?", "question": "How to use WNOHANG with waitpid()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why does wait() need a ptr to status?", "question": "Why does wait() need a ptr to status?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Use wait() with WIFEXITED and WEXITSTATUS", "question": "Use wait() with WIFEXITED and WEXITSTATUS", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What argument does WEIXTSTATUS take?", "question": "What argument does WEIXTSTATUS take?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What argument does WEXITSTATUS take?", "question": "What argument does WEXITSTATUS take?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: open() vs. fopen()?", "question": "open() vs. fopen()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does dup2() do in C?", "question": "What does dup2() do in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use execl()?", "question": "How to use execl()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the parameters of waitpid()?", "question": "What are the parameters of waitpid()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: sigaddset() and sigemptyset() in C?", "question": "sigaddset() and sigemptyset() in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: sigprocmask()?", "question": "sigprocmask()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does sigprocmask() block a signal from reaching a process?", "question": "Does sigprocmask() block a signal from reaching a process?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does sigprocmask()?", "question": "What does sigprocmask()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does SIG_BLOCK do?", "question": "what does SIG_BLOCK do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does SIG_SETMASK do?", "question": "What does SIG_SETMASK do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you use the `sigprocmask()` function to check if a signal is currently blocked or unblocked in your program?", "question": "Can you use the `sigprocmask()` function to check if a signal is currently blocked or unblocked in your program?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to fill out oldset in sigcpromask()?", "question": "When to fill out oldset in sigcpromask()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does an oldset and set in setprocmask()?", "question": "Does an oldset and set in setprocmask()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What do oldset and set contain in sigprocmask()?", "question": "What do oldset and set contain in sigprocmask()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is a signal mask?", "question": "What is a signal mask?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does struct sigaction do?", "question": "What does struct sigaction do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does sigaction() do in C?", "question": "What does sigaction() do in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What defines as a user-defined signal or SIGUSR?", "question": "What defines as a user-defined signal or SIGUSR?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Difference between signal() and sigaction()?", "question": "Difference between signal() and sigaction()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could sigaction() be used to unblock a masked signal?", "question": "Could sigaction() be used to unblock a masked signal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could sigaction() be used to modify sa_handler of struct sigaction?", "question": "Could sigaction() be used to modify sa_handler of struct sigaction?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is sigaction() be used to update the system behavior according to the members of the given struct sigaction?", "question": "Is sigaction() be used to update the system behavior according to the members of the given struct sigaction?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the purpose of signum in sigaction()?", "question": "What is the purpose of signum in sigaction()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use sigaddset() instead of passing a signum into sigaction()?", "question": "Could I use sigaddset() instead of passing a signum into sigaction()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the members of ps_set?", "question": "What are the members of ps_set?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does PS_ISSET() do?", "question": "What does PS_ISSET() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Difference between PS_ZERO and PS_CLEAR?", "question": "Difference between PS_ZERO and PS_CLEAR?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Difference between PS_ZERO and PS_CLR?", "question": "Difference between PS_ZERO and PS_CLR?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does expr do in shell programming?", "question": "What does expr do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: ` ` in shell programming", "question": "` ` in shell programming", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use ` instead of expr in shell programming?", "question": "Could I use ` instead of expr in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does shebang do?", "question": "What does shebang do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does an intepreter do in shell programming?", "question": "What does an intepreter do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does grep do in shell programming?", "question": "What does grep do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does test in shell programming used for checking for conditional if?", "question": "Does test in shell programming used for checking for conditional if?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could test replace expr in shell programming?", "question": "Could test replace expr in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does match of expr do in shell programming?", "question": "What does match of expr do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does bind() do in socket programming?", "question": "What does bind() do in socket programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is the socket file descriptor remaining consistent throughout multiple calls of bind() with the given socket()?", "question": "Is the socket file descriptor remaining consistent throughout multiple calls of bind() with the given socket()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does the socket file descriptor outputted by socket() contain?", "question": "What does the socket file descriptor outputted by socket() contain?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does it mean when saying socket file descriptor is the same as file descriptor?", "question": "What does it mean when saying socket file descriptor is the same as file descriptor?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why the socket file descriptor given by socket() must be reused for subsequent bind() calls?", "question": "Why the socket file descriptor given by socket() must be reused for subsequent bind() calls?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does any socket file descriptor have to have the port of the server?", "question": "Does any socket file descriptor have to have the port of the server?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: = vs. \\eq in shell programming?", "question": "= vs. \\eq in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does == exist in shell programming?", "question": "Does == exist in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to compare two different integers in shell programming besides \\eq?", "question": "How to compare two different integers in shell programming besides \\eq?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check two integers are equal besides \\eq in shell programming?", "question": "How to check two integers are equal besides \\eq in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does test always require two operands?", "question": "Does test always require two operands?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why does ambiguous redirect output in shell programming?", "question": "Why does ambiguous redirect output in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does ls | wc do in shell programming?", "question": "What does ls | wc do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What counts as a line in wc in shell programming?", "question": "What counts as a line in wc in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: f | Code context (simplify for kids): #!/ bin / bash for arg in \"$@\" do #If you want the shared version / u / csc209h / winter / pub / shell - prog / fibonacci \"$arg\" done", "question": "f", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: When does waitpid() immediately return?", "question": "When does waitpid() immediately return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it true that connect() can be blocked when the listen queue is full?", "question": "Is it true that connect() can be blocked when the listen queue is full?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When does fseek() return -1?", "question": "When does fseek() return -1?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does fseek() do?", "question": "What does fseek() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to copy a struct?", "question": "How to copy a struct?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How does fwrite() work?", "question": "How does fwrite() work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the parameters of fread()?", "question": "What are the parameters of fread()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the flags of wc in shell programming?", "question": "What are the flags of wc in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does pipe do in the code? | Code context (simplify for kids): ../ my_prog | wc - l > outputfile", "question": "What does pipe do in the code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why are there two dots at the beginning? | Code context (simplify for kids): ../ my_prog | wc - l > outputfile", "question": "Why are there two dots at the beginning?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What are the parameters of fread()?", "question": "What are the parameters of fread()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When piping is needed in shell programming?", "question": "When piping is needed in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to use (()) in shell programming?", "question": "When to use (()) in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I use (()) instead of expr in shell programming?", "question": "Can I use (()) instead of expr in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does (()) work on string operator?", "question": "Does (()) work on string operator?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it good to leave an extra space for null terminator when mallocing a char ptr?", "question": "Is it good to leave an extra space for null terminator when mallocing a char ptr?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to use htons()?", "question": "When to use htons()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is a string literal always null terminated?", "question": "Is a string literal always null terminated?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are all memory blocks in heap initialized to \\0 at first?", "question": "Are all memory blocks in heap initialized to \\0 at first?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the parameters of fscanf()?", "question": "What are the parameters of fscanf()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Parameters of strtol()?", "question": "Parameters of strtol()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you give usage of fprintf()?", "question": "Can you give usage of fprintf()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use strlen on newly created array?", "question": "Could I use strlen on newly created array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why can't I strncpy \\0 into a string?", "question": "Why can't I strncpy \\0 into a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to set null terminator in a char pointer?", "question": "How to set null terminator in a char pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I append null terminator with strncat()?", "question": "Could I append null terminator with strncat()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do I need to append null terminator at the end of a string literal?", "question": "Do I need to append null terminator at the end of a string literal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to make sure every string literal is always null terminated?", "question": "How to make sure every string literal is always null terminated?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do I need to add +1 in strncat()?", "question": "Do I need to add +1 in strncat()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does strncat add null terminators on the leftover indexes of a string?", "question": "Does strncat add null terminators on the leftover indexes of a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does a string after strncat() always be null terminated if there's extra space left at the end?", "question": "Does a string after strncat() always be null terminated if there's extra space left at the end?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does WIFEXITED(status) return?", "question": "What does WIFEXITED(status) return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why does a newly created ptr do not have any initialized value?", "question": "Why does a newly created ptr do not have any initialized value?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does socket() do?", "question": "What does socket() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between socket domain and socket type?", "question": "What is the difference between socket domain and socket type?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it true that a port can only be reserved for one client to talk to their server?", "question": "Is it true that a port can only be reserved for one client to talk to their server?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use dup() or dup2() on closed file fd?", "question": "Could I use dup() or dup2() on closed file fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does while(1); do?", "question": "What does while(1); do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I do kill in shell programming to end one's program activity?", "question": "How do I do kill in shell programming to end one's program activity?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are flags of kill in shell programming?", "question": "What are flags of kill in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does this code do? | Code context (simplify for kids): ./ myprog actual$i.out", "question": "What does this code do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Does waitpid() accept WNOHANG?", "question": "Does waitpid() accept WNOHANG?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is -a in shell programming?", "question": "What is -a in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does ${} do in shell programming?", "question": "What does ${} do in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Would if test 1 get passed into then block in shell programming?", "question": "Would if test 1 get passed into then block in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between \"$parameter\" and \"${parameter}\"?", "question": "What is the difference between \"$parameter\" and \"${parameter}\"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are special characters that I need to put \\ before them in double quote in shell programming?", "question": "What are special characters that I need to put \\ before them in double quote in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use \"${parameter}\" instead of \"$parameter\"?", "question": "Could I use \"${parameter}\" instead of \"$parameter\"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the first line do? | Code context (simplify for kids): for i in *; do echo $i is a file done", "question": "What does the first line do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why there is a semicolon on line 1? | Code context (simplify for kids): for i in *; do echo $i is a file done", "question": "Why there is a semicolon on line 1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to get the current directory in shell programming?", "question": "How to get the current directory in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does : do in a block in shell programming?", "question": "What does : do in a block in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does extern do in header files?", "question": "What does extern do in header files?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I use static variables in header files?", "question": "Could I use static variables in header files?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I compile more than one file with main() inside a makefile?", "question": "Can I compile more than one file with main() inside a makefile?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can I send a signal to a process that is neither a parent nor a child of the current process?", "question": "can I send a signal to a process that is neither a parent nor a child of the current process?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are open descriptors not inherited across an exec() call?", "question": "Are open descriptors not inherited across an exec() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are memory addresses not inherited across an exec() call?", "question": "Are memory addresses not inherited across an exec() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Could I dereference out-of-bound index?", "question": "Could I dereference out-of-bound index?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check if a binary representation is a negative number?", "question": "How to check if a binary representation is a negative number?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Where is the sign bit in binary representation?", "question": "Where is the sign bit in binary representation?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to copy an array of characters?", "question": "How to copy an array of characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: redir in shell programming?", "question": "redir in shell programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When to update max_fd in socket programming?", "question": "When to update max_fd in socket programming?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What happens if I initialized the members of a struct with values in a wrong way?", "question": "What happens if I initialized the members of a struct with values in a wrong way?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Name the three (3) categories that most preprocessing directives fall into", "question": "Name the three (3) categories that most preprocessing directives fall into", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the three categories most of C preprocessors are categorized as?", "question": "What are the three categories most of C preprocessors are categorized as?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the point of calling fclose() when program will end anyway?", "question": "What is the point of calling fclose() when program will end anyway?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are 2 similarities between pipes and files?", "question": "What are 2 similarities between pipes and files?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I initialize an array of char?", "question": "How do I initialize an array of char?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to identify if a process is a zombie?", "question": "How to identify if a process is a zombie?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does ps aux do?", "question": "What does ps aux do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How does ps differ from ps aux?", "question": "How does ps differ from ps aux?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are System calls C programs' interface to the operating system and the computer’s hardware?", "question": "Are System calls C programs' interface to the operating system and the computer’s hardware?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it true that a server may read and write to multiple clients on the same socket?", "question": "Is it true that a server may read and write to multiple clients on the same socket?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it true that Makefile will exit with an error if the target of a rule is not a file?", "question": "Is it true that Makefile will exit with an error if the target of a rule is not a file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are all dependencies in a Makefile files?", "question": "Are all dependencies in a Makefile files?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: phone should save the first 11 char from the input, which is followed by a number | Code context (simplify for kids): char phone[11]; int num; scanf(\"%s%d\", phone, num);", "question": "", "intention": "phone should save the first 11 char from the input, which is followed by a number", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int length = 0; int num = 298475 for (int i = 10; i > 10; i*10) { num -= (num % i); length ++ }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int c = 1; int a = c;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int x = 123; if (x / 10 == 12){ printf(\"yay\"); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int x = 128; if (x / 10 == 12){ printf(\"yay\"); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: count the number of digits in copy | Code context (simplify for kids): int copy = 123456789; int length = 1; for (int i = 10; copy > 10; i * 10){ copy -= copy % i; // turning every digit to 0 length += 1; }", "question": "", "intention": "count the number of digits in copy", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): printf(\"check: %d \\n\", sin % (10^1));", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): printf(\"check: %d \\n\", 123456789 % (10^1));", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int sin = 123456789; for (int i = 0; i < 9; i ++) { printf(\"sin: %d \\n\", sin); int digit = (sin % (10^(1+i))); printf(\"digit: %d \\n\", digit); sin -= digit * 10^i; sin_array[8 - i] = digit // dividing by 10 drops the decimals printf(\"array: %d \\n\", sin_array[8 - i]); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int sin = 123456789; for (int i = 0; i < 9; i ++) { printf(\"sin: %d \\n\", sin); int digit = (sin % (10^(1+i))); printf(\"digit: %d \\n\", digit); sin -= digit * 10^i; sin_array[8 - i] = digit; // dividing by 10 drops the decimals printf(\"array: %d \\n\", sin_array[8 - i]); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: should take each digit in sin and place it in sin_array at the corresponding index | Code context (simplify for kids): #include #include int main() { int sin = 123456789; int sin_array[9]; int digit; for (int i = 0; i < 9; i ++) { digit = sin % (10^(1+i)); printf(\"digit: %d \\n\", digit); sin -= digit * 10^i; sin = sin / 10; sin_array[8 - i] = digit; } }", "question": "", "intention": "should take each digit in sin and place it in sin_array at the corresponding index", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: if length of the string is greater than the amount given, then truncate the string to be of length amount and return the number of chars removed | Code context (simplify for kids): if (strlen(str) > amount) { // truncate str at amount characters str[amount] = '\\0'; return (strlen(str) - amount); } return 0;", "question": "", "intention": "if length of the string is greater than the amount given, then truncate the string to be of length amount and return the number of chars removed", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: save length of an array called friends that's saved in struct called current | Code context (simplify for kids): struct *current; int length = sizeof(*(current->friends))/sizeof(*(current->friends)[0]);", "question": "", "intention": "save length of an array called friends that's saved in struct called current", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? | Code context (simplify for kids): #include int main() { #ifdef MACRO printf(\"%d\\n\", MACRO); #endif return 0; }", "question": "What is the line to compile it into an executable named a.out that it will print the value 5 to stdout?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: in the program. What will this declaration line become after the program has passed through the C pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; char name[MAXNAME];", "question": "in the program. What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does the third line make w[1] = \"ello\"? | Code context (simplify for kids): char **w = malloc(2 * sizeof(char *)); w[0] = \"hello\"; *(w + 1) = w[0] + 1; printf(\"%s, %s\", w[0], w[1]);", "question": "why does the third line make w[1] = \"ello\"?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can you tell the difference between compiling and run time error", "question": "how can you tell the difference between compiling and run time error", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *names[2];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: which takes precedence, * or [2] | Code context (simplify for kids): char *names[2];", "question": "which takes precedence, * or [2]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: fscanf vs fread?", "question": "fscanf vs fread?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this run time or compiling error | Code context (simplify for kids): char *film = \"Moonlight\"; \u0003 NO ERROR char x; x = film; \u0003 RUN-TIME ERROR x[0] = ’L’;", "question": "is this run time or compiling error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this run time or compiling error | Code context (simplify for kids): char *film = \"Moonlight\"; char x; x = film; x[0] = ’L’;", "question": "is this run time or compiling error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is this a run time error | Code context (simplify for kids): int *mkpoint(int x, int y) { int pt[2] = {x, y}; return pt; } int *x; x = mkpoint(3, 4);", "question": "why is this a run time error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do we make sure the new children don't create additional processes | Code context (simplify for kids): for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(), getpid(), i); }", "question": "how do we make sure the new children don't create additional processes", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do we make sure that when process only creates one child and control the total number of processes | Code context (simplify for kids): for (int i = 0; i < iterations; i++) { if (created == 0){ int created = fork(); if (created < 0) { perror(\"fork\"); exit(1); } else if (created > 0) { wait(&waitstatus); } } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(), getpid(), i); }", "question": "how do we make sure that when process only creates one child and control the total number of processes", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does the parent process fork 2 processes? | Code context (simplify for kids): int main() { int iterations = 2; int created = 0; int n = 0; for (int i = 0; i < iterations; i++) { if (created == 0){ int created = fork(); if (created < 0) { perror(\"fork\"); exit(1); } else if(created > 0) { wait(&n); } } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(), getpid(), i); } return 0;", "question": "why does the parent process fork 2 processes?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does the parent process fork 2 processes when created changes to a non 0 value | Code context (simplify for kids): int main() { int iterations = 2; int created = 0; int n = 0; for (int i = 0; i < iterations; i++) { if (created == 0){ int created = fork(); if (created < 0) { perror(\"fork\"); exit(1); } else if(created > 0) { wait(&n); } } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(), getpid(), i); } return 0;", "question": "why does the parent process fork 2 processes when created changes to a non 0 value", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is it the validate file asks for input from stdin in the form: \\n \\n but this code asks for input in the form: \\n \\n \\n \\n \\n? How do I fix this? | Code context (simplify for kids): #include #include #include #include // NOTE: MAX_PASSWORD must be less than MAXLINE/2 #define MAXLINE 32 #define MAX_PASSWORD 10 #define PASSWORD_FILE \"pass.txt\" /* Reads two chunks from stdin, and checks if they match a user id * and password pair from a p", "question": "why is it the validate file asks for input from stdin in the form: \\n \\n but this code asks for input in the form: \\n \\n \\n \\n \\n? How do I fix this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would this print | Code context (simplify for kids): int main() { char *str; strncat(str, \"hello\", 3); printf(\"%s\\n\", str); return 0; }", "question": "what would this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would this print | Code context (simplify for kids): int main() { char *str; strncpy(str, \"hello\", 3); printf(\"%s\\n\", str); return 0; }", "question": "what would this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to use strtok()", "question": "how to use strtok()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is the tab ('\\t') included in the first token? If so, how do I get rid of it? | Code context (simplify for kids): int main () { char str[100] = \"\\tgcc -Wall -g -std=gnu99 -c shit.c\"; const char s[2] = \" \"; char *token; /* get the first token */ token = strtok(str, s); /* walk through other tokens */ while(token != NULL ) { printf( \"\\n%s\", token ); token = strtok(NULL, s); } return(0); }", "question": "is the tab ('\\t') included in the first token? If so, how do I get rid of it?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if you tokenize a str, what is strlen(token)?", "question": "if you tokenize a str, what is strlen(token)?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how to get number of tokens from strtok", "question": "", "intention": "", "task_description": "how to get number of tokens from strtok", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does this give me the str removing '\\t'? | Code context (simplify for kids): strchr(tokens, '\\t') + 1;", "question": "does this give me the str removing '\\t'?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if you have array = char[][], what does strlen(array) give you", "question": "if you have array = char[][], what does strlen(array) give you", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: If you have double array = char[x][y], how do you find the x number? | Code context (simplify for kids): strchr(tokens, '\\t') + 1;", "question": "If you have double array = char[x][y], how do you find the x number?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: If you have double array = char[x][y], how do you find the x number?", "question": "If you have double array = char[x][y], how do you find the x number?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: c how to print 2d array when you dont know the dimensions", "question": "", "intention": "", "task_description": "c how to print 2d array when you dont know the dimensions", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how do I while loop through a 2d char array to print each word in the array", "question": "", "intention": "", "task_description": "how do I while loop through a 2d char array to print each word in the array", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how do I assign space for 2d array using malloc", "question": "", "intention": "", "task_description": "how do I assign space for 2d array using malloc", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why does the *char give error | Code context (simplify for kids): char **args = malloc(sizeof(*char) * len);", "question": "why does the *char give error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this give error and how do I fix it? | Code context (simplify for kids): fread(line, MAXLINE, sizeof(char), fp); while (line != EOF) {", "question": "why does this give error and how do I fix it?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this line of code give error | Code context (simplify for kids): char *tokens = strtok(rest_of_line, ' ');", "question": "why does this line of code give error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this give error | Code context (simplify for kids): char *line; fgets(line, MAXLINE, fp);", "question": "why does this give error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to run gdb for a file that doesn't have a main function? And how do I use gdb with input files (the code I want to debug needs an input file)?", "question": "how to run gdb for a file that doesn't have a main function? And how do I use gdb with input files (the code I want to debug needs an input file)?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: wen I use gdb: \"gdb pmake.c < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\".", "question": "wen I use gdb: \"gdb pmake.c < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\".", "question": "when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\". pmake has already been compiled by gcc", "question": "when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\". pmake has already been compiled by gcc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\". pmake has already been compiled by gcc -g", "question": "when I use gdb: \"gdb pmake < handout_example/handout.mk\" I get there error: \"not in executable format: file format not recognized\". pmake has already been compiled by gcc -g", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: should strncpy's last argument be strlen(token) or strlen(token) + 1 if strlen(token) = number of letters I want to copy (not include null terminator) | Code context (simplify for kids): char **args = mallo(sizeof(char *) * len); for (int i = 0; i < len; i++) { args[i] = malloc(sizeof(char) * strlen(token) + 1); strncpy(args[i], token, strlen(token)); }", "question": "should strncpy's last argument be strlen(token) or strlen(token) + 1 if strlen(token) = number of letters I want to copy (not include null terminator)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I check if 2 chars are equal (I want to check if the first char in a string is a tab)", "question": "how do I check if 2 chars are equal (I want to check if the first char in a string is a tab)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Assume all function calls from nonstandard c libraries are helpers that work perfectly. This program is meant to create Node structures to organize make files. There's a function that prints the structure in a format to mimic a make file on standard output. But when I call on the corresponding print function in my terminal, it just keeps asking for input and I can't exit out (I have to kill termin | Code context (simplify for kids): Rule *parse_file(FILE *fp) { Rule *target_cur; Rule *target_head = NULL; Rule *other_head = NULL; char line[MAXLINE]; fgets(line, MAXLINE, fp); while (line != NULL) { if (is_comment_or_empty(line) == 1) { // line is empty or is a comment } else if (strchr(line, ':') != NULL) { // line contains start", "question": "Assume all function calls from nonstandard c libraries are helpers that work perfectly. This program is meant to create Node structures to organize make files. There's a function that prints the structure in a format to mimic a make file on standard output. But when I call on the corresponding print function in my terminal, it just keeps asking for input and I can't exit out (I have to kill termin", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when I call strtok twice in a row on the same line, it gives me segmentation fault the second time around. How to I mitigate this so I can call strtok again?", "question": "when I call strtok twice in a row on the same line, it gives me segmentation fault the second time around. How to I mitigate this so I can call strtok again?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: the first print statement prints but the following print statements don't instead, the terminal screen goes blank. What causes this error? | Code context (simplify for kids): if (strncmp(line, \"\\t\", sizeof(char)) == 0) { printf(\"enter into action line \\n\"); // line starts with tab, AKA contains actions (should mitigate the \\r\\n issues, I had 'else' before) char *copy = strdup(line); char *tokens = strtok(copy, \" \"); int len = 0; while (tokens != NULL) { printf(\"token: %s", "question": "the first print statement prints but the following print statements don't instead, the terminal screen goes blank. What causes this error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what function can I use to count the number of tokens there are after calling strtok", "question": "what function can I use to count the number of tokens there are after calling strtok", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there a function that returns the number occurences of a char within a string?", "question": "is there a function that returns the number occurences of a char within a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I run a file with terminal command: ./pmake -f handout.mk -o, where -f and -o are defined in pmake.c, handout.mk is a file in the same folder, and pmake is compiled from pmake.c How do I run gdb to test this exact input?", "question": "I run a file with terminal command: ./pmake -f handout.mk -o, where -f and -o are defined in pmake.c, handout.mk is a file in the same folder, and pmake is compiled from pmake.c How do I run gdb to test this exact input?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: im running gdb and when I write display where variable is a string from a file, gdb displays it in binary. Is there a way to have gdb display the variable in human readable text?", "question": "im running gdb and when I write display where variable is a string from a file, gdb displays it in binary. Is there a way to have gdb display the variable in human readable text?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: in gdb, how do I go back a line?", "question": "in gdb, how do I go back a line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: I'm trying to remove the rest of the string line starting from '\\r', but this gives me warnings when I compile. Why, and how do I fix this? | Code context (simplify for kids): char *ptr = strchr(line, '\\r'); ptr = '\\0';", "question": "I'm trying to remove the rest of the string line starting from '\\r', but this gives me warnings when I compile. Why, and how do I fix this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when I run the code this is the warning that pops up in gcc warning: null argument where non-null required (argument 2) [-Wnonnull] 206 | strcpy(ptr, '\\0'); what does it mean and how do i fix this? | Code context (simplify for kids): char *ptr = strchr(line, '\\r'); strcpy(ptr, '\\0');", "question": "when I run the code this is the warning that pops up in gcc warning: null argument where non-null required (argument 2) [-Wnonnull] 206 | strcpy(ptr, '\\0'); what does it mean and how do i fix this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why doesn't this code print \"outside 7\" to standard error? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); // POSITION A struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); // POSITION B x += 2; // POSITION C fprintf", "question": "why doesn't this code print \"outside 7\" to standard error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I remove whitespace from a string", "question": "how do I remove whitespace from a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I remove whitespace from a string without strtok", "question": "how do I remove whitespace from a string without strtok", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use struct stat to compare the last modified times of two files", "question": "how to use struct stat to compare the last modified times of two files", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: the code is meant to execute rules from a make file in parallel by having the parent create a child for each dependency. When compiled, the perror on line 29 runs. Why, and how do I fix this? | Code context (simplify for kids): void parallel_eval(Rule *rule) { Dependency *dep_cur = rule->dependencies; int parentPID = getpid(); while (dep_cur != NULL) { // create a child proccess for each dependency if (parentPID == getpid()) { // parent int n = fork(); if (n < 0) { perror(\"Error: forking\\n\"); exit(1); } if (n == 0) { // ch", "question": "the code is meant to execute rules from a make file in parallel by having the parent create a child for each dependency. When compiled, the perror on line 29 runs. Why, and how do I fix this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: I tried logging in to a linux server and this error popped up on the terminal : PTY allocation request failed on channel 0. Any idea what caused this?", "question": "I tried logging in to a linux server and this error popped up on the terminal : PTY allocation request failed on channel 0. Any idea what caused this?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: if the file that rule refers to has never been compiled, what does this function return? | Code context (simplify for kids): int compare_time(Rule *rule) { struct stat target_stat; Dependency *dep_cur = rule->dependencies; if (stat(rule->target, &target_stat) < 0) { // target file was never executed, so need to run actions return 1; } return 0; }", "question": "if the file that rule refers to has never been compiled, what does this function return?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: assume the file that rule refers to has never been compiled. But the function keeps returning 1 when I run it. What could be causing the problem? | Code context (simplify for kids): int compare_time(Rule *rule) { struct stat target_stat; Dependency *dep_cur = rule->dependencies; if (stat(rule->target, &target_stat) < 0) { // target file was never executed, so need to run actions return 1; } while (dep_cur != NULL) { struct stat check_stat; stat(dep_cur->rule->target, &check_sta", "question": "assume the file that rule refers to has never been compiled. But the function keeps returning 1 when I run it. What could be causing the problem?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Question: assume the file that rule refers to has never been compiled. But the function keeps returning 0 when I run it. What could be causing the problem? | Code context (simplify for kids): int compare_time(Rule *rule) { struct stat target_stat; Dependency *dep_cur = rule->dependencies; if (stat(rule->target, &target_stat) < 0) { // target file was never executed, so need to run actions return 1; } while (dep_cur != NULL) { struct stat check_stat; stat(dep_cur->rule->target, &check_sta", "question": "Question: assume the file that rule refers to has never been compiled. But the function keeps returning 0 when I run it. What could be causing the problem?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why do I get this error: think the intro and conclusion of the internal validity section can be combined into the first and last examples. ? | Code context (simplify for kids): struct sigaction action; action.sa_handler = handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; sigaction(SIGPROF, &action, NULL);", "question": "Why do I get this error: think the intro and conclusion of the internal validity section can be combined into the first and last examples. ?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why do I get this error: \"incomplete type is not allowed\" for the variable \"action\"? | Code context (simplify for kids): struct sigaction action; action.sa_handler = handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; sigaction(SIGPROF, &action, NULL);", "question": "Why do I get this error: \"incomplete type is not allowed\" for the variable \"action\"?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Variable x has been assigned a digit between 1 and 10. Write a shell command to calculate x minus 1 and display the result to standard output.", "question": "", "intention": "", "task_description": "Variable x has been assigned a digit between 1 and 10. Write a shell command to calculate x minus 1 and display the result to standard output.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Variable x has been assigned a digit between 1 and 10. How do I write a shell command to calculate x minus 1 and display the result to standard output.", "question": "Variable x has been assigned a digit between 1 and 10. How do I write a shell command to calculate x minus 1 and display the result to standard output.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Variable x has been assigned a digit between 1 and 10. Write a sh shell command to calculate x minus 1 and display the result to standard output.", "question": "Variable x has been assigned a digit between 1 and 10. Write a sh shell command to calculate x minus 1 and display the result to standard output.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Variable x has been assigned a digit between 1 and 10. Write an sh shell command to calculate x minus 1 and display the result to standard output.", "question": "", "intention": "", "task_description": "Variable x has been assigned a digit between 1 and 10. Write an sh shell command to calculate x minus 1 and display the result to standard output.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I'm trying to use expr in shell command but when I use * for multiplication, I get an error. What's the problem?", "question": "I'm trying to use expr in shell command but when I use * for multiplication, I get an error. What's the problem?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if i call read(fd, &buf, BUF_SIZE); does read concatonate onto buf or does it overwrite buf?", "question": "if i call read(fd, &buf, BUF_SIZE); does read concatonate onto buf or does it overwrite buf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: should malloc be assigned sizeof(char) * num_read or sizeof(char) * (1 + num_read) ? | Code context (simplify for kids): int num_read = read(fd, &buf, BUF_SIZE); buf[num_read] = '\\0'; users[client_index].username = malloc(sizeof(char) * num_read);", "question": "should malloc be assigned sizeof(char) * num_read or sizeof(char) * (1 + num_read) ?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: after using malloc, do I have to explicitly set the name[strlen(username)] = '\\0' ? | Code context (simplify for kids): char *name = malloc(sizeof(char) * (strlen(username) + 1)); strncpy(client->username, name, strlen(name));", "question": "after using malloc, do I have to explicitly set the name[strlen(username)] = '\\0' ?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: the code is supposed to create a string name from the contents of username and allocate memory in the heap. However, when I run the code through gdb, name = \"\". What is causing this error? | Code context (simplify for kids): char *name = malloc(sizeof(char) * (strlen(username) + 1)); name[strlen(username)] = '\\0'; strncpy(client->username, name, strlen(name) + 1);", "question": "the code is supposed to create a string name from the contents of username and allocate memory in the heap. However, when I run the code through gdb, name = \"\". What is causing this error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: the code is supposed to create a string name from the contents of username and allocate memory in the heap. However, when I run the code through gdb, name = \"\". What is causing this error? | Code context (simplify for kids): char *name = malloc(sizeof(char) * (strlen(username) + 1)); name[strlen(username)] = '\\0';", "question": "the code is supposed to create a string name from the contents of username and allocate memory in the heap. However, when I run the code through gdb, name = \"\". What is causing this error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I want to save the contents of username in the heap using malloc. is this correct? | Code context (simplify for kids): client->username = malloc(sizeof(char) * (strlen(username) + 1)); client->username[strlen(username)] = '\\0'; strncpy(client->username, username, strlen(name) + 1);", "question": "I want to save the contents of username in the heap using malloc. is this correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I want to save the contents of username in the heap using malloc. is this correct? | Code context (simplify for kids): client->username = malloc(sizeof(char) * (strlen(username) + 1)); client->username[strlen(username)] = '\\0'; strncpy(client->username, username, strlen(username) + 1);", "question": "I want to save the contents of username in the heap using malloc. is this correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: the code is supposed to take a string and tokenize it such that if the input string = \"hello world here I am\", cmd_argv[0] = \"hello\" cmd_argv[1] = \"world\" cmd_argv[2] = \"here I am\" and if input string = \"hello world\" cmd_argv[0] = \"hello\" cmd_argv[1] = \"world\" cmd_argv[2] = NULL but for the second example, I still get 3 values. What is the error? | Code context (simplify for kids): int cmd_argc = 0; char *next_token = strtok(cmd, DELIM); while (next_token != NULL && cmd_argc < 3) { cmd_argv[cmd_argc] = next_token; cmd_argc++; if (cmd_argc == 2) { char *rest = strtok(NULL, \"\"); cmd_argv[cmd_argc - 1] = strndup(cmd_argv[cmd_argc - 1], rest - cmd_argv[cmd_argc - 1] - 1); // ??? c", "question": "the code is supposed to take a string and tokenize it such that if the input string = \"hello world here I am\", cmd_argv[0] = \"hello\" cmd_argv[1] = \"world\" cmd_argv[2] = \"here I am\" and if input string = \"hello world\" cmd_argv[0] = \"hello\" cmd_argv[1] = \"world\" cmd_argv[2] = NULL but for the second example, I still get 3 values. What is the error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if I write \"print var\" and gdb outputs \"0x0\", is that the equivalent to var = NULL?", "question": "if I write \"print var\" and gdb outputs \"0x0\", is that the equivalent to var = NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this code give me a buffer overflow error? | Code context (simplify for kids): int len = 1; const User *current = curr; while (current != NULL) { len += strlen(current->name) + 2; current = current->next; } char *buf = malloc(sizeof(char) * len); int index = 0; int add = 0; while (curr != NULL) { add = snprintf(buf + index, len - index, \"%s\\r\\n\", curr->name); if (add >= len - ", "question": "why does this code give me a buffer overflow error?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: if the date is jan. 1, 2021, what is the value of len? | Code context (simplify for kids): int len = strlen(asctime(localtime(post->date)))", "question": "if the date is jan. 1, 2021, what is the value of len?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: The file /u/ajr/t contains zero or more integers, one per line. Write shell command to output the sum of all of these integers plus 10. (For example, if the file is empty, the output would be 10, or if it contains ‘‘2\\n3\\n’’ the output would be 15.)", "question": "", "intention": "", "task_description": "The file /u/ajr/t contains zero or more integers, one per line. Write shell command to output the sum of all of these integers plus 10. (For example, if the file is empty, the output would be 10, or if it contains ‘‘2\\n3\\n’’ the output would be 15.)", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: traverse a linked list of User objects and print each User's name and a new line | Code context (simplify for kids): void list_users(const User *curr) { // traverse the linked list and print each name using printf User *node = curr; while (node != NULL) { printf(\"%s\\n\", node->name); node = node->next; } }", "question": "", "intention": "traverse a linked list of User objects and print each User's name and a new line", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: traverse a linked list of User objects and print each User's name and a new line | Code context (simplify for kids): void list_users(const User *curr) { // traverse the linked list and print each name using printf const User *node = curr; while (node != NULL) { printf(\"%s\\n\", node->name); node = node->next; } }", "question": "", "intention": "traverse a linked list of User objects and print each User's name and a new line", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print an integer | Code context (simplify for kids): int i = 3; printf(i);", "question": "", "intention": "print an integer", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: add action_pt to the end of the actions list of the current rule | Code context (simplify for kids): Action *last_act = curr_rule->actions; while (last_act->next_act != NULL) { last_act = last_act->next_act; } last_act->next_act = action_pt;", "question": "add action_pt to the end of the actions list of the current rule", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: determine if a file exists | Code context (simplify for kids): int file_exists(char *filename) { FILE *f = fopen(filename, \"r\"); if (f != NULL) { fclose(f); return 1; } return 0; }", "question": "determine if a file exists", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How does malloc work?", "question": "How does malloc work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Prints: January February March Jan Feb Mar | Code context (simplify for kids): char **build_month_list() { char jan[] = \"Januray\"; char feb[] = \"February\"; char mar[] = \"March\"; char **array = malloc(sizeof(jan) * 3); array[0] = jan; array[1] = feb; array[2] = mar; return array; } int main() { // For part 3: Once you've implemented build_month_list, uncomment this code. char *", "question": "", "intention": "Prints: January February March Jan Feb Mar", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what kind of question do i ask you", "question": "what kind of question do i ask you", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialize a string in c", "question": "how to initialize a string in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what type is result[0] in chat *result[2];", "question": "what type is result[0] in chat *result[2];", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i initialize a pointer to a struct", "question": "how can i initialize a pointer to a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *); // testing to see if edits are working //jan 26 int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAG", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: process command line arguments", "question": "", "intention": "", "task_description": "process command line arguments", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: extract each digit of an integer", "question": "", "intention": "", "task_description": "extract each digit of an integer", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to define a string literal", "question": "how to define a string literal", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): // TODO: Implement populate_array /* * Convert a 9 digit int to a 9 element int array. */ int populate_array(int sin, int *sin_array) { int digits = 0; int num = sin; while(num != 0){ num = num / 10; digits += 1; } if(digits != 9){ return 1; } int position = 0; while(sin != 0){ sin_array[position] =", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): // TODO: Implement populate_array /* * Convert a 9 digit int to a 9 element int array. */ int populate_array(int sin, int *sin_array) { int digits = 0; int position = 0; while(sin != 0){ sin_array[position] = sin % 10; digits += 1; position += 1; sin = sin / 10; } if (digits != 9){ return 1; } else{", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int populate_array(int sin, int *sin_array) { int digits = 0; int position = 0; while(sin != 0){ sin_array[position] = sin % 10; digits += 1; position += 1; sin = sin / 10; } if (digits != 9){ return 1; } else{ return 0; } } int check_sin(int *sin_array) { int sin_total = 0; for (int position = 0; p", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I check if an element of a character array is 'a', 'b', or 'c'", "question": "how do I check if an element of a character array is 'a', 'b', or 'c'", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this the right way to check if characters match | Code context (simplify for kids): if(required[i] == 'r' || required[i] == 'w' || required[i] == 'x'){ if (required[i] != permissions_field[i]){ return 1; } }", "question": "is this the right way to check if characters match", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this checking the memory addresses | Code context (simplify for kids): if(required[i] == 'r' || required[i] == 'w' || required[i] == 'x'){ if (required[i] != permissions_field[i]){ return 1; } }", "question": "is this checking the memory addresses", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what operators are being used in the if statements | Code context (simplify for kids): if(required[i] == 'r' || required[i] == 'w' || required[i] == 'x'){ if (required[i] != permissions_field[i]){ return 1; } }", "question": "what operators are being used in the if statements", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: take two 9-element character arrays as arguments and returns an integer. (The prototype for this function is in the starter code.) The first array will represent the permission field of a file and the second will represent the permissions that are required. The function will return 0 if the file has all the required permissions and 1 otherwise. The arrays do not have to be identical for a 0 to be returned. For example, if the first array holds the characters rwxr-x--- and the second array holds ", "question": "", "intention": "", "task_description": "take two 9-element character arrays as arguments and returns an integer. (The prototype for this function is in the starter code.) The first array will represent the permission field of a file and the second will represent the permissions that are required. The function will return 0 if the file has all the required permissions and 1 otherwise. The arrays do not have to be identical for a 0 to be returned. For example, if the first array holds the characters rwxr-x--- and the second array holds ", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): if(required[i] == 'r' || required[i] == 'w' || required[i] == 'x'){ if (required[i] != permissions_field[i]){ return 1; } } // TODO: Implement a helper named check_permissions that matches the prototype below. //int check_permissions(char *, char *); int check_permissions(char *permissions_field, ch", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: // TODO: Process command line arguments. // TODO: Call check_permissions as part of your solution to count the files to // compute and print the correct value. //check to make sure it's a regular file and not directory //check size // check permisions (or vice versa)", "question": "", "intention": "", "task_description": "// TODO: Process command line arguments. // TODO: Call check_permissions as part of your solution to count the files to // compute and print the correct value. //check to make sure it's a regular file and not directory //check size // check permisions (or vice versa)", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Process command line arguments. Call check_permissions as part of your solution to count the files to compute and print the correct value.", "question": "", "intention": "", "task_description": "Process command line arguments. Call check_permissions as part of your solution to count the files to compute and print the correct value.", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: assign the variable p to be the permissions of the ls-l output", "question": "", "intention": "", "task_description": "assign the variable p to be the permissions of the ls-l output", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I add together the two digits of an integer", "question": "how do I add together the two digits of an integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): /* * Convert a 9 digit int to a 9 element int array. */ int populate_array(int sin, int *sin_array) { int position = 8; while(sin != 0){ sin_array[position] = sin % 10; sin = sin / 10; position -= 1; } return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: turn 9 digit integer into 9 digit array, in same order. return 1 if the integer is less than 100000000 | Code context (simplify for kids): /* * Convert a 9 digit int to a 9 element int array. */ int populate_array(int sin, int *sin_array) { int position = 8; while(sin != 0){ sin_array[position] = sin % 10; sin = sin / 10; position -= 1; } return 0; }", "question": "", "intention": "turn 9 digit integer into 9 digit array, in same order. return 1 if the integer is less than 100000000", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: get the sum of the two digits of an integer between 10 and 20", "question": "", "intention": "", "task_description": "get the sum of the two digits of an integer between 10 and 20", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: if int i is even, add sin_array[I] to sin_total if int i is ODD, add the digits of sin_array at the ith position to sin_total | Code context (simplify for kids): int check_sin(int *sin_array) { int sin_total = 0; for(int i = 8; i>=0; i--){ if(i % 2 == 0){ sin_total += sin_array[i]; } else{ if(sin_array[i] < 5){ sin_total += (sin_array[i] * 2); } else{ int temp1 = sin_array[i] % 2; int temp2 = sin_array[i] / 10; int add = temp1 + temp2; sin_total += add; // i", "question": "", "intention": "if int i is even, add sin_array[I] to sin_total if int i is ODD, add the digits of sin_array at the ith position to sin_total", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Write a loop which traverses a linked list starting at front and prints the value of each node in the list. Separate each value with a space.", "question": "", "intention": "", "task_description": "Write a loop which traverses a linked list starting at front and prints the value of each node in the list. Separate each value with a space.", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. */ | Code context (simplify for kids): void list_users(const User *curr) { // start at the curr user User *curr_user = (User *) curr; // keep going through the linked list till the end is reached while(curr_user != NULL){ // THIS LINE BELOW IS A PROBLEM! printf(stdout, \"%s\\n\", curr_user->name); //print_user(curr); curr_user = curr_user->", "question": "", "intention": "/* * Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. */", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: how do I print the contents of a file", "question": "", "intention": "", "task_description": "how do I print the contents of a file", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print the pfp (profile pic) in the beginning of the code. open the file containing it and print its contents. | Code context (simplify for kids): /* * Print a user profile. * For an example of the required output format, see the example output * linked from the handout. * Return: * - 0 on success. * - 1 if the user is NULL. */ int print_user(const User *user) { // check that the user exists User *print_me = (User *) user; if (print_me == NULL", "question": "", "intention": "print the pfp (profile pic) in the beginning of the code. open the file containing it and print its contents.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. */ make sure there are no memory leaks | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // find the user with that username User *delete_me = find_user(name, *user_ptr_del); // if it does not exist, return 1 if (delete_me == NULL){ return 1; } // once established that the user that u wanna delete does indeed exist in the // list ", "question": "", "intention": "/* * From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. */ make sure there are no memory leaks", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: free the posts of this user | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { // find the user with that username User *delete_me = find_user(name, *user_ptr_del); // if it does not exist, return 1 if (delete_me == NULL){ return 1; } // once established that the user that u wanna delete does indeed exist in the // list ", "question": "", "intention": "free the posts of this user", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: start from the first node of a linked list and free every node", "question": "", "intention": "", "task_description": "start from the first node of a linked list and free every node", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: new children should not create additional processes | Code context (simplify for kids): #include #include #include /* * Modify the program so that new children do not create additional processes */ int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); f", "question": "", "intention": "new children should not create additional processes", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): main : linked_list.o main.o gcc - Wall - g - std = gnu99 - o main linked_list.o main .o main.o : main.c linked_list.h gcc - Wall - g - std = gnu99 - c main .c linked_list.o : linked_list.c linked_list.h gcc - Wall - g - std = gnu99 - c linked_list.c #notice that this target has no dependencies clean", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: write code to parse through the makefile and make a linked data structure", "question": "", "intention": "", "task_description": "write code to parse through the makefile and make a linked data structure", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: explain strtok to me", "question": "explain strtok to me", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: turn an action line of a makefile into a char **args", "question": "", "intention": "", "task_description": "turn an action line of a makefile into a char **args", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: assign the args to the new action node", "question": "", "intention": "", "task_description": "assign the args to the new action node", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: write code to turn an action line of a makefile into an array of strings", "question": "", "intention": "", "task_description": "write code to turn an action line of a makefile into an array of strings", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: get the number of actions in an action line of a makefile using strtok", "question": "", "intention": "", "task_description": "get the number of actions in an action line of a makefile using strtok", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what should the parameters of fgets be when reading through the file pointed to by a file pointer", "question": "what should the parameters of fgets be when reading through the file pointed to by a file pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: get the number of actions in the action line of a makefile", "question": "", "intention": "", "task_description": "get the number of actions in the action line of a makefile", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Intended Behavior: get the number of actions in the action line of a makefile without modifying the makefile AT ALL", "question": "", "intention": "", "task_description": "Intended Behavior: get the number of actions in the action line of a makefile without modifying the makefile AT ALL", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does (.text+0x1b): undefined reference to `main' mean", "question": "what does (.text+0x1b): undefined reference to `main' mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What is this code doing? | Code context (simplify for kids): ((var |= 1 <<(flag)))", "question": "What is this code doing?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): ((var) & (1 << (flag)))", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char * (*x) (char *) = my_func;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why (*x)? | Code context (simplify for kids): char * (*x) (char *) = my_func;", "question": "why (*x)?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how does scanf treat white spaces", "question": "how does scanf treat white spaces", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: pointer arithmetic and then taking the address of result | Code context (simplify for kids): &((*argc)+1);", "question": "", "intention": "pointer arithmetic and then taking the address of result", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): &((*argc)+1);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: does pointer arithmetic then takes address of result | Code context (simplify for kids): &((*argv)+1);", "question": "", "intention": "does pointer arithmetic then takes address of result", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does it mean when standard input is closed in c", "question": "what does it mean when standard input is closed in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you close standard input in c", "question": "how do you close standard input in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the function strtok do to the string it is called on", "question": "what does the function strtok do to the string it is called on", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what happens when there is no delimiter in the string strtok is called on", "question": "what happens when there is no delimiter in the string strtok is called on", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you open a file", "question": "How do you open a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are the all the ways to compare strings", "question": "what are the all the ways to compare strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `strcmp` with usage examples and explanations", "question": "generate a detailed documentation of `strcmp` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you add elements to a char array", "question": "how do you add elements to a char array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you add elements to an array", "question": "how do you add elements to an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what library do you need for len()", "question": "what library do you need for len()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you calculate the length of an array", "question": "how do you calculate the length of an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you calculate the number of initialized spots in an array", "question": "how do you calculate the number of initialized spots in an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you find the number of elements in an array", "question": "How do you find the number of elements in an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What are the initial values of the elements in friends | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "What are the initial values of the elements in friends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What are the initial values of the elements in friends. | Code context (simplify for kids): int main() { char *friends[10]; return 0; }", "question": "What are the initial values of the elements in friends.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What are the initial values of the elements in name | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "What are the initial values of the elements in name", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Where are structs stored in memory", "question": "Where are structs stored in memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the initial values of global data", "question": "What are the initial values of global data", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the initial values of heap data", "question": "What are the initial values of heap data", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are the initial values of the data in structs that are defined in header files", "question": "What are the initial values of the data in structs that are defined in header files", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain and generate an example of printing the contents of a text file", "question": "explain and generate an example of printing the contents of a text file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate example code of the fgets function being used on a file", "question": "generate example code of the fgets function being used on a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the keyword that indicates that a word is a legal target but isn't an actual file?", "question": "What is the keyword that indicates that a word is a legal target but isn't an actual file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What is rm -f *.o print_ptree? | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "What is rm -f *.o print_ptree?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is print_ptree? | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "What is print_ptree?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a dependency? | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a dependency?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a variable | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a variable", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a variable | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a variable", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a recipe | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a recipe", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a rule | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a rule", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a prerequisite | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a prerequisite", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is print_ptree a rule, target, dependency, variable, recipe, or prerequisite? | Code context (simplify for kids): FLAGS = -Wall -Werror -std=c99 DEPENDENCIES = ptree.h all: print_ptree print_ptree: print_ptree.o ptree.o gcc ${FLAGS} -o $@ $^ %.o: %.c ${DEPENDENCIES} gcc ${FLAGS} -c $< clean: rm -f *.o print_ptree", "question": "is print_ptree a rule, target, dependency, variable, recipe, or prerequisite?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): typedef void(*SortFunc_t)(int *, int);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the return value of fgets?", "question": "What is the return value of fgets?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain the fread function", "question": "explain the fread function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain the fseek function", "question": "explain the fseek function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between text I/O and binary I/O", "question": "What is the difference between text I/O and binary I/O", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is size_t?", "question": "What is size_t?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does the od command do?", "question": "What does the od command do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): od --address-radix=x --format=c --format=dC ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `--format=dC` with usage examples and explanations", "question": "generate a detailed documentation of `--format=dC` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `--address-radix` with usage examples and explanations", "question": "generate a detailed documentation of `--address-radix` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): objdump --wide --sections ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What are the sections of an object file?", "question": "What are the sections of an object file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): objdump --wide --sections section=.rodata ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): objdump --full-contents section=.rodata ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the size of a long?", "question": "What is the size of a long?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): %#lx", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is wrong with this line of code? | Code context (simplify for kids): fprintf(fp, 'A');", "question": "What is wrong with this line of code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does -lm do?", "question": "what does -lm do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): gcc -Wall -g -std=gnu99 -o test_load_data dectree.o test_load_data.o -lm", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the -lm do here? | Code context (simplify for kids): gcc -Wall -g -std=gnu99 -o test_load_data dectree.o test_load_data.o -lm", "question": "What does the -lm do here?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does .PHONY do?", "question": "what does .PHONY do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Give me an example of a call to the wait function", "question": "Give me an example of a call to the wait function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate example code for error checking with the fork function", "question": "generate example code for error checking with the fork function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: give me an example of a call to the strtok function", "question": "give me an example of a call to the strtok function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: give me an example of calling the execvp function", "question": "give me an example of calling the execvp function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is there a function to trim leading whitespace from a string?", "question": "Is there a function to trim leading whitespace from a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr when it runs without interruption? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr when it runs without interruption?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position A? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program above (from part 1) print to stderr if the user presses Ctrl+C at the moment when the program is at position A?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position B?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is a \"stubbed main file\"?", "question": "what is a \"stubbed main file\"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): PORT = 51345 CFLAGS = DPORT = \\$(PORT) - g - std = gnu99 - Wall - Werror", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does $< do in a makefile", "question": "what does $< do in a makefile", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what do $@ and $^ do in makefiles?", "question": "what do $@ and $^ do in makefiles?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you use -D in the command line?", "question": "How do you use -D in the command line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Give me examples of using -D from the command line.", "question": "", "intention": "", "task_description": "Give me examples of using -D from the command line.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does snprintf add a null terminator?", "question": "does snprintf add a null terminator?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you have the same #include statement in two files that will be linked?", "question": "Can you have the same #include statement in two files that will be linked?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I print cmd_argv[0][5] as a single character instead of an int? | Code context (simplify for kids): printf(\"cmd_argv[0][5]: %d\\n\", cmd_argv[0][5]);", "question": "How do I print cmd_argv[0][5] as a single character instead of an int?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is the digit 108 as a char?", "question": "what is the digit 108 as a char?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the integer representation of the character '\\r'?", "question": "what is the integer representation of the character '\\r'?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will strcmp return in this case? | Code context (simplify for kids): strcmp(\"Grace\\r\", \"Grace\")", "question": "what will strcmp return in this case?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Is it possible for a program to only work as intended when it is run through the gdb debugger?", "question": "Is it possible for a program to only work as intended when it is run through the gdb debugger?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the FD_CLR macro do?", "question": "what does the FD_CLR macro do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you use strncat to safely concatenate two strings?", "question": "How do you use strncat to safely concatenate two strings?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can I use snprintf on initialized memory?", "question": "can I use snprintf on initialized memory?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can I use snprintf on uninitialized memory?", "question": "can I use snprintf on uninitialized memory?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does this Makefile have any redundancies? | Code context (simplify for kids): PORT = 51345 CFLAGS = -DPORT =\\$(PORT) - g - std = gnu99 - Wall - Werror OFLAGS = -g - std = gnu99 - Wall - Werror all : friend_server friend_server : friend_server.o friend_socket.o friends.o partial_io.o clients.o gcc ${CFLAGS} - o $ @$ ^ friend_server.o : friend_server.c friend_socket.h friends.h", "question": "does this Makefile have any redundancies?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can you run strlen() on an integer?", "question": "can you run strlen() on an integer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is / integer division?", "question": "is / integer division?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there a built in function to remove element at specific index of an array", "question": "is there a built in function to remove element at specific index of an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this for loop print new twice | Code context (simplify for kids): char line[31]; int in; char new[9]; for (int i = 1; i < 10; i++) { new[i-1] = line[i]; printf(\"%s\\n\", new); }", "question": "why does this for loop print new twice", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does this for loop print new twice. | Code context (simplify for kids): char line[31]; int in; char new[9]; for (int i = 1; i < 10; i++) { new[i-1] = line[i]; } printf(\"%s\\n\", new);", "question": "why does this for loop print new twice.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code print new twice. For example, output was \"rwx-------rwx------\" but expected output is rwx------- | Code context (simplify for kids): char line[31]; int in; char new[9]; for (int i = 1; i < 10; i++) { new[i-1] = line[i]; } printf(\"%s\\n\", new);", "question": "Why does this code print new twice. For example, output was \"rwx-------rwx------\" but expected output is rwx-------", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: output is rwx-------rwx------, expected output is rwx------- | Code context (simplify for kids): char line[31]; int in; char new[9]; for (int i = 1; i < 10; i++) { new[i-1] = line[i]; } printf(\"%s\\n\", new);", "question": "", "intention": "output is rwx-------rwx------, expected output is rwx-------", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: The string new is not properly terminated with a null character. -> This is fixed by adding \\0 to the end of the string. How would I do that?", "question": "The string new is not properly terminated with a null character. -> This is fixed by adding \\0 to the end of the string. How would I do that?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: EXC_BAD_ACCESS (code=1, address=0x0) in line 5. | Code context (simplify for kids): int main(int argc, char** argv) { char line[11]; int size; int count = 0; int int_size = strtol(argv[1], NULL, 10); char new[10]; if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } else if (argc == 3) { // Skip first line scanf(\"%*s, %*d\"); while", "question": "", "intention": "EXC_BAD_ACCESS (code=1, address=0x0) in line 5.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is there a contains function? like if array contains item boolean", "question": "is there a contains function? like if array contains item boolean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Receive still reachable byts, but i am closing the file how can I fix? | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL) { return 1; } int c; FILE *file; file = fopen(user->profile_pic, \"r\"); if (file != NULL) { while ((c = fgetc(file)) != EOF) printf(\"%c\", c); fclose(file); printf(\"\\nName: %s\\n\", user->name); }else { printf(\"Name: %s\\n\", user->name); } printf(\"----", "question": "Receive still reachable byts, but i am closing the file how can I fix?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: i am receiving 472 still reachable byts in this code even though I'm closing file, why? | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL) { return 1; } int c; FILE *file; file = fopen(user->profile_pic, \"r\"); if (file != NULL) { while ((c = fgetc(file)) != EOF) printf(\"%c\", c); fclose(file); printf(\"\\nName: %s\\n\", user->name); }else { fclose(file); printf(\"Name: %s\\n\", user->name); ", "question": "i am receiving 472 still reachable byts in this code even though I'm closing file, why?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Receiving still reachable byts why? whats a fix | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL) { return 1; } int c; FILE *file; file = fopen(user->profile_pic, \"r\"); if (file != NULL) { while ((c = fgetc(file)) != EOF) printf(\"%c\", c); fclose(file); printf(\"\\nName: %s\\n\", user->name); }else { fclose(file); printf(\"Name: %s\\n\", user->name); ", "question": "Receiving still reachable byts why? whats a fix", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to cast deserialized object without unchecked type error?", "question": "how to cast deserialized object without unchecked type error?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i write a newline without creating new write() | Code context (simplify for kids): write(client->sock_fd, users->name, strlen(users->name)", "question": "how can i write a newline without creating new write()", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a string literal called season that has the value \"winter\". | Code context (simplify for kids): char season[] = 'winter'; char holiday[20] = \"Valentine's Day\";", "question": "", "intention": "Define a string literal called season that has the value \"winter\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a string literal called season that has the value \"winter\". | Code context (simplify for kids): char season[] = \"winter\"; char holiday[20] = \"Valentine's Day\";", "question": "", "intention": "Define a string literal called season that has the value \"winter\".", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: can i compare unsigned long and int", "question": "can i compare unsigned long and int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: return 2 if the string name is longer than the value stored in MAX_NAME | Code context (simplify for kids): //first check if the name is too long if((int)strlen(name) > MAX_NAME){ return 2; }", "question": "", "intention": "return 2 if the string name is longer than the value stored in MAX_NAME", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i use gdb", "question": "how do i use gdb", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i use valgrand", "question": "how do i use valgrand", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: are pointers in functions freed after the function executes", "question": "are pointers in functions freed after the function executes", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: are pointers created in functions freed after the function executes", "question": "are pointers created in functions freed after the function executes", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: are pointers created in function in the heap", "question": "are pointers created in function in the heap", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does fgets work on files that are .ascii in c", "question": "does fgets work on files that are .ascii in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i read the contents of an ascii file and print the contents line by line in c?", "question": "how do i read the contents of an ascii file and print the contents line by line in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the return value when the input stream to scanf is closed?", "question": "What is the return value when the input stream to scanf is closed?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is this a valid syntax else if (0 <= temp <= 9)", "question": "is this a valid syntax else if (0 <= temp <= 9)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is this a valid syntax in C else if (0 <= temp <= 9)", "question": "Is this a valid syntax in C else if (0 <= temp <= 9)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is being compared here? | Code context (simplify for kids): while (scanf(\"%d\", &input) != \"EOF\") {", "question": "what is being compared here?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the return type of scanf | Code context (simplify for kids): while (scanf(\"%d\", &input) != \"EOF\") {", "question": "what is the return type of scanf", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: in C, how to convert int to string", "question": "in C, how to convert int to string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to compare an int with a string", "question": "how to compare an int with a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how would i compare the return value of scanf with a string, without compilation error", "question": "how would i compare the return value of scanf with a string, without compilation error", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What would be an example of how to use scanf", "question": "What would be an example of how to use scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does a c file need a main", "question": "does a c file need a main", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is stdout used for", "question": "what is stdout used for", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to allocate space with malloc", "question": "how to allocate space with malloc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to change a file name in C", "question": "How to change a file name in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `rename` with usage examples and explanations", "question": "generate a detailed documentation of `rename` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `rename(old_name, new_name)` with usage examples and explanations", "question": "generate a detailed documentation of `rename(old_name, new_name)` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check if a file can be opened?", "question": "How to check if a file can be opened?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to iterate through an ascii code.", "question": "How to iterate through an ascii code.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to iterate through an ascii file to print out everything", "question": "How to iterate through an ascii file to print out everything", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to print a time_t?", "question": "how to print a time_t?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to print a blank line?", "question": "how to print a blank line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to make a variable with the current time", "question": "how to make a variable with the current time", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a file exitsts", "question": "how to check if a file exitsts", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a file can be opened", "question": "how to check if a file can be opened", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is curr always null? | Code context (simplify for kids): void list_users(const User *curr) { printf(\"User List\\n\"); while(curr != NULL){ printf(\" %s\\n\", curr->name); curr = curr->next; } }", "question": "Why is curr always null?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: fix segmentation fault | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); User *curr = *user_ptr_del; if(leaver == NULL || curr == NULL){ return 1; } if(curr == leaver){ *user_ptr_del = curr->next; } for(int i = 0; i < 10; i++){ if(curr->next->friends[i]==leaver){ curr-", "question": "", "intention": "fix segmentation fault", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you remove an element from an array inside a struct", "question": "how do you remove an element from an array inside a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to make an array of the same type as: struct user *friends[MAX_FRIENDS];", "question": "how to make an array of the same type as: struct user *friends[MAX_FRIENDS];", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to change an array to point to another array", "question": "how to change an array to point to another array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to point an array of equal size with an array", "question": "How to point an array of equal size with an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove segmentation fault | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); //The user we want to delete User *curr = *user_ptr_del; //for traversal if(leaver == NULL || curr == NULL){ return 1; } if(curr == leaver){ *user_ptr_del = curr->next; } else if(curr != leaver){ ", "question": "", "intention": "remove segmentation fault", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: help remove segmentation fault | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); //The user we want to delete User *curr = *user_ptr_del; //for traversal if(leaver == NULL || curr == NULL){ return 1; } if(curr == leaver){ *user_ptr_del = curr->next; } else if(curr != leaver){ ", "question": "", "intention": "help remove segmentation fault", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove non-zero offset errors | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); //The user we want to delete User *curr = *user_ptr_del; //for traversal if(leaver == NULL || curr == NULL){ //check if leaver exists and if the userlist has anything in it return 1; } if(curr == ", "question": "", "intention": "remove non-zero offset errors", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: help with freeing memory stored in leaver | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); //The user we want to delete User *curr = *user_ptr_del; //for traversal if(leaver == NULL || curr == NULL){ //check if leaver exists and if the userlist has anything in it return 1; } if(curr == ", "question": "", "intention": "help with freeing memory stored in leaver", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you free an element in a linked list struct?", "question": "how do you free an element in a linked list struct?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: given these structs, how would you free a user? | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "given these structs, how would you free a user?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: given the structs, make a program that frees the memory associated with a user's friends | Code context (simplify for kids): typedef struct user { char name[32]; char profile_pic[32]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[10]; struct user *next; } User; typedef struct post { char author[32]; char *contents; time_t *date; struct post *next; } Post;", "question": "given the structs, make a program that frees the memory associated with a user's friends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: fix memory leak | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *leaver = find_user(name, *user_ptr_del); //The user we want to delete User *curr = *user_ptr_del; //for traversal if(leaver == NULL || curr == NULL){ //check if leaver exists and if the userlist has anything in it return 1; } if(curr == ", "question": "", "intention": "fix memory leak", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What does char arr[] mean?", "question": "What does char arr[] mean?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is char arr[] stack or read only memory", "question": "is char arr[] stack or read only memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does a regular file mean", "question": "what does a regular file mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to chmod", "question": "how to chmod", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do we make sure only a parent can call fork?", "question": "How do we make sure only a parent can call fork?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is each the pid of each child class the same? | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "Why is each the pid of each child class the same?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you make sure a process only creates one fork?", "question": "How do you make sure a process only creates one fork?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how could I make sure each process only produces one distinct process? | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "how could I make sure each process only produces one distinct process?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include #include #define MAXLINE 32 #define MAX_PASSWORD 10 #define PASSWORD_FILE \"pass.txt\" int main(void) { int n, user_length; char userid[MAXLINE]; char password[MAXLINE]; if ((n = read(STDIN_FILENO, userid, MAX_PASSWORD)) == -1) { pe", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "question": "", "intention": "", "task_description": "Your task is to complete checkpasswd.c, which reads a user id and password from stdin, creates a new process to run the validate program, sends it the user id and password, and prints a message to stdout reporting whether the validation is successful.", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does this code do? | Code context (simplify for kids): #include #include int main() { char phone[11]; int num; int error = 0; scanf(\"%10s\", phone); while (scanf(\"%d\", &num) > 0) { if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { printf(\"%c\\n\", phone[num]); } else { printf(\"ERROR\\n\"); error = 1; } } return e", "question": "What does this code do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include int main() { char phone[11]; int num; int error = 0; scanf(\"%10s\", phone); while (scanf(\"%d\", &num) > 0) { if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { printf(\"%c\\n\", phone[num]); } else { printf(\"ERROR\\n\"); error = 1; } } return e", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you convert string to int?", "question": "How do you convert string to int?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: avoid forward declaration error/ | Code context (simplify for kids): void tokenize(char *line, Action *act; Action *next_a){ int white_spaces = 0; int count = 0; for (int i = 1; i < MAXLINE; i++){ if (line[i-1] == ' ' &&line[i] != ' '){ white_spaces += 1; } if (line[i] == '\\t' || line[i] == '\\n' || line[i] == '\\r'){ break; } } char **args = malloc(sizeof(char*)*(whit", "question": "", "intention": "avoid forward declaration error/", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what should i do if i encounter a forward declaration error?", "question": "what should i do if i encounter a forward declaration error?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: How to create a post with the current time? | Code context (simplify for kids): typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; } Post;", "question": "How to create a post with the current time?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Can you generate a c code segment that creates a post with the current timestamp? | Code context (simplify for kids): typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; } Post;", "question": "Can you generate a c code segment that creates a post with the current timestamp?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: When I declare a struct, can I use it as a pointer the same way as an array?", "question": "When I declare a struct, can I use it as a pointer the same way as an array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I create a struct", "question": "how do I create a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I assign values to parameters of structs", "question": "How do I assign values to parameters of structs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When I use the dot operator on structs, does it give me a pointer?", "question": "When I use the dot operator on structs, does it give me a pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I assign a value to a struct?", "question": "How do I assign a value to a struct?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I close a bitmap file", "question": "How do I close a bitmap file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I deallocate memory", "question": "how do I deallocate memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does segmentation fault mean", "question": "what does segmentation fault mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I use gdb", "question": "how do I use gdb", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I use gdb to find the value of a variable", "question": "how do I use gdb to find the value of a variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to step out using gdb", "question": "how to step out using gdb", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you explain a little more from your previous answer?", "question": "Can you explain a little more from your previous answer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does \"expression must be a modifiable lvalue\" mean?", "question": "what does \"expression must be a modifiable lvalue\" mean?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What happens to the declaration on line 2 after the c pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; char name[MAXNAME];", "question": "What happens to the declaration on line 2 after the c pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I'm getting the error \"Conditional jump or move depends on uninitialised value(s)\" from this function at line 26. | Code context (simplify for kids): int print_user(const User *user) { // Return if the user doesn't exist if (user == NULL) { return 1; } // Print the user's profile pic only if the file exists FILE *file = fopen(user->profile_pic, \"r\"); if (file != NULL) { char line[MAX_NAME + 100]; while(fgets(line, MAX_NAME + 100, file) != NULL) {", "question": "I'm getting the error \"Conditional jump or move depends on uninitialised value(s)\" from this function at line 26.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Which macro is used with wait's status to check if the child process was terminated by a signal?", "question": "Which macro is used with wait's status to check if the child process was terminated by a signal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the name for a child process whose parent terminates before it does?", "question": "What is the name for a child process whose parent terminates before it does?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I use stat", "question": "how do I use stat", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: I'm confused how to use stat to find last modified time. Here's what I have. | Code context (simplify for kids): struct stat *stats = NULL; stat(\"testy.txt\", stats);", "question": "I'm confused how to use stat to find last modified time. Here's what I have.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How does setitimer work", "question": "How does setitimer work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use a timer to have a program wait", "question": "How do I use a timer to have a program wait", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): void fib(int **arr, int count){ *arr = malloc(sizeof(int) * count); if (count == 1){ *arr[0] = 0; printf(\"*arr[0] %d\", *arr[0]); } else { *arr[0] = 0; printf(\"*arr[0] %d\", *arr[0]); *arr[1] = 1; printf(\"*arr[1] %d\", *arr[1]); for (int i = 2; i < count; i++){ *arr[i] = *arr[i-2] + *arr[i-1]; printf(\"", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: read each line from standard input and parse it | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *); int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1;", "question": "", "intention": "read each line from standard input and parse it", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: parse each line read from the standard input. The first character from each line is not being read correctly. | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *); int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1;", "question": "", "intention": "parse each line read from the standard input. The first character from each line is not being read correctly.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can I read from standard input, line by line (separated by newline)?", "question": "how can I read from standard input, line by line (separated by newline)?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: check if the SIN given by command line argument is valid, using the Luhn algorithm | Code context (simplify for kids): #include #include int populate_array(int, int *); int check_sin(int *); int main(int argc, char **argv) { // TODO: Verify that command line arguments are valid. if (argc != 2) { return 2; } int sin = strtol(argv[1], NULL, 10); int sin_array[10]; // TODO: Parse arguments and then", "question": "", "intention": "check if the SIN given by command line argument is valid, using the Luhn algorithm", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: i keep getting the error subscripted value is neither array nor pointer nor vector", "question": "i keep getting the error subscripted value is neither array nor pointer nor vector", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does this mean c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^", "question": "what does this mean c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do I fix this error c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^ | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\", arg); } else { printf(\"ERROR\"); return 1; } } return 0; }", "question": "how do I fix this error c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why does this code raise this error c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^ | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\", arg); } else { printf(\"ERROR\"); return 1; } } return 0; }", "question": "", "intention": "why does this code raise this error c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '16416123456733' != '1\\n6\\n4161234567\\n3' E - 16416123456733 E ? ^ E + 1 E 6 E 4161234567 E 3 E ? + + ^", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1 \\n6 \\n41612345673 \\n3' != '1\\n6\\n4161234567\\n3' E - 1 E ? - E + 1 E - 6 E ? - E + 6 E - 41612345673 E ? -- E + 4161234567 E 3 | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\", arg); } else { printf(\"ERROR\"); return 1; } } return 0; }", "question": "", "intention": "c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1 \\n6 \\n41612345673 \\n3' != '1\\n6\\n4161234567\\n3' E - 1 E ? - E + 1 E - 6 E ? - E + 6 E - 41612345673 E ? -- E + 4161234567 E 3", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1 \\n6 \\n41612345673 \\n3' != '1\\n6\\n4161234567\\n3' E - 1 E ? - E + 1 E - 6 E ? - E + 6 E - 41612345673 E ? -- E + 4161234567 E 3 | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c \\n\", arg); } else { printf(\"ERROR\"); return 1; } } return 0", "question": "", "intention": "c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1 \\n6 \\n41612345673 \\n3' != '1\\n6\\n4161234567\\n3' E - 1 E ? - E + 1 E - 6 E ? - E + 6 E - 41612345673 E ? -- E + 4161234567 E 3", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' E 1 E 6 E 4161234567 E - 3 E 3 | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\\n\", arg); } else { printf(\"ERROR\"); return 1; } } return ", "question": "", "intention": "c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' E 1 E 6 E 4161234567 E - 3 E 3", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\\n\", arg); } else { printf(\"ERROR\"); return 1; } } return ", "question": "", "intention": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I have this error: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' I want my code to do this. Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the f | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\\n\", arg); } else { printf(\"ERROR\"); return 1; } } return ", "question": "", "intention": "I have this error: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' I want my code to do this. Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the f", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I have this error: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' I want my code to do this. Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the f | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\\n\", arg); } else { printf(\"ERROR\"); return 1; } } return ", "question": "", "intention": "I have this error: c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' I want my code to do this. Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the f", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: in C how can I check if standard input is closed using scanf", "question": "in C how can I check if standard input is closed using scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why does my code raise this error? c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' E 1 E 6 E 4161234567 E - 3 E 3 | Code context (simplify for kids): #include int main() { char phone[11]; scanf(\"%s\", phone); int val = 1; int num; while (val == 1) { val = scanf(\"%d\", &num); if (num == -1) { printf(\"%s\\n\", phone); } else if (num >= 0 && num <= 9) { char arg = phone[num]; printf(\"%c\\n\", arg); } else { printf(\"ERROR\"); return 1; } } return ", "question": "", "intention": "why does my code raise this error? c_helper.py:148: in _t self.assertEqual(stdout, expected_stdout) E AssertionError: '1\\n6\\n4161234567\\n3\\n3' != '1\\n6\\n4161234567\\n3' E 1 E 6 E 4161234567 E - 3 E 3", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can scanf read certain lines", "question": "how can scanf read certain lines", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use scanf to read permissions and file size from redirected input", "question": "how to use scanf to read permissions and file size from redirected input", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.", "question": "what is this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how to fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i <= n; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } }", "question": "how to fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i < n + 1; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } } int main(int argc, char **argv) { /* do not cha", "question": "fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how to fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i <= n; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } }", "question": "how to fix this error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. why does changing loop condition <= to < fix the problem? | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i <= n; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } }", "question": "error malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. why does changing loop condition <= to < fix the problem?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why would an incorrect loop condition result in malloc error | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i <= n; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } }", "question": "why would an incorrect loop condition result in malloc error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why would an incorrect loop condition result in malloc error, but only for certain n values (such as n = 10, n = 14) | Code context (simplify for kids): void fib(int **heap_loc, int n) { *heap_loc = malloc(sizeof(int) * n); for (int i = 0; i <= n; i++) { if (i == 0) { (*heap_loc)[i] = 0; } else if (i == 1) { (*heap_loc)[i] = 1; } else { (*heap_loc)[i] = (*heap_loc)[i - 1] + (*heap_loc)[i - 2]; } } }", "question": "why would an incorrect loop condition result in malloc error, but only for certain n values (such as n = 10, n = 14)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int *build_array(char **strs, int size) { int *ints = malloc(sizeof(int) * size); for (int i = 0; i < size; i++) { ints[i] = (int) strtol(strs[i], NULL, 10); } return ints; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr_indexes = malloc(2 * sizeof(int*)); int even_count = 0; int odd_count = 0; for (int i = 0; i < length; i++) { if (s[i] % 2 == 0) { even_count += 1; } else { odd_count += 1; } } int *even_pt = malloc(even_count * sizeof(int)); int *odd_pt = mall", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: which line causes error | Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr_indexes = malloc(2 * sizeof(int*)); int even_count = 0; int odd_count = 0; for (int i = 0; i < length; i++) { if (s[i] % 2 == 0) { even_count += 1; } else { odd_count += 1; } } int *even_pt = malloc(even_count * sizeof(int)); int *odd_pt = mall", "question": "which line causes error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does arr_indexes[0] = even_pt; raise an error and how to fix it? | Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr_indexes = malloc(2 * sizeof(int*)); int even_count = 0; int odd_count = 0; for (int i = 0; i < length; i++) { if (s[i] % 2 == 0) { even_count += 1; } else { odd_count += 1; } } int *even_pt = malloc(even_count * sizeof(int)); int *odd_pt = mall", "question": "why does arr_indexes[0] = even_pt; raise an error and how to fix it?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: with input ./count_large 1000 rwx------ with command line input total 329 -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz -rw-r--r-- 1 reid staff 88 Feb 15 2013 xyz.c why does the function return 1 instead of 2 | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. // int check_permissions(char *, char *); int check_permissions(char *a, char *b) { for (int i = 0; i < 9; i++) { if (b[i] == '-') { ; } else if (b[i] != a[i]) { return 1; } }", "question": "with input ./count_large 1000 rwx------ with command line input total 329 -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz -rw-r--r-- 1 reid staff 88 Feb 15 2013 xyz.c why does the function return 1 instead of 2", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what's wrong with this code | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. // int check_permissions(char *, char *); int check_permissions(char *a, char *b) { for (int i = 0; i < 9; i++) { if (b[i] == '-') { ; } else if (b[i] != a[i]) { return 1; } }", "question": "what's wrong with this code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: which part of the code is wrong | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. // int check_permissions(char *, char *); int check_permissions(char *a, char *b) { for (int i = 0; i < 9; i++) { if (b[i] == '-') { ; } else if (b[i] != a[i]) { return 1; } }", "question": "which part of the code is wrong", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print out permissions match and file size is larger or equal | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. // int check_permissions(char *, char *); int check_permissions(char *a, char *b) { for (int i = 0; i < 9; i++) { if (b[i] == '-') { ; } else if (b[i] != a[i]) { return 1; } }", "question": "", "intention": "print out permissions match and file size is larger or equal", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. // int check_permissions(char *, char *); int check_permissions(char *a, char *b) { for (int i = 0; i < 9; i++) { if (b[i] == '-') { ; } else if (b[i] != a[i]) { return 1; } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can I ignore first line in scanf", "question": "how can I ignore first line in scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: ignore the first character using scanf", "question": "ignore the first character using scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: convert int to char[9]", "question": "convert int to char[9]", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: convert int to array", "question": "convert int to array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: index an int", "question": "index an int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: fix this code | Code context (simplify for kids): int create_user(const char *name, User **user_ptr_add) { User *curr = *user_ptr_add; while (curr != NULL) { if (strcmp(name, curr->name) == 0) { return 1; } curr = curr->next; }", "question": "", "intention": "fix this code", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): /* Convert an array of args to a single space-separated string in buffer. Returns buffer. Note that memory for args and buffer should be allocated by the caller. */ char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what's a buffer? | Code context (simplify for kids): /* Convert an array of args to a single space-separated string in buffer. Returns buffer. Note that memory for args and buffer should be allocated by the caller. */ char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args", "question": "what's a buffer?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): include int main() { char name[30]; printf(\"Hello CSC209 students!\\n\"); fgets(name, 30, stdin); printf(\"Hi %s\\n\", name); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is standard input?", "question": "what is standard input?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does scanf do in c?", "question": "what does scanf do in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): scanf(\"%[^\\n]\", line);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): if (pid == 0) { //child process; read from pipe and write to stdin of validate close(pipefd[1]); if (dup2(pipefd[0], STDIN_FILENO) == -1) { perror(\"Dup2 failed\"); exit(1); } close(pipefd[0]); execl(\"./validate\", \"validate\", NULL); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when execl calls validate, where is the standard input read from? | Code context (simplify for kids): if (pid == 0) { //child process; read from pipe and write to stdin of validate close(pipefd[1]); if (dup2(pipefd[0], STDIN_FILENO) == -1) { perror(\"Dup2 failed\"); exit(1); } close(pipefd[0]); execl(\"./validate\", \"validate\", NULL); }", "question": "when execl calls validate, where is the standard input read from?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does execl return?", "question": "what does execl return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Assign a dynamically allocated char * array of length 4 to last_names. Then, allocate a character array of length 20 for each element of the array pointed to by last_names. | Code context (simplify for kids): int main() { char **last_names; last_names = malloc(sizeof(char*)); last_names[0] = malloc(sizeof(char) * 20); last_names[1] = malloc(sizeof(char) * 20); last_names[2] = malloc(sizeof(char) * 20); last_names[3] = malloc(sizeof(char) * 20); return 0; }", "question": "", "intention": "Assign a dynamically allocated char * array of length 4 to last_names. Then, allocate a character array of length 20 for each element of the array pointed to by last_names.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: rainfall has been dynamically allocated space for a floating point number. Both rainfall and rain_today have been initialized in hidden code. Assign the amount in rain_today to the space rainfall points to. | Code context (simplify for kids): }int main(int argc, char **argv) { float *rainfall; float rain_today; // rainfall has been dynamically allocated space for a floating point number. // Both rainfall and rain_today have been initialized in hidden code. // Assign the amount in rain_today to the space rainfall points to. return 0; }", "question": "", "intention": "rainfall has been dynamically allocated space for a floating point number. Both rainfall and rain_today have been initialized in hidden code. Assign the amount in rain_today to the space rainfall points to.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: rainfall has been dynamically allocated space for a floating point number. Both rainfall and rain_today have been initialized in hidden code. Assign the amount in rain_today to the space rainfall points to. | Code context (simplify for kids): int main(int argc, char **argv) { float *rainfall; float rain_today; // rainfall has been dynamically allocated space for a floating point number. // Both rainfall and rain_today have been initialized in hidden code. // Assign the amount in rain_today to the space rainfall points to. // Submitted co", "question": "", "intention": "rainfall has been dynamically allocated space for a floating point number. Both rainfall and rain_today have been initialized in hidden code. Assign the amount in rain_today to the space rainfall points to.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Returns the sum of two integers in the string input_line. input_line is a string containing two integers separated by one or more spaces. Assume that the string will not be more than 20 characters long and that it contains two integers separated only by whitespace. There may also be spaces before the first integer and/or after the last, but there won't be any other characters in the string. For ex | Code context (simplify for kids): int get_sum(const char *input_line) { }", "question": "", "intention": "Returns the sum of two integers in the string input_line. input_line is a string containing two integers separated by one or more spaces. Assume that the string will not be more than 20 characters long and that it contains two integers separated only by whitespace. There may also be spaces before the first integer and/or after the last, but there won't be any other characters in the string. For ex", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is the sizeof(char *) and sizeof(&char) the same?", "question": "is the sizeof(char *) and sizeof(&char) the same?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\". | Code context (simplify for kids): int main(){ char greetings[15] = \"salutations\"; char *farewell[] = \"goodbye\"; }", "question": "", "intention": "Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\". | Code context (simplify for kids): int main(){ char greetings[15] = \"salutations\"; char *farewell = \"goodbye\"; }", "question": "", "intention": "Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\". | Code context (simplify for kids): int main(){ char greetings[15] = \"salutations\"; char *farewell = \"goodbye\"; }", "question": "", "intention": "Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\". | Code context (simplify for kids): #include int main() { char greetings[15] = \"salutations\"; char *farewell = \"goodbye\"; }", "question": "", "intention": "Define a stack-allocated string called greetings that has space for 15 characters (including the null terminator) and set its initial value to \"salutations\". Then define a string literal with the name farewell that has the value \"goodbye\".", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is 'arrays' uninitialized? | Code context (simplify for kids): int **split_array(const int *s, int length) { int **arrays; int half_length; if (length%2 == 0){ half_length = length/2 + 1; } else { half_length = length/2; } int *array1 = malloc(sizeof(int) * half_length); int *array2 = malloc(sizeof(int) * half_length); for (int i = 0; i < length; i = i + 2){ ar", "question": "Why is 'arrays' uninitialized?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Return a pointer to an array of ints with size elements. - strs is an array of strings where each element is the string representation of an integer. - size is the size of the array | Code context (simplify for kids): int *build_array(char **strs, int size) { int *ptr; for (int i = 0; i < size; i++){ ptr[i] = (int) strtol(strs[i], NULL, 10); } return ptr; }", "question": "", "intention": "Return a pointer to an array of ints with size elements. - strs is an array of strings where each element is the string representation of an integer. - size is the size of the array", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: You are required to write (and use) a helper function named check_permissions that takes two 9-element character arrays as arguments and returns an integer. (The prototype for this function is in the starter code.) The first array will represent the permission field of a file and the second will represent the permissions that are required. The function will return 0 if the file has all the require | Code context (simplify for kids): int check_permissions(char *file_permission, char *required_permission){ for (int i; i < 10; i++){ if ((file_permission[i] != required_permission[i]) && (required_permission[i] != '-')){ return 1; } } return 0; }", "question": "", "intention": "You are required to write (and use) a helper function named check_permissions that takes two 9-element character arrays as arguments and returns an integer. (The prototype for this function is in the starter code.) The first array will represent the permission field of a file and the second will represent the permissions that are required. The function will return 0 if the file has all the require", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you get multiple command line arguments and save them as variables?", "question": "How do you get multiple command line arguments and save them as variables?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: For example, given the output of ls -l: total 329 -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz -rw-r--r-- 1 reid staff 88 Feb 15 2013 xyz.c how could I store each line in a separate string using scanf?", "question": "For example, given the output of ls -l: total 329 -rwx------ 1 reid staff 1734 Jun 22 14:52 prog -rw------- 1 reid staff 21510 Apr 6 12:10 tmp.txt -rwxr-xr-x 1 reid staff 8968 Feb 1 2013 xyz -rw-r--r-- 1 reid staff 88 Feb 15 2013 xyz.c how could I store each line in a separate string using scanf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print permission and count | Code context (simplify for kids): while (scanf(\"%10s %*d %*s %*s %d %*s %*d %*s %*s\", permission, &file_size)!= EOF){ // printf(\"%d\", file_size); int count = 0; if (file_size > size){ if (argc == 2){ count = count + 1; } // TODO: Call check_permissions as part of your solution to count the files to // compute and print the correct v", "question": "", "intention": "print permission and count", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: warning: ‘count’ may be used uninitialized in this function | Code context (simplify for kids): int main(int argc, char** argv) { 17 if (!(argc == 2 || argc == 3)) { 18 fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); 19 return 1; 20 } 21 22 int size; 23 char required[11]; 24 int *count; 25 26 // TODO: Process command line arguments. 27 if (argc == 2){ 28 size = *argv[1]; 29 } else ", "question": "", "intention": "warning: ‘count’ may be used uninitialized in this function", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. Hint: use % 10 and / 10 to calculate the digits. The function must return 0 when it completes successfully, and 1 if the given integer is not 9 digits. | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { // check if sin is 9 digits int count = 0; int num = sin; while (num != 0){ count++; num /= 10; } if (count != 9){ return 1; } // populate sin_array for (int i = 8; i > 0; i--){ sin_array[i] = sin % 10; sin = sin / 10; } return 0; }", "question": "", "intention": "It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. Hint: use % 10 and / 10 to calculate the digits. The function must return 0 when it completes successfully, and 1 if the given integer is not 9 digits.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. Hint: use % 10 and / 10 to calculate the digits. The function must return 0 when it completes successfully, and 1 if the given integer is not 9 digits. | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { // check if sin is 9 digits int count = 0; int num = sin; while (num != 0){ count++; num /= 10; } if (count != 9){ return 1; } // populate sin_array for (int i = 8; i >= 0; i--){ sin_array[i] = sin % 10; sin = sin / 10; } return 0; }", "question": "", "intention": "It takes an integer and an integer array as its arguments, and returns an integer. This function's job is to populate the given integer array so that it contains the 9 digits of the given integer, in the same order as in the integer. Hint: use % 10 and / 10 to calculate the digits. The function must return 0 when it completes successfully, and 1 if the given integer is not 9 digits.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: If the user calls the program with too few or too many arguments, the program should not print anything, but should return from main with return code 2. main should return 0 when the program runs successfully and the SIN is valid and 1 when the program runs successfully but the SIN is invalid. | Code context (simplify for kids): int main(int argc, char **argv) { // TODO: Verify that command line arguments are valid. if (argc != 2){ return 2; } // TODO: Parse arguments and then call the two helpers in sin_helpers.c // to verify the SIN given as a command line argument. int *populated_array; populate_array((int) argv[1], popu", "question": "", "intention": "If the user calls the program with too few or too many arguments, the program should not print anything, but should return from main with return code 2. main should return 0 when the program runs successfully and the SIN is valid and 1 when the program runs successfully but the SIN is invalid.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set required as the string in argv[2] | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } int size; char required[11]; int count = 0; printf(\"argc: %d, argv: %s\\n\", argc, argv[2]); // TODO: Process command line arguments. if (argc == 2){ size = *argv[", "question": "", "intention": "Set required as the string in argv[2]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); } if (argv[1] == argc[2]){ printf(\"Same\\n\"); } else{ printf(\"Different\\n\"); } return 0; }", "question": "", "intention": "Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your m | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); return 0; } if (*argv[1] == *argv[2]){ printf(\"Same\\n\"); return 0; } else{ printf(\"Different\\n\"); return 0; } }", "question": "", "intention": "/* Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your m", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); return 0; } if strcmp(*argv[1], *argv[2]){ printf(\"Same\\n\"); return 0; } else{ printf(\"Different\\n\"); return 0; } }", "question": "", "intention": "Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); return 0; } if !strcmp(*argv[1], *argv[2]){ printf(\"Same\\n\"); return 0; } else{ printf(\"Different\\n\"); return 0; } }", "question": "", "intention": "Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); return 0; } if !strcmp(argv[1], argv[2]){ printf(\"Same\\n\"); return 0; } else{ printf(\"Different\\n\"); return 0; } }", "question": "", "intention": "Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main | Code context (simplify for kids): int main(int argc, char ** argv){ if (argc != 3){ printf(\"Invalid\\n\"); return 0; } if strcmp(argv[1], argv[2]){ printf(\"Same\\n\"); return 0; } else{ printf(\"Different\\n\"); return 0; } }", "question": "", "intention": "Write the main() function of a program that takes exactly two arguments, and prints one of the following: - \"Same\\n\" if the arguments are the same. - \"Different\\n\" if the arguments are different. - \"Invalid\\n\" if the program is called with an incorrect number of arguments. NOTE: Cut and paste these strings into your printf statements to ensure that they will be exactly the strings above. Your main", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ strncpy(s, s, n); int removed = strlen(s) - n; return removed; } else { return 0; }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ strncpy(s, s, n); int removed = strlen(s) - n; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ char copy[n+1]; strcpy(copy, s); strncpy(s, copy, n); int removed = strlen(s) - n; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ char copy[n+1]; strcpy(copy, s); strncpy(s, copy, n-1); s[n] = \\0; int removed = strlen(s) - n; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Complete this program by writing the function strip_q_marks that takes a single string and returns an integer. The function should modify the string to remove any trailing question marks and return the number of question marks that were removed. Note that you should put the command-line argument in double quotes when you type it in. This prevents the shell from interpreting characters such as \"?\" | Code context (simplify for kids): int strip_q_marks(char *string_ptr){ int n = strlen(*string_ptr); int count = 0; for (int i = n; i > 0; i--){ if (string_ptr[i] == \"?\"){ string_prt[i] = '\\0'; count = count + 1; } else { return count; } } }", "question": "", "intention": "Complete this program by writing the function strip_q_marks that takes a single string and returns an integer. The function should modify the string to remove any trailing question marks and return the number of question marks that were removed. Note that you should put the command-line argument in double quotes when you type it in. This prevents the shell from interpreting characters such as \"?\" ", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Complete this program by writing the function strip_q_marks that takes a single string and returns an integer. The function should modify the string to remove any trailing question marks and return the number of question marks that were removed. Note that you should put the command-line argument in double quotes when you type it in. This prevents the shell from interpreting characters such as \"?\" | Code context (simplify for kids): int strip_q_marks(char *string_ptr){ int n = strlen(string_ptr); int count = 0; for (int i = n; i > 0; i--){ if (string_ptr[i] == '?'){ string_ptr[i] = '\\0'; count = count + 1; } else { break; } } return count; }", "question": "", "intention": "Complete this program by writing the function strip_q_marks that takes a single string and returns an integer. The function should modify the string to remove any trailing question marks and return the number of question marks that were removed. Note that you should put the command-line argument in double quotes when you type it in. This prevents the shell from interpreting characters such as \"?\" ", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ int removed = strlen(s) - n; char copy[n+1]; strcpy(copy, s); strncpy(s, copy, n); return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ int removed = strlen(s) - n; char copy[n+1]; strcpy(copy, s); strncpy(s, copy, n); s[n] = '\\0'; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ int removed = strlen(s) - n; char copy[n+1]; strcpy(copy, s); strncpy(s, copy, n-1); s[n] = '\\0'; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): int truncate(char s[], int n){ if(strlen(s) > n){ int removed = strlen(s) - n; s[n] = '\\0'; return removed; } else { return 0; } }", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This program has two arguments: the first is a greeting message, and the second is a name. The message is an impersonal greeting, such as \"Hi\" or \"Good morning\". name is set to refer to a string holding a friend's name, such as \"Emmanuel\" or \"Xiao\". First copy the first argument to the array greeting. (Make sure it is properly null-terminated.) Write code to personalize the greeting string by appe | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, \"Usage: greeting message name\\n\"); return 1; } char greeting[20]; char *name = argv[2]; // Your code goes here strncpy(greeting, argv[1], 20); int len_greet = strlen(argv[1]); greeting[len_greet + 1] = '\\0'; strcat(greeting, \" \"); st", "question": "", "intention": "This program has two arguments: the first is a greeting message, and the second is a name. The message is an impersonal greeting, such as \"Hi\" or \"Good morning\". name is set to refer to a string holding a friend's name, such as \"Emmanuel\" or \"Xiao\". First copy the first argument to the array greeting. (Make sure it is properly null-terminated.) Write code to personalize the greeting string by appe", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. | Code context (simplify for kids): void list_users(const User *curr) { User *temp; temp = (User *) curr; while (temp != NULL){ printf(\"%s\\n\", temp->name); temp = temp->next; } }", "question": "", "intention": "Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is this function is only printing the last two nodes instead of all nodes? | Code context (simplify for kids): void list_users(const User *curr) { printf(\"User List\\n\"); User *temp; User *head = (User *) curr; temp = (User *) curr; while (temp != NULL){ printf(\"\\t%s\\n\", temp->name); temp = temp->next; } curr = head; }", "question": "Why is this function is only printing the last two nodes instead of all nodes?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to print the contents of a file?", "question": "How to print the contents of a file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: tranverse through user's friends and print the name of each one | Code context (simplify for kids): int print_user(const User *user) { while (user->friends != NULL){ printf(\"\\t%s\\n\", (user->friends)->name); user->friends = user->friends->next; } }", "question": "", "intention": "tranverse through user's friends and print the name of each one", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print a user profile. * For an example of the required output format, see the example output * linked from the handout. * Return: * - 0 on success. * - 1 if the user is NULL. | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL){ return 1; } printf(\"Name: %s\", user->name); printf(\"------------------------------------------\"); printf(\"Friends:\\n\"); User *friends = (User *) user->friends; while (friends != NULL){ printf(\"\\t%s\\n\", friends->name); friends = friends->next; } p", "question": "", "intention": "Print a user profile. * For an example of the required output format, see the example output * linked from the handout. * Return: * - 0 on success. * - 1 if the user is NULL.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to print characters of a file one by one?", "question": "how to print characters of a file one by one?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why is it giving me an error warning: control reaches end of non-void function [-Wreturn-type] 38 | } | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image, 10, SEEK_SET); fread(pixel_array_offset, 4, 1, image); fseek(image, 18, SEEK_SET); fread(width, 4, 1, image); fseek(image, 22, SEEK_SET); fread(height, 4, 1, image); return; }", "question": "why is it giving me an error warning: control reaches end of non-void function [-Wreturn-type] 38 | }", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: suppose we have the following line at the top of our program #define MAXNAME = 32; and then the declaration char name[MAXNAME]; in the program. What will this declaration line become after the program has passed through the C pre-processor?", "question": "suppose we have the following line at the top of our program #define MAXNAME = 32; and then the declaration char name[MAXNAME]; in the program. What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: At our company, an employee has a regular pay rate but then gets 5 dollars extra per hour whenever they are working as a supervisor. Consider the following definition of a MACRO to represent this: #define SUPERVISOR(regular) regular + 5 What will be the output of the following program fragment? #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf", "question": "At our company, an employee has a regular pay rate but then gets 5 dollars extra per hour whenever they are working as a supervisor. Consider the following definition of a MACRO to represent this: #define SUPERVISOR(regular) regular + 5 What will be the output of the following program fragment? #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line. | Code context (simplify for kids): void list_users(const User *curr) { printf(\"User List\\n\"); User *temp; temp = (User *) curr; while (temp != NULL){ printf(\"\\t%s\\n\", temp->name); temp = temp->next; } }", "question": "", "intention": "Print the usernames of all users in the list starting at curr. * Names should be printed to standard output, one per line.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is this initialization for friends1[] and friends2[] invalid? | Code context (simplify for kids): char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User *user1 = find_user(name1, head); User friends1[] = (*user1).friends; User *user2 = find_user(name2, head); User", "question": "Why is this initialization for friends1[] and friends2[] invalid?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why am I getting this error: error: ‘friends1’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 126 | friends1[i] = (*user1).friends[i]; | Code context (simplify for kids): User *user1 = find_user(name1, head); User **friends1; int i = 0; while ((*user1).friends[i] != NULL){ friends1[i] = (*user1).friends[i]; } User *user2 = find_user(name2, head); User **friends2; int j = 0; while ((*user2).friends[j] != NULL){ friends2[j] = (*user2).friends[j]; }", "question": "why am I getting this error: error: ‘friends1’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 126 | friends1[i] = (*user1).friends[i];", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to check if an element in the array is equal to NULL?", "question": "how to check if an element in the array is equal to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why is friends1[x] != NULL giving me an error | Code context (simplify for kids): User *user1 = find_user(name1, head); User friends1[MAX_FRIENDS]; int i = 0; while ((*user1).friends[i] != NULL){ friends1[i] = *(*user1).friends[i]; } User *user2 = find_user(name2, head); User friends2[MAX_FRIENDS]; int j = 0; while ((*user2).friends[j] != NULL){ friends2[j] = *(*user2).friends[j]", "question": "why is friends1[x] != NULL giving me an error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Error in assigning first_post | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL){ return 1; } FILE *profile_pic; if ((profile_pic = fopen(user->profile_pic, \"r\")) != NULL){ int c; while ((c = getc(profile_pic)) != EOF){ printf(\"%c\", c); } fclose(profile_pic); } printf(\"\\n\"); printf(\"Name: %s\\n\", user->name); printf(\"----------", "question": "", "intention": "Error in assigning first_post", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: * From the list pointed to by *user_ptr_del, delete the user 242 * with the given name. 243 * Remove the deleted user from any lists of friends. 244 * 245 * Return: 246 * - 0 on success. 247 * - 1 if a user with this name does not exist. | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { 250 User *temp = *user_ptr_del; 251 if (strcmp((*user_ptr_del)->name, name) == 0){ 252 for (int i = 0; i < MAX_FRIENDS; i++){ 253 for (int j = 0; j < MAX_FRIENDS; j++){ 254 if (strcmp(((*user_ptr_del)->next->friends[i]->f riends[j]->name), nam", "question": "", "intention": "* From the list pointed to by *user_ptr_del, delete the user 242 * with the given name. 243 * Remove the deleted user from any lists of friends. 244 * 245 * Return: 246 * - 0 on success. 247 * - 1 if a user with this name does not exist.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: * From the list pointed to by *user_ptr_del, delete the user 242 * with the given name. 243 * Remove the deleted user from any lists of friends. 244 * 245 * Return: 246 * - 0 on success. 247 * - 1 if a user with this name does not exist. | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { 250 User *temp = *user_ptr_del; 251 if (strcmp((*user_ptr_del)->name, name) == 0){ 252 for (int i = 0; i < MAX_FRIENDS; i++){ 253 for (int j = 0; j < MAX_FRIENDS; j++){ 254 if (strcmp(((*user_ptr_del)->next->friends[i]->f riends[j]->name), nam", "question": "", "intention": "* From the list pointed to by *user_ptr_del, delete the user 242 * with the given name. 243 * Remove the deleted user from any lists of friends. 244 * 245 * Return: 246 * - 0 on success. 247 * - 1 if a user with this name does not exist.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { User *temp = *user_ptr_del; if (strcmp((*user_ptr_del)->name, name) == 0){ for (int i = 0; i < MAX_FRIENDS; i++){ while ((*user_ptr_del)->friends[i] != NULL){ for (int j = 0; j < MAX_FRIENDS; j++){ while ((*user_ptr_del)->friends[i]->friends[j", "question": "", "intention": "From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. There is an error between lines 3 and 13 | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { if (strcmp((*user_ptr_del)->name, name) == 0){ for (int i = 0; i < MAX_FRIENDS; i++){ while ((*user_ptr_del)->friends[i] != NULL){ for (int j = 0; j < MAX_FRIENDS; j++){ while ((*user_ptr_del)->friends[i]->friends[j] != NULL){ if (strcmp(((*us", "question": "", "intention": "From the list pointed to by *user_ptr_del, delete the user * with the given name. * Remove the deleted user from any lists of friends. * * Return: * - 0 on success. * - 1 if a user with this name does not exist. There is an error between lines 3 and 13", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: delete the first user From the list pointed to by *user_ptr_del | Code context (simplify for kids): int delete_user(const char *name, User **user_ptr_del) { if (strcmp((*user_ptr_del)->name, name) == 0){ int i = 0; while (((*user_ptr_del)->friends[i] != NULL) && (i < MAX_FRIENDS)){ int j = 0; while (((*user_ptr_del)->friends[i]->friends[j] != NULL) && (j < MAX_FRIENDS)){ if (strcmp(((*user_ptr_del", "question": "", "intention": "delete the first user From the list pointed to by *user_ptr_del", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ dest[i] = src[i]; } dest[capacity] = '\\0'; return dest; }", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ dest[i] = src[i]; } dest[capacity] = \"\\0\"; return dest; }", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 4 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to add a null terminator to the last value of a string without using strcpy or strncpy?", "question": "How to add a null terminator to the last value of a string without using strcpy or strncpy?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to add a null terminator to the last value of a string without using any string functions??", "question": "How to add a null terminator to the last value of a string without using any string functions??", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is this string not properly terminated with a null character? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ dest[i] = src[i]; } dest[capacity] = '\\0'; return dest; }", "question": "Why is this string not properly terminated with a null character?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ dest[i] = src[i]; } dest[capacity - 1] = '\\0'; return dest; }", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ if (src[i] == '\\0'){ break; } else { dest[i] = src[i]; } return dest; }", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { for (int i = 0; i < capacity - 1; i++){ if (src[i] == '\\0'){ break; } else { dest[i] = src[i]; } dest[capacity - 1] = '\\0'; return dest; }", "question": "", "intention": "Write the copy function to perform exactly as strncpy does, with one exception: your copy function will guarantee that dest is always null-terminated. Capacity is expected to be the number of bytes of memory allocated to dest. You shoud read the man page to learn how strncpy works. NOTE: You must write this function without using any string functions. The only function that should depend on string", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the missing code? | Code context (simplify for kids): char *course = \"csc207\"; // missing code x = course; x[5] = ’9’;", "question": "What is the missing code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *intertwine(char *s1, char *s2) { retval[size_ret] = ’\\0’; return retval; char *result = malloc(strlen(s1) + strlen(s2) + 1); int min = strlen(s1); if (strlen(s2) < min) { min = strlen(s2); } for (int i = 0; i < min; i++) { result[i*2] = s1[i]; result[i*2 + 1] = s2[i]; } result[min*2] = ’\\0’; s", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why do we need the address of s1 in strcat(result, &s1[min]); ? | Code context (simplify for kids): char *intertwine(char *s1, char *s2) { retval[size_ret] = ’\\0’; return retval; char *result = malloc(strlen(s1) + strlen(s2) + 1); int min = strlen(s1); if (strlen(s2) < min) { min = strlen(s2); } for (int i = 0; i < min; i++) { result[i*2] = s1[i]; result[i*2 + 1] = s2[i]; } result[min*2] = ’\\0’; s", "question": "Why do we need the address of s1 in strcat(result, &s1[min]); ?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char **w = malloc(2 * sizeof(char *)); w[0] = \"hello\"; *(w + 1) = w[0] + 1; printf(\"%s, %s\", w[0], w[1]);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between -> and . in c?", "question": "What is the difference between -> and . in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is a dangling pointer?", "question": "What is a dangling pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When should I allocate dynamic memory?", "question": "When should I allocate dynamic memory?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this code give a run-time error for returning stack memory? | Code context (simplify for kids): int *mkpoint(int x, int y) { int pt[2] = {x, y}; return pt; } x = mkpoint(3, 4);", "question": "Why does this code give a run-time error for returning stack memory?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when does a segmentation fault happen?", "question": "when does a segmentation fault happen?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: If I removed result[size] = '\\0';, what error would occur and why? | Code context (simplify for kids): char *every_nth(char *s, int n) { 3 4 int size = strlen(s) / n; 5 6 char *result = malloc(sizeof(char) * size + 1); 7 8 int i = 0; 9 for(i = 0; i < size; i++) { 10 result[i] = s[i * n]; 11 } 12 13 result[size] = ’\\0’; 14 15 return result; 16 17 }", "question": "If I removed result[size] = '\\0';, what error would occur and why?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when would extra output happen?", "question": "when would extra output happen?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are char * and strings the same in all cases?", "question": "Are char * and strings the same in all cases?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between gcc -c and GCC -o?", "question": "What is the difference between gcc -c and GCC -o?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What is **w? | Code context (simplify for kids): char **w = malloc(2 * sizeof(char *)); w[0] = \"hello\"; *(w + 1) = w[0] + 1; printf(\"%s, %s\", w[0], w[1]);", "question": "What is **w?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is \"hello\" spread across w[0] to w[4], instead of being pointed to by w[0]? | Code context (simplify for kids): char **w = malloc(2 * sizeof(char *)); w[0] = \"hello\"; *(w + 1) = w[0] + 1; printf(\"%s, %s\", w[0], w[1]);", "question": "Why is \"hello\" spread across w[0] to w[4], instead of being pointed to by w[0]?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include int main() { int ret; printf(\"A\\n\"); ret = fork(); printf(\"B\\n\"); if (ret < 0) { perror(\"fork\"); exit(1); } else if (ret == 0) { printf(\"C\\n\"); } else { printf(\"D\\n\"); } printf(\"E\\n\"); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How many processes are created, including the original parent, when forkloop is called with 2, 3, and 4 as arguments? n arguments? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(", "question": "How many processes are created, including the original parent, when forkloop is called with 2, 3, and 4 as arguments? n arguments?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: If we run forkloop 1, two processes are created, the original parent process and its child. Assuming the process id of the parent is 414 and the process id of the child is 416, we can represent the relationship between these processes using the following ASCII diagram: 414 -> 416 Use a similar ASCII diagram to show the processes created and their relationships when you run forkloop 3. In other wor | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "If we run forkloop 1, two processes are created, the original parent process and its child. Assuming the process id of the parent is 414 and the process id of the child is 416, we can represent the relationship between these processes using the following ASCII diagram: 414 -> 416 Use a similar ASCII diagram to show the processes created and their relationships when you run forkloop 3. In other wor", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Only the original parent calls fork and the new children do not create additional processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Only the original parent calls fork and the new children do not create additional processes.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Only the original parent calls fork and the new children do not create additional processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Only the original parent calls fork and the new children do not create additional processes.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Only the original parent calls fork and the new children do not create additional processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Only the original parent calls fork and the new children do not create additional processes.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Only the original parent calls fork and the new children do not create additional processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Only the original parent calls fork and the new children do not create additional processes.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: each process creates exactly one a new process. Keep the printf call for all processes. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "each process creates exactly one a new process. Keep the printf call for all processes.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Each fork process creates exactly one new fork process. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Each fork process creates exactly one new fork process.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: The original parent calls fork and new children do not create additional processes | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "The original parent calls fork and new children do not create additional processes", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420 | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } printf(\"ppid = %d, pid = %d, i = %d\\n\", getppid(", "question": "", "intention": "Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420 | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(1); } break; printf(\"ppid = %d, pid = %d, i = %d\\n\", g", "question": "", "intention": "Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420 | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420 | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "Modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. The resulting diagram will look something like the following when childcreates 3 is called: 414 -> 416 -> 417 -> 420", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the syntax for wait in a parent call that waits for the child fork call to complete?", "question": "What is the syntax for wait in a parent call that waits for the child fork call to complete?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why are all pid the same? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "Why are all pid the same?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: have the parent wait for all children forks to finish using the wait call. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "", "intention": "have the parent wait for all children forks to finish using the wait call.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: have the parent wait for all children forks to finish using the wait call. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "", "intention": "have the parent wait for all children forks to finish using the wait call.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: have the parent wait for all children forks to finish using the wait call. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "", "intention": "have the parent wait for all children forks to finish using the wait call.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does all children fork have the same pid? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "Why does all children fork have the same pid?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: the command line argument is the number of forks done by this program. Have it such that all the forks have different process ids but are forked from the same parent (have the same ppid). | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); exit(", "question": "", "intention": "the command line argument is the number of forks done by this program. Have it such that all the forks have different process ids but are forked from the same parent (have the same ppid).", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. Add the appropriate wait calls to ensure that each parent does not terminate before its children. | Code context (simplify for kids): #include #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int", "question": "", "intention": "In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. Add the appropriate wait calls to ensure that each parent does not terminate before its children.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. Add the appropriate wait calls to ensure that each parent does not terminate before its children. | Code context (simplify for kids): #include #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); printf(\"ppid = %d, pid = %d\\n\", getppid(), getpid()); for (int", "question": "", "intention": "In the new file, modify the program so that each process creates exactly one a new process. Keep the printf call for all processes. Add the appropriate wait calls to ensure that each parent does not terminate before its children.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the default standard input?", "question": "What is the default standard input?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I run a c file validate.c and have it return the return code to stdout?", "question": "how do I run a c file validate.c and have it return the return code to stdout?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when running a compiled file using the ./ command, how can I have the exit code in stdout?", "question": "when running a compiled file using the ./ command, how can I have the exit code in stdout?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fork into another file in c?", "question": "How to fork into another file in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This program should take in two arguments from stdin, then write them to a pipe. Then, have fork the program and have the child process call the program ./validate with the two arguments from the pipe. Depending on the exit code of ./validate, the program should output SUCCESS, INVALID or NO_USER. | Code context (simplify for kids): int fd[2]; if(pipe(fd) = -1){ perror(\"pipe\"); } int status; int n = fork(); if(n < 0){ perror(\"fork\"); exit(1); } else if (n > 0){ close(fd[0]); if (write(fd[1], user_id, MAXLINE) == -1){ perror(\"write to pipe\"); } if (write(fd[1], password, MAXLINE) == -1){ perror(\"write to pipe\"); } close(fd[1]); ", "question": "This program should take in two arguments from stdin, then write them to a pipe. Then, have fork the program and have the child process call the program ./validate with the two arguments from the pipe. Depending on the exit code of ./validate, the program should output SUCCESS, INVALID or NO_USER.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to stop fork from rerunning fgets", "question": "How to stop fork from rerunning fgets", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If there are two things in the pipe do you use dup2 once or twice?", "question": "If there are two things in the pipe do you use dup2 once or twice?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Initialize memory for fd[1], however, the code is giving me an error as expected ‘void *’ but argument is of type ‘int’ | Code context (simplify for kids): int fd[2]; if(pipe(fd) == -1){ perror(\"pipe\"); } memset(fd[1], MAX_PASSWORD * 2, sizeof(char));", "question": "Initialize memory for fd[1], however, the code is giving me an error as expected ‘void *’ but argument is of type ‘int’", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: How to deference fd and get the first element of it?", "question": "", "intention": "", "task_description": "How to deference fd and get the first element of it?", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); what does this mean?", "question": "*memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); what does this mean?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: int fd[2]; if(pipe(fd) == -1){ perror(\"pipe\"); } Given the above code, use memset to allocate space of 2 *sizeof(char) for the first element in fd.", "question": "", "intention": "", "task_description": "int fd[2]; if(pipe(fd) == -1){ perror(\"pipe\"); } Given the above code, use memset to allocate space of 2 *sizeof(char) for the first element in fd.", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: int fd[2]; if(pipe(fd) == -1){ perror(\"pipe\"); } Given the above code, use memset to allocate space of 2*MAX_PASSWORD *sizeof(char) for the second element in fd.", "question": "", "intention": "", "task_description": "int fd[2]; if(pipe(fd) == -1){ perror(\"pipe\"); } Given the above code, use memset to allocate space of 2*MAX_PASSWORD *sizeof(char) for the second element in fd.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does this error mean? /usr/include/string.h:61:14: note: declared here", "question": "What does this error mean? /usr/include/string.h:61:14: note: declared here", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: How to parse through a line like \"main : linked_list.o main.o\" to get all the dependencies and target?", "question": "", "intention": "", "task_description": "How to parse through a line like \"main : linked_list.o main.o\" to get all the dependencies and target?", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: How can I name a variable with the counter I? For example, if I want string1, string2 and string3 when i=1,2,3 respectively?", "question": "", "intention": "", "task_description": "How can I name a variable with the counter I? For example, if I want string1, string2 and string3 when i=1,2,3 respectively?", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: error: variable-sized object may not be initialized 30 | Dependency *dep[i] = malloc(sizeof(Dependency)); Why is the compiler giving me this error?", "question": "error: variable-sized object may not be initialized 30 | Dependency *dep[i] = malloc(sizeof(Dependency)); Why is the compiler giving me this error?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: How to parse through a line like \"main : linked_list.o main.o\" to get all the dependencies and target (where the number of dependencies is unknown), while mallocing space for each dependency with a data type dependency, where dependency->name be the name of the dependency?", "question": "", "intention": "", "task_description": "How to parse through a line like \"main : linked_list.o main.o\" to get all the dependencies and target (where the number of dependencies is unknown), while mallocing space for each dependency with a data type dependency, where dependency->name be the name of the dependency?", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: I want a Dependency and a Rule for every i value | Code context (simplify for kids): int i = 1; while (token != NULL){ Dependency *dep[i] = malloc(sizeof(Dependency)); if (dep[i] == NULL){ perror(\"malloc\"); exit(1); } Rule *rule[i] = malloc(sizeof(Rule)); if (rule[i] == NULL){ perror(\"malloc\"); exit(1); } dep[i]->rule_node = rule[i]; i++; }", "question": "I want a Dependency and a Rule for every i value", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: If I have multiple tokens, how can I fix this code such that I can easily access the previous dep and rule spaces? | Code context (simplify for kids): token = strtok(line, \" \"); while (token != NULL){ Dependency *dep = malloc(sizeof(Dependency)); if (dep == NULL){ perror(\"malloc\"); exit(1); } Rule *rule = malloc(sizeof(Rule)); if (rule == NULL){ perror(\"malloc\"); exit(1); } rule->target = token; dep->rule = rule; }", "question": "If I have multiple tokens, how can I fix this code such that I can easily access the previous dep and rule spaces?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: How to add code to go to the next token?", "question": "", "intention": "", "task_description": "How to add code to go to the next token?", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to check if the first character in a string is a tab?", "question": "How to check if the first character in a string is a tab?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What are arguements in make files?", "question": "What are arguements in make files?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: WHat would the output of this code be if args = \"gcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" | Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; }", "question": "WHat would the output of this code be if args = \"gcc -Wall -g -std=gnu99 -o main linked_list.o main.o\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: WHat would the output of this code be if args = \"main : linked_list.o main.o\" | Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; }", "question": "WHat would the output of this code be if args = \"main : linked_list.o main.o\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this code error: lvalue required as unary ‘&’ operand 60 | char **argument = &strtok(line, \" \");", "question": "How to fix this code error: lvalue required as unary ‘&’ operand 60 | char **argument = &strtok(line, \" \");", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: How to fix the error error: lvalue required as unary ‘&’ operand 60 | char **argument = &(strtok(line, \" \")); | Code context (simplify for kids): fgets(line, MAXLINE, fp); if (strstr(line, \"-o\") != NULL) { strtok(line, \" \"); Action *action = malloc(sizeof(Action)); char **argument = &(strtok(line, \" \")); action->args = argument; }", "question": "How to fix the error error: lvalue required as unary ‘&’ operand 60 | char **argument = &(strtok(line, \" \"));", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this error parse.c:24:22: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [-Wint-conversion] 24 | if (strchr(line, \"\\t\") != line){ | ^~~~ | | | char *", "question": "How to fix this error parse.c:24:22: warning: passing argument 2 of ‘strchr’ makes integer from pointer without a cast [-Wint-conversion] 24 | if (strchr(line, \"\\t\") != line){ | ^~~~ | | | char *", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This code is giving me a malloc: Cannot allocate memory error | Code context (simplify for kids): Rule *parse_file(FILE *fp) { // Implement this function and remove the stubbed return statement below. Rule *head = malloc(sizeof(Rule)); if (head == NULL){ perror(\"malloc\"); exit(1); } char line[MAXLINE]; while(fgets(line, MAXLINE, fp) != NULL){ // checking if the first character is a tab to determ", "question": "This code is giving me a malloc: Cannot allocate memory error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the code to check where the memory error happened with valgrind", "question": "What is the code to check where the memory error happened with valgrind", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does memset do and how do I use it?", "question": "What does memset do and how do I use it?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this warning? warning: passing argument 1 of ‘fopen’ makes pointer from integer without a cast [-Wint-conversion] 8 | FILE *fp = fopen(argv[1], \"r\"); | ~~~~^~~", "question": "How to fix this warning? warning: passing argument 1 of ‘fopen’ makes pointer from integer without a cast [-Wint-conversion] 8 | FILE *fp = fopen(argv[1], \"r\"); | ~~~~^~~", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to set action->args[1] to be arg_name with open and close quotation marks \"\"?", "question": "How to set action->args[1] to be arg_name with open and close quotation marks \"\"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does the program print to stderr when it runs without interruption? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "What does the program print to stderr when it runs without interruption?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I fix this error? Invalid read of size 4 ==13752== at 0x4900657: fgets (iofgets.c:47) ==13752== by 0x1094B2: parse_file (parse.c:17) ==13752== by 0x10984B: main (parse.c:197) ==13752== Address 0x0 is not stack'd, malloc'd or (recently) free'd This is line 17: while(fgets(line, MAXLINE, fp) != NULL){", "question": "How do I fix this error? Invalid read of size 4 ==13752== at 0x4900657: fgets (iofgets.c:47) ==13752== by 0x1094B2: parse_file (parse.c:17) ==13752== by 0x10984B: main (parse.c:197) ==13752== Address 0x0 is not stack'd, malloc'd or (recently) free'd This is line 17: while(fgets(line, MAXLINE, fp) != NULL){", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Make sure that the last character of a string is not \\n, if it is \\n, delete \\n.", "question": "", "intention": "", "task_description": "Make sure that the last character of a string is not \\n, if it is \\n, delete \\n.", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what might be the reasons of my output missing one line after clearn : | Code context (simplify for kids): main : linked_list.o main.o gcc - Wall - g - std = gnu99 - o main linked_list.o main .o main.o : linked_list.h gcc - Wall - g - std = gnu99 - c main .c linked_list.o : linked_list.c linked_list.h gcc - Wall - g - std = gnu99 - c linked_list.c clean : rm - f linked_list.o rm - f main.o", "question": "what might be the reasons of my output missing one line after clearn :", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Use stat to get the last modified time (mtime) of a file. Read the man page (using man 2 stat) to learn how to call stat. The field of the stat struct that you want is called st_mtim on Linux. The struct timespec st_mtim; has two fields, one for seconds (tv_sec) and one for nanoseconds (tv_nsec). You will need both of these values to find out which time is more recent.", "question": "", "intention": "", "task_description": "Use stat to get the last modified time (mtime) of a file. Read the man page (using man 2 stat) to learn how to call stat. The field of the stat struct that you want is called st_mtim on Linux. The struct timespec st_mtim; has two fields, one for seconds (tv_sec) and one for nanoseconds (tv_nsec). You will need both of these values to find out which time is more recent.", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: go through target_rule's nodes of dependencies and save the last modified time present in any dependency | Code context (simplify for kids): struct stat st; st.st_mtim.tv_sec = 0; struct stat last_mod_time; last_mod_time.st_mtim.tv_sec = 0; while (target_rule->dependencies != NULL){ if(stat(dep->rule->target, &st) == 0){ if(last_mod_time.st_mtim.tv_sec == 0){ last_mod_time = st; } else { if(difftime(st, last_mod_time) > 0){ last_mod_time", "question": "go through target_rule's nodes of dependencies and save the last modified time present in any dependency", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to fix st_mtim: No such file or directory error", "question": "How to fix st_mtim: No such file or directory error", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What header files to include for st_mtim?", "question": "What header files to include for st_mtim?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: How to fix warning: ‘st’ may be used uninitialize, same with 'last_mod_time' and 'target_mod_time' | Code context (simplify for kids): struct stat *st; 53 st->st_mtim.tv_sec = 0; 54 struct stat *last_mod_time; 55 last_mod_time->st_mtim.tv_sec = 0; 56 while (target_rule->dependencies != NULL) { 57 if (stat(dep->rule->target, st) == 0) { 58 if (last_mod_time->st_mtim.tv_sec == 0) { 59 last_mod_time = st; 60 } else { 61 if (last_mod_t", "question": "How to fix warning: ‘st’ may be used uninitialize, same with 'last_mod_time' and 'target_mod_time'", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: I am receiving a st_mtim: No such file or directory error | Code context (simplify for kids): #include struct stat target_mod_time; // struct timespec target_time = target_mod_time->st_mtim; if(stat(target, &target_mod_time) == 0){ printf(\"successfully got target time\"); } else if(stat(target, &target_mod_time) == -1){ perror(\"st_mtim\"); exit(1); } struct stat st; while (target_", "question": "I am receiving a st_mtim: No such file or directory error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Trying to check if target exit with stat | Code context (simplify for kids): struct stat target_exist; stat(target, &target_exist); if(stat(target, &target_exist) != 0){ perror(\"target non-existent\"); exit(1); }", "question": "Trying to check if target exit with stat", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Change this code such that it prints out random numbers from 0 to 99 instead of in that order, use the function random | Code context (simplify for kids): for (int i = 0; i < 100; i++){ fprintf(fp, \"%d\\n\", i); }", "question": "Change this code such that it prints out random numbers from 0 to 99 instead of in that order, use the function random", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: It is giving me an error that buffer may not be initialized. | Code context (simplify for kids): int *buffer; 41 for (;;) { 42 fseek(fp, (rand()%99)*sizeof(int), SEEK_SET); 43 fread(buffer, sizeof(int), 1, fp); 44 45 }", "question": "It is giving me an error that buffer may not be initialized.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How to fix the code giving me an error that buffer may not be initialized. | Code context (simplify for kids): 24 int main(int argc, char **argv) { 25 if (argc != 3) { 26 fprintf(stderr, \"Usage: time_reads s filename\\n\"); 27 exit(1); 28 } 29 seconds = strtol(argv[1], NULL, 10); 30 31 FILE *fp; 32 if ((fp = fopen(argv[2], \"r\")) == NULL) { 33 perror(\"fopen\"); 34 exit(1); 35 } 36 37 /* In an infinite loop, read", "question": "How to fix the code giving me an error that buffer may not be initialized.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Now, use sigactionLinks to an external site. to add a signal handler to your program. Start with something simple that just prints a message to standard out and exits (with termination code 0) when it receives a SIGPROF.", "question": "", "intention": "", "task_description": "Now, use sigactionLinks to an external site. to add a signal handler to your program. Start with something simple that just prints a message to standard out and exits (with termination code 0) when it receives a SIGPROF.", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Fix the code such that the integers printed out are from 0 to 99. Currectly, the integers printed out are 9 digits | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, \"Usage: time_reads s filename\\n\"); exit(1); } seconds = strtol(argv[1], NULL, 10); FILE *fp; if ((fp = fopen(argv[2], \"r\")) == NULL) { perror(\"fopen\"); exit(1); } /* In an infinite loop, read an int from a random location in the file", "question": "Fix the code such that the integers printed out are from 0 to 99. Currectly, the integers printed out are 9 digits", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(void) { int sock_fd = socket(AF_INET, SOCK_STREAM, 0); if (sock_fd < 0) { perror(\"client: socket\"); exit(1); } struct sockaddr_in server; server.sin_family = AF_INET; server.sin_port = htons(PORT); if (inet_pton(AF_INET, \"127.0.0.1\", &server.sin_addr) < 1) { perror(\"client: inet_pton\"); clo", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: There are now two different types of input that we could receive: a username, or a message. How could we tell if we have if we have received a username yet? | Code context (simplify for kids): int read_from(int client_index, struct sockname *users) { int fd = users[client_index].sock_fd; char buf[BUF_SIZE + 1]; int num_read = read(fd, &buf, BUF_SIZE); buf[num_read] = '\\0'; if (num_read == 0 || write(fd, buf, strlen(buf)) != strlen(buf)) { users[client_index].sock_fd = -1; return fd; } ret", "question": "There are now two different types of input that we could receive: a username, or a message. How could we tell if we have if we have received a username yet?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: your task is to modify read_from to see if we have received a username yet (how can we tell?), and allocate memory for the username field in the sockname struct and copy the name to the field for that client. After the username has been set, all new incoming messages from that connection will be messages to echo. | Code context (simplify for kids): int read_from(int client_index, struct sockname *users) { int fd = users[client_index].sock_fd; char buf[BUF_SIZE + 1]; /* In Lab 10, you focused on handling partial reads. For this lab, you do * not need handle partial reads. Because of that, this server program * does not check for \"\\r\\n\" when it ", "question": "your task is to modify read_from to see if we have received a username yet (how can we tell?), and allocate memory for the username field in the sockname struct and copy the name to the field for that client. After the username has been set, all new incoming messages from that connection will be messages to echo.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int read_from(int client_index, struct sockname *users) { int fd = users[client_index].sock_fd; char buf[BUF_SIZE + 1]; int num_read = read(fd, &buf, BUF_SIZE); buf[num_read] = '\\0'; if (num_read == 0 || write(fd, buf, strlen(buf)) != strlen(buf)) { users[client_index].sock_fd = -1; return fd; } ret", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: Write read_from to see if we have received a username yet (how can we tell?), and allocate memory for the username field in the sockname struct and copy the name to the field for that client. After the username has been set, all new incoming messages from that connection will be messages to echo.", "question": "", "intention": "", "task_description": "Write read_from to see if we have received a username yet (how can we tell?), and allocate memory for the username field in the sockname struct and copy the name to the field for that client. After the username has been set, all new incoming messages from that connection will be messages to echo.", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: I am writing code in the server. How do I broadcast to all clients that are connected to this server?", "question": "", "intention": "", "task_description": "I am writing code in the server. How do I broadcast to all clients that are connected to this server?", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How to add to this code such that it will print buf to all of the clients connected to this server? | Code context (simplify for kids): int read_from(int client_index, struct sockname *users) { int fd = users[client_index].sock_fd; char buf[BUF_SIZE + 1]; /* In Lab 10, you focused on handling partial reads. For this lab, you do * not need handle partial reads. Because of that, this server program * does not check for \"\\r\\n\" when it ", "question": "How to add to this code such that it will print buf to all of the clients connected to this server?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How to loop through the users and check if each one is connected? | Code context (simplify for kids): int read_from(int client_index, struct sockname *users) { int fd = users[client_index].sock_fd; char buf[BUF_SIZE + 1]; int num_read = read(fd, &buf, BUF_SIZE); buf[num_read] = '\\0'; if (num_read == 0 || write(fd, buf, strlen(buf)) != strlen(buf)) { users[client_index].sock_fd = -1; return fd; } ret", "question": "How to loop through the users and check if each one is connected?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): while (1) { fd_set listen_fds = all_fds; if (select(max_fd + 1, &listen_fds, NULL, NULL, NULL) == -1) { perror(\"server: select\"); exit(1); } if (FD_ISSET(sock_fd, &listen_fds)) { int client_fd = accept_connection(sock_fd, users); if (client_fd > max_fd) { max_fd = client_fd; } FD_SET(client_fd, &all", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Why does printf(\"[Server] %s\", buf); prints successfully but printf(\"[Server]\"); not print anything?", "question": "Why does printf(\"[Server] %s\", buf); prints successfully but printf(\"[Server]\"); not print anything?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fix printf(\"[Server]\"); such that only [server] is printed?", "question": "How to fix printf(\"[Server]\"); such that only [server] is printed?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Why does it say ‘temp2’ may be used uninitialized in this function line 227? | Code context (simplify for kids): char *temp2; 226 for (int i = 0; i < MAX_FRIENDS && user->friends[i] != NULL; i++) { 227 snprintf(temp2, strlen(user->friends[i]->name + 2), \"%s\\r\\n\", user->friends[i]->name); }", "question": "Why does it say ‘temp2’ may be used uninitialized in this function line 227?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is it printing 0? | Code context (simplify for kids): char *user_string = calloc(sizeof(char) * 171, 1); printf(\"%ld\\n\", strlen(user_string));", "question": "Why is it printing 0?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Why is this code not copying name, friends and posts into user_string? | Code context (simplify for kids): snprintf(user_string, sizeof(user), \"%s%s%s\", name, friends, posts);", "question": "Why is this code not copying name, friends and posts into user_string?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char *argv[]) { 145 int batch_mode = (argc == 2); 146 char input[INPUT_BUFFER_SIZE]; 147 FILE *input_stream; 148 149 150 User *user_list = NULL; 151 152 if (batch_mode) { 153 input_stream = fopen(argv[1], \"r\"); 154 if (input_stream == NULL) { 155 perror(\"Error opening file\"); 156 ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: How can I add code to make this a server where other clients can connect to it?", "question": "", "intention": "", "task_description": "How can I add code to make this a server where other clients can connect to it?", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main() { setbuf(stdout, NULL); struct sockaddr_in *self = init_server_addr(PORT); int listenfd = set_up_server_socket(self, 5); while (1) { int fd = accept_connection(listenfd); if (fd < 0) { continue; } char buf[BUFSIZE] = {'\\0'}; int inbuf = 0; int room = sizeof(buf); char *after = buf; int nb", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How do I change (what do I add, where should I add them, and what should I remove) from this code if I want to change it from local host to hosting on a server? | Code context (simplify for kids): main{ int batch_mode = (argc == 2); char input[INPUT_BUFFER_SIZE]; FILE *input_stream; // Create the heads of the empty data structure User *user_list = NULL; if (batch_mode) { input_stream = fopen(argv[1], \"r\"); if (input_stream == NULL) { perror(\"Error opening file\"); exit(1); } } else { // intera", "question": "How do I change (what do I add, where should I add them, and what should I remove) from this code if I want to change it from local host to hosting on a server?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to solve this two errors? friend_server.c:22:25: error: expected expression before ‘[’ token 22 | int status = setsockopt([sock_fd], SOL_SOCKET, SO_REUSEADDR, | ^ friend_server.c:22:26: error: ‘sock_fd’ undeclared here (not in a function) 22 | int status = setsockopt([sock_fd], SOL_SOCKET, SO_REUSEADDR,", "question": "How to solve this two errors? friend_server.c:22:25: error: expected expression before ‘[’ token 22 | int status = setsockopt([sock_fd], SOL_SOCKET, SO_REUSEADDR, | ^ friend_server.c:22:26: error: ‘sock_fd’ undeclared here (not in a function) 22 | int status = setsockopt([sock_fd], SOL_SOCKET, SO_REUSEADDR,", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the sock fd in this code? | Code context (simplify for kids): int listen_soc = socket(AF_INET, SOCK_STREAM, 0); if (listen_soc == -1) { perror(\"server: socket\"); exit(1); } struct sockaddr_in server; server.sin_family = AF_INET; server.sin_port = htons(54321); memset(&server.sin_zero, 0, 8); server.sin_addr.s_addr = INADDR_ANY; if (bind(listen_soc, (struct soc", "question": "what is the sock fd in this code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How to fix this error error: ‘g’ undeclared (first use in this function) friend_server.c:160:29: note: in expansion of macro ‘PORT’ 160 | server.sin_port = htons(PORT); | ^~~~ : note: each undeclared identifier is reported only once for each function it appears in friend_server.c:160:29: note: in expansion of macro ‘PORT’ 160 | server.sin_port = htons(PORT); | ^~~~ | Code context (simplify for kids): // Create socket int listen_soc = socket(AF_INET, SOCK_STREAM, 0); if (listen_soc == -1) { perror(\"server: socket\"); exit(1); } //initialize server address struct sockaddr_in server; server.sin_family = AF_INET; server.sin_port = htons(PORT); memset(&server.sin_zero, 0, 8); server.sin_addr.s_addr = ", "question": "How to fix this error error: ‘g’ undeclared (first use in this function) friend_server.c:160:29: note: in expansion of macro ‘PORT’ 160 | server.sin_port = htons(PORT); | ^~~~ : note: each undeclared identifier is reported only once for each function it appears in friend_server.c:160:29: note: in expansion of macro ‘PORT’ 160 | server.sin_port = htons(PORT); | ^~~~", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int batch_mode = (argc == 2); char input[INPUT_BUFFER_SIZE]; FILE *input_stream; User *user_list = NULL; if (batch_mode) { input_stream = fopen(argv[1], \"r\"); if (input_stream == NULL) { perror(\"Error opening file\"); exit(1); } } else { input_stream = stdin; } while (fgets(input, INPUT_BUFFER_SIZE, ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: every time a client connects to a server, increment the client_count variable and change curr (which is a specific node in a linked list) to the new client.", "question": "", "intention": "", "task_description": "every time a client connects to a server, increment the client_count variable and change curr (which is a specific node in a linked list) to the new client.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this error: assignment to expression with array type 212 | curr->name = calloc(sizeof(char) * (MAX_NAME + 2), 1);", "question": "How to fix this error: assignment to expression with array type 212 | curr->name = calloc(sizeof(char) * (MAX_NAME + 2), 1);", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): while (fgets(input, INPUT_BUFFER_SIZE, input_stream) != NULL) { if (batch_mode) { printf(\"%s\", input); } char *cmd_argv[INPUT_ARG_MAX_NUM]; int cmd_argc = tokenize(input, cmd_argv); if (cmd_argc > 0 && process_args(cmd_argc, cmd_argv, &user_list) == -1) { break; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How to change the code such that it prints out whether it is an old socket or new socket accordingly? | Code context (simplify for kids): if (FD_ISSET(sock_fd, &listen_fds)) { int client_fd = accept_connection(sock_fd, users); if (client_fd > max_fd) { max_fd = client_fd; } FD_SET(client_fd, &all_fds); write(client_socket, \"What is your user name?\\n\", 24); }", "question": "How to change the code such that it prints out whether it is an old socket or new socket accordingly?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the difference between accept and accept connection in c?", "question": "What is the difference between accept and accept connection in c?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this error? 'User’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 212 | void cleanup_args_for_processing(struct User *user_list, int client_fd)", "question": "How to fix this error? 'User’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 212 | void cleanup_args_for_processing(struct User *user_list, int client_fd)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the problem with this? expected expression before ‘User’ 408 | check_and_add_user(User * user_list, int client_fd); | ^~~~ error: too few arguments to function ‘check_and_add_user’ 408 | check_and_add_user(User * user_list, int client_fd); | ^~~~~~~~~~~~~~~~~~ note: declared here 256 | void check_and_add_user(User *user_list, int client_fd)", "question": "What is the problem with this? expected expression before ‘User’ 408 | check_and_add_user(User * user_list, int client_fd); | ^~~~ error: too few arguments to function ‘check_and_add_user’ 408 | check_and_add_user(User * user_list, int client_fd); | ^~~~~~~~~~~~~~~~~~ note: declared here 256 | void check_and_add_user(User *user_list, int client_fd)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why is it asking for more arguments? function call: check_and_add_user(User *user_list, int client_fd); function header: 256 void check_and_add_user(User *user_list, int client_fd)", "question": "Why is it asking for more arguments? function call: check_and_add_user(User *user_list, int client_fd); function header: 256 void check_and_add_user(User *user_list, int client_fd)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to fix this error invalid type argument of ‘->’ (have ‘fd_set’ {aka ‘struct ’}) 471 | if (curr_client->fd > -1 && FD_ISSET(curr_client->fd, listen_fds))", "question": "How to fix this error invalid type argument of ‘->’ (have ‘fd_set’ {aka ‘struct ’}) 471 | if (curr_client->fd > -1 && FD_ISSET(curr_client->fd, listen_fds))", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): if (FD_ISSET(listen_soc, &listen_fds)) { client_fd = accept_connection(listen_soc, client_list); printf(\"main (test) client fd: %d\\n\", client_fd); if (client_fd == -1) { perror(\"accept\"); return -1; } printf(\"clinet_fd: %d\\n\", client_fd); printf(\"max_fd: %d\\n\", max_fd); Client *client_ptr = find_cli", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This code checks if a new connection has been made on the listening socket. If a new connection has been made, it accepts the connection and adds the new client to the client list. If the client is already in the list, it cleans up the arguments for processing. If the client is not in the list, it prompts the client for their username and adds the user to the user list. It then creates a new clien | Code context (simplify for kids): if (FD_ISSET(listen_soc, &listen_fds)) { client_fd = accept_connection(listen_soc, client_list); printf(\"main (test) client fd: %d\\n\", client_fd); if (client_fd == -1) { perror(\"accept\"); return -1; } printf(\"clinet_fd: %d\\n\", client_fd); printf(\"max_fd: %d\\n\", max_fd); Client *client_ptr = find_cli", "question": "This code checks if a new connection has been made on the listening socket. If a new connection has been made, it accepts the connection and adds the new client to the client list. If the client is already in the list, it cleans up the arguments for processing. If the client is not in the list, it prompts the client for their username and adds the user to the user list. It then creates a new clien", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: How to check if client is already in the list? | Code context (simplify for kids): if (FD_ISSET(listen_soc, &listen_fds)) { client_fd = accept_connection(listen_soc, client_list); printf(\"main (test) client fd: %d\\n\", client_fd); if (client_fd == -1) { perror(\"accept\"); return -1; } printf(\"clinet_fd: %d\\n\", client_fd); printf(\"max_fd: %d\\n\", max_fd); Client *client_ptr = find_cli", "question": "How to check if client is already in the list?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is my code running check_and_add_user even when the client already exist? | Code context (simplify for kids): if (FD_ISSET(listen_soc, &listen_fds)) { client_fd = accept_connection(listen_soc, client_list); printf(\"main (test) client fd: %d\\n\", client_fd); if (client_fd == -1) { perror(\"accept\"); return -1; } printf(\"clinet_fd: %d\\n\", client_fd); printf(\"max_fd: %d\\n\", max_fd); Client *client_ptr = find_cli", "question": "Why is my code running check_and_add_user even when the client already exist?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: return a pointer to the Client structure that corresponds to the given file descriptor, or NULL if no such Client structure exists | Code context (simplify for kids): Client *find_client(int client_fd, const Client *head) { while (head != NULL && head->fd != client_fd) { head = head->next; } return (Client *)head; }", "question": "return a pointer to the Client structure that corresponds to the given file descriptor, or NULL if no such Client structure exists", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: return a pointer to the Client structure that corresponds to the given file descriptor, or NULL if no such Client structure exists | Code context (simplify for kids): Client *find_client(int client_fd, const Client *client_list) { Client *curr = client_list; while (curr != NULL && curr->fd != client_fd) { curr = curr->next; } return (Client *)curr; }", "question": "return a pointer to the Client structure that corresponds to the given file descriptor, or NULL if no such Client structure exists", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this not write even when there is a user->name that is equal name? | Code context (simplify for kids): while (curr->next != NULL) { if (strcmp(curr->name, name) == 0) { write(client_fd, \"Welcome Back\\n\", 13); break; } curr = curr->next; }", "question": "Why does this not write even when there is a user->name that is equal name?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to set input stream as client_socket?", "question": "how to set input stream as client_socket?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What would be the output if this function is ran on (\"list_users\", \"\")? | Code context (simplify for kids): int tokenize(char *cmd, char **cmd_argv) { int cmd_argc = 0; char *next_token = strtok(cmd, DELIM); while (next_token != NULL) { if (cmd_argc >= INPUT_ARG_MAX_NUM - 1) { error(\"Too many arguments!\"); cmd_argc = 0; break; } cmd_argv[cmd_argc] = next_token; cmd_argc++; next_token = strtok(NULL, DELIM)", "question": "What would be the output if this function is ran on (\"list_users\", \"\")?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is strncpy giving me a segmentation fault? | Code context (simplify for kids): for (int i = 0; i < cmd_argc; i++) { char new_str[strlen(cmd_argv[i])]; while (cmd_argv[i][j]) { if (cmd_argv[i][j] != '\\r' && cmd_argv[i][j] != '\\n' && cmd_argv[i][j] != '\\0') { len++; new_str[j] = cmd_argv[i][j]; } strncpy(cmd_argv[i], new_str, len); } }", "question": "why is strncpy giving me a segmentation fault?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to solve (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status", "question": "How to solve (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: why is this code never adding to client_list? | Code context (simplify for kids): if (client_fd > max_fd) { // this is a new socket max_fd = client_fd; write(client_fd, \"What is your user name?\\n\", 24); check_and_add_user(user_list, client_fd, client_list); // add client_fd into client_list Client *new_client = (Client *)malloc(sizeof(Client)); if (new_client == NULL){ perror(\"ma", "question": "why is this code never adding to client_list?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: why is this code never adding to client_list? | Code context (simplify for kids): if (client_fd > max_fd) { // this is a new socket write(client_fd, \"What is your user name?\\n\", 24); check_and_add_user(user_list, client_fd, client_list); // add client_fd into client_list Client *new_client = (Client *)malloc(sizeof(Client)); if (new_client == NULL){ perror(\"malloc\"); exit(1); } n", "question": "why is this code never adding to client_list?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int write_inode(char *filename int index, char *name, int offset, int length) { Inode inode; FILE *fs = fopen(filenname, \"r+\"); strncpy(inode.name, name, MAXNAME); inode.offset = offset; inode.length = length; if (fseek(fs, index * sizeof(Inode), SEEK_SET) == -1) { perror(\"fseek\"); return -1; }; fwr", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why does it print nothing and exit when stdin gets -1? | Code context (simplify for kids): #include int main() { char phone[11]; int integer; scanf(\"%s\", phone); scanf(\"%d\", &integer); while (integer != EOF) { if (integer == -1) { for (int i = 0; i < 10; i++) { printf(\"%c\", phone[i]); } printf(\"\\n\"); } else if (integer > -1 && integer < 10) { printf(\"%c\\n\", phone[integer]); } el", "question": "why does it print nothing and exit when stdin gets -1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): Rule *curr = rules; // want to iterate to end of rules while (curr->next_rule != NULL) { curr = curr->next_rule; } // curr->next_rule == NULL curr->next_rule = new_rule; // insert new rule to end of rules", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: insert new rule to the end of rules | Code context (simplify for kids): Rule *curr = rules; // want to iterate to end of rules while (curr->next_rule != NULL) { curr = curr->next_rule; } // curr->next_rule == NULL curr->next_rule = new_rule; // insert new rule to end of rules", "question": "insert new rule to the end of rules", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: insert new rule to end of rules | Code context (simplify for kids): if (rules == NULL) {rules = new_rule;} // if rules == NULL, new_rule becomes first rule else { // if rules != NULL Rule *curr = rules; // want to iterate to end of rules while (curr->next_rule != NULL) { curr = curr->next_rule; } // curr->next_rule == NULL curr->next_rule = new_rule; // insert new r", "question": "insert new rule to end of rules", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): char *ch = \"S\";", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Declare a char variable named ch and set its value to the first letter of your own name.", "question": "Declare a char variable named ch and set its value to the first letter of your own name.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): *delicious = \"ice cream\";", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Set the value of delicious (which has already been declared) to \"ice cream\".", "question": "Set the value of delicious (which has already been declared) to \"ice cream\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: The string sweet has been declared on the heap and has space for 20 characters. Set the value of sweet to \"tiramisu\" without changing its address.", "question": "The string sweet has been declared on the heap and has space for 20 characters. Set the value of sweet to \"tiramisu\" without changing its address.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `typedef struct node { int value; struct node *next; } node;` with usage examples and explanations", "question": "generate a detailed documentation of `typedef struct node { int value; struct node *next; } node;` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Write a loop which traverses a linked list starting at front and prints the value of each node in the list.", "question": "Write a loop which traverses a linked list starting at front and prints the value of each node in the list.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Which of these scenarios cause a memory leak?", "question": "Which of these scenarios cause a memory leak?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Define a string literal called season that has the value \"winter\". Define a stack-allocated string called holiday that has space for 20 characters including the null terminator. Set its initial value to \"Valentine's Day\".", "question": "Define a string literal called season that has the value \"winter\". Define a stack-allocated string called holiday that has space for 20 characters including the null terminator. Set its initial value to \"Valentine's Day\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: The difference between stack-allocated string and heap-allocated string", "question": "The difference between stack-allocated string and heap-allocated string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What will be the output of the following program fragment? | Code context (simplify for kids): #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf(\"pay is %d\\n\", (hours_worked * SUPERVISOR(regular_pay))); // rest omitted }", "question": "What will be the output of the following program fragment?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? (You do not need to include the options to display warnings, build the symbol table for the debugger or select the C standard.) | Code context (simplify for kids): #include int main() { #ifdef MACRO printf(\"%d\\n\", MACRO); #endif return 0; }", "question": "What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? (You do not need to include the options to display warnings, build the symbol table for the debugger or select the C standard.)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: suppose we have the following line at the top of our program #define MAXNAME = 32; and then the declaration char name[MAXNAME]; in the program. What will this declaration line become after the program has passed through the C pre-processor?", "question": "suppose we have the following line at the top of our program #define MAXNAME = 32; and then the declaration char name[MAXNAME]; in the program. What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Which of the following functions are system calls? exit() fgets() fopen() printf() read() scanf() write()", "question": "Which of the following functions are system calls? exit() fgets() fopen() printf() read() scanf() write()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Which of the following functions are library calls? exit() fgets() fopen() printf() read() scanf() write()", "question": "Which of the following functions are library calls? exit() fgets() fopen() printf() read() scanf() write()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What will this declaration line become after the program has passed through the C pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; char name[MAXNAME];", "question": "What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: What will this declaration line become after the program has passed through the C pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; char name[MAXNAME];", "question": "", "intention": "What will this declaration line become after the program has passed through the C pre-processor?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * Change the filename for the profile pic of the given user. * * Return: * - 0 on success. * - 1 if the file does not exist or cannot be opened. * - 2 if the filename is too long. */ | Code context (simplify for kids): int update_pic(User *user, const char *filename) { return -1; }", "question": "", "intention": "/* * Change the filename for the profile pic of the given user. * * Return: * - 0 on success. * - 1 if the file does not exist or cannot be opened. * - 2 if the filename is too long. */", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): User *find_user(const char *name, const User *head) { for (User *ptr = (User *)head; ptr != NULL; ptr = ptr->next) { if (strcmp(ptr->name, name) == 0) { return ptr; } } return NULL; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void printPicture(const User *user) { //if they have no profile picture we can just return since there is nothing //to print at all. if (strlen(user->profile_pic) <= 0) { return; } //continues onward because there is something that is larger than 0, //in the profile pic object. FILE *picture = fopen", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: remove all the posts in the linked list. | Code context (simplify for kids): void printPicture(const User *user) { //if they have no profile picture we can just return since there is nothing //to print at all. if (strlen(user->profile_pic) <= 0) { return; } //continues onward because there is something that is larger than 0, //in the profile pic object. FILE *picture = fopen", "question": "", "intention": "remove all the posts in the linked list.", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void removePosts(Post *post) { //if the user has no posts then return because there is nothing to free. if (!post) { return; } //recursive function until we run out of posts to free. removePosts(post->next); //free the memory for the contents of the posts free(post->contents); free(post); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): /*Purges the user from the friends list of all users in the targets list.*/ void unAddfriend(User *exiledFriend, const User *user) { if (!exiledFriend) { return; } int difference, iterator = 0; for (iterator = 0; iterator < MAX_FRIENDS && exiledFriend->friends[iterator]; iterator++) { if (exiledFrie", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { int friendstatus = 0; User *friendo1 = find_user(name1, head); User *friendo2 = find_user(name2, head); if (friendo1 == NULL || friendo2 == NULL) { friendstatus = 4; } else if (friendo1 == friendo2) { friendstatus = 3; } int a; for", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: initialise two variables with the same initial value. | Code context (simplify for kids): int difference, iterator = 0;", "question": "", "intention": "initialise two variables with the same initial value.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Make a new post from 'author' to the 'target' user, * containing the given contents, IF the users are friends. * * Insert the new post at the *front* of the user's list of posts. * * 'contents' is a pointer to heap-allocated memory - you do not need * to allocate more memory to store the contents of the post. * * Return: * - 0 on success * - 1 if users exist but are not friends * - 2 if either Use | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents)", "question": "", "intention": "Make a new post from 'author' to the 'target' user, * containing the given contents, IF the users are friends. * * Insert the new post at the *front* of the user's list of posts. * * 'contents' is a pointer to heap-allocated memory - you do not need * to allocate more memory to store the contents of the post. * * Return: * - 0 on success * - 1 if users exist but are not friends * - 2 if either Use", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Select the sentence fragments that complete this sentence so that it is true. When one process forks another: the process that calls fork is called the parent and the newly-created process is the child. the code segments of the two processes are identical. the values of all the variables of the two processes are identical. the two processes have all the same variables but each process has its own ", "question": "Select the sentence fragments that complete this sentence so that it is true. When one process forks another: the process that calls fork is called the parent and the newly-created process is the child. the code segments of the two processes are identical. the values of all the variables of the two processes are identical. the two processes have all the same variables but each process has its own ", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: A parent process with pid 1123 forks a child process with pid 1126. In the child process, what is the return value of fork()?", "question": "A parent process with pid 1123 forks a child process with pid 1126. In the child process, what is the return value of fork()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: A parent process with pid 1123 forks a child process with pid 1126. In the parent process, what is the return value of fork()?", "question": "A parent process with pid 1123 forks a child process with pid 1126. In the parent process, what is the return value of fork()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: On teach.cs, you can run man 2 wait to learn about the wait system call. Which macro is used with wait's status to check if the child process was terminated by a signal?", "question": "On teach.cs, you can run man 2 wait to learn about the wait system call. Which macro is used with wait's status to check if the child process was terminated by a signal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { int iterations; if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } //Get the parent id int parentPID = getpid(); iterations = strtol(argv[1], NULL, 10); for (int loopval; = 0; loo", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { //iterations is an integer that stores //the number of iterations the program will run int loopval, iterations; if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int forked; //it", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include #include int main(int argc, char **argv) { int iterations, loopval, status; if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } iterations = strtol(argv[1], NULL, 10); for (loopval = 0; loopval < itera", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include #include int main(int argc, char **argv) { int iterations, loopval, status; if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } iterations = strtol(argv[1], NULL, 10); for (loopval = 0; loopval < itera", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Assume the following program which compiles and runs without error. What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C? | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); // POSITION A struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); // POSITION B x += 2; // POSITION C fprintf", "question": "Assume the following program which compiles and runs without error. What does the program print to stderr if the user presses Ctrl+C at the moment when the program is at position C?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Assume the following code runs without error. | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); // POSITION A struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); // POSITION B x += 2; // POSITION C fprintf", "question": "Assume the following code runs without error.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Variable x has been assigned a digit between 1 and 10. Write a shell command to calculate x minus 1 and display the result to standard output.", "question": "Variable x has been assigned a digit between 1 and 10. Write a shell command to calculate x minus 1 and display the result to standard output.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Variables width and height have been initialized. Calculate the area of a rectangle using width and height, and assign the resulting value to a variable named area.", "question": "Variables width and height have been initialized. Calculate the area of a rectangle using width and height, and assign the resulting value to a variable named area.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is string in C?", "question": "what is string in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the error \"zsh: trace trap\"", "question": "what is the error \"zsh: trace trap\"", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the memset syntax?", "question": "What is the memset syntax?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: swap num1 and num2 | Code context (simplify for kids): void swapA(int *num1, int *num2) { int *temp = num1; num1 = num2; num2 = temp; }", "question": "", "intention": "swap num1 and num2", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): void swapA(int *num1, int *num2) { int *temp = num1; num1 = num2; num2 = temp; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include int main() { printf(\"Hello, World!\\n\"); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to get a human-readable representation of the date and time of each post in the format, \"Friday Jan 27 23:01:00 2023\" using time and ctime functions?", "question": "how to get a human-readable representation of the date and time of each post in the format, \"Friday Jan 27 23:01:00 2023\" using time and ctime functions?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `time` with usage examples and explanations", "question": "generate a detailed documentation of `time` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Why is time and ctime not giving me the current time but an arbitrary time?", "question": "Why is time and ctime not giving me the current time but an arbitrary time?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: generate a detailed documentation of `time` with usage examples and explanations", "question": "generate a detailed documentation of `time` with usage examples and explanations", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I use time to get the current time? Not the time since epoch?", "question": "how do I use time to get the current time? Not the time since epoch?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use stat?", "question": "how to use stat?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I append to a list in C?", "question": "how do I append to a list in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this do? | Code context (simplify for kids): char *result[2];", "question": "what does this do?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: can you show me a visual representation? | Code context (simplify for kids): char *result[2];", "question": "can you show me a visual representation?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): struct pixel **pixels = read_pixel_array(image, pixel_array_offset, width, height);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to allocate space on stack for many values?", "question": "how to allocate space on stack for many values?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: an array of pointers to structs", "question": "an array of pointers to structs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to traverse a linked list to find a specific struct", "question": "how to traverse a linked list to find a specific struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain fork()", "question": "explain fork()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char **argv) { // Declare any variables you need int fd[argc][2]; int one_value; // Write the code to loop over the command line arguments for (int i = 1; i < argc; i++) { // Call pipe before we fork if (pipe(fd[i]) == -1) { perror(\"pipe\"); exit(1); } // Call fork int result = for", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: when would we ever get to the else branch | Code context (simplify for kids): int main(int argc, char **argv) { // Declare any variables you need int fd[argc][2]; int one_value; // Write the code to loop over the command line arguments for (int i = 1; i < argc; i++) { // Call pipe before we fork if (pipe(fd[i]) == -1) { perror(\"pipe\"); exit(1); } // Call fork int result = for", "question": "when would we ever get to the else branch", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: STDIN_FILENO what is that", "question": "STDIN_FILENO what is that", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: STDIN_FILENO what is that", "question": "STDIN_FILENO what is that", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is excel", "question": "what is excel", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: excel() funtion", "question": "excel() funtion", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: execl() what is it?", "question": "execl() what is it?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does dup2 work", "question": "how does dup2 work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are argyments to pipe", "question": "what are argyments to pipe", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a file in a directory exists?", "question": "how to check if a file in a directory exists?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how are makefiles evaluated", "question": "how are makefiles evaluated", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you use printf on an array of char pointers?", "question": "can you use printf on an array of char pointers?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does execvp work", "question": "how does execvp work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use stat to get the last modified time of a file", "question": "how to use stat to get the last modified time of a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is struct timespec;", "question": "what is struct timespec;", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I use the tv_sec member of stat.st_mtim?", "question": "how do I use the tv_sec member of stat.st_mtim?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is this code chunk doing | Code context (simplify for kids): // Set the IP and port of the server to connect to. struct sockaddr_in server; server.sin_family = AF_INET; server.sin_port = htons(PORT); if (inet_pton(AF_INET, \"127.0.0.1\", &server.sin_addr) < 1) { perror(\"client: inet_pton\"); close(sock_fd); exit(1); }", "question": "what is this code chunk doing", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: explain asprintf and snprintf and their differences", "question": "explain asprintf and snprintf and their differences", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are the arguments to asprintf()", "question": "what are the arguments to asprintf()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I want to dynamically alocate a string that keeps appending charcters to the buffer with asprintf()", "question": "I want to dynamically alocate a string that keeps appending charcters to the buffer with asprintf()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there a way to use asprintf and continually append to the same character buffer?", "question": "is there a way to use asprintf and continually append to the same character buffer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int accept_connection(int listenfd) { struct sockaddr_in peer; unsigned int peer_len = sizeof(peer); peer.sin_family = AF_INET; fprintf(stderr, \"Waiting for a new connection...\\n\"); int client_socket = accept(listenfd, (struct sockaddr *)&peer, &peer_len); if (client_socket < 0) { perror(\"accept\"); ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): while (fgets(input, INPUT_BUFFER_SIZE, input_stream) != NULL) { // only echo the line in batch mode since in interactive mode the user // just typed the line if (batch_mode) { printf(\"%s\", input); } char *cmd_argv[INPUT_ARG_MAX_NUM]; int cmd_argc = tokenize(input, cmd_argv); if (cmd_argc > 0 && proc", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char *argv[]) { int batch_mode = (argc == 2); char input[INPUT_BUFFER_SIZE]; FILE *input_stream; // Create the heads of the empty data structure User *user_list = NULL; if (batch_mode) { input_stream = fopen(argv[1], \"r\"); if (input_stream == NULL) { perror(\"Error opening file\"); ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): upper=$1 #we need the double quotes in case the filename has a space filename=\"$2\" for i in `seq 1 $upper` do #note that we need to double quotes here as well around filename if /u/csc209h/winter/pub/shell-prog/floop $i \"$filename\" > /dev/null then echo $i and $filename are a floopy combination fi d", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): upper=$1 #we need the double quotes in case the filename has a space filename=\"$2\" for i in `seq 1 $upper` do #note that we need to double quotes here as well around filename if /u/csc209h/winter/pub/shell-prog/floop $i \"$filename\" > /dev/null then echo $i and $filename are a floopy combination fi d", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int i; while((scanf(%d), i) != EOF){ }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int i; while((scanf(%d), i) != EOF){ printf(i) }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): NumberOfElements = sizeof(arr)/sizeof(arr[0]);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print user information, fix set fault | Code context (simplify for kids): int print_user(const User *user) { // characters to get from file char line[81]; FILE *pfp; // int error; int valid_pfp = 1; // checks if pfp can be accessed // checks if user doesn't exist if (user == NULL) { return 1; } // checking if error opening file pfp = fopen(user->profile_pic, \"r\"); if (pfp", "question": "", "intention": "print user information, fix set fault", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: segmentation fault | Code context (simplify for kids): int print_user(const User *user) { // characters to get from file char line[81]; FILE *pfp; // int error; int valid_pfp = 1; // checks if pfp can be accessed // checks if user doesn't exist if (user == NULL) { return 1; } // checking if error opening file pfp = fopen(user->profile_pic, \"r\"); if (pfp", "question": "", "intention": "segmentation fault", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: recursively run the function | Code context (simplify for kids): Dependency *curr_dep = rule_eval->dependencies; while (curr_dep != NULL) { // evaluate dependencies if (curr_dep->rule->actions != NULL) { if (stat(rule_eval->target, &target_time) == -1){ run_make(curr_dep->rule->target, rules, pflag); } else { // check times printf(\"FOUND FILE\\n\"); if (stat(curr_d", "question": "recursively run the function", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): while (1) { fd_set listen_fds = all_fds; if (select(max_fd + 1, &listen_fds, NULL, NULL, NULL) == -1) { perror(\"server: select\"); exit(1); } if (FD_ISSET(sock_fd, &listen_fds)) { int client_fd = accept_connection(sock_fd, users); if (client_fd > max_fd) { max_fd = client_fd; } FD_SET(client_fd, &all", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: when using asprintf multiple times with the same buffer is it neccessary to free memory multiple times or just once at the end", "question": "when using asprintf multiple times with the same buffer is it neccessary to free memory multiple times or just once at the end", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: return int ** | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "", "intention": "return int **", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to declare a pointer to point to dynamically allocated arrays", "question": "how to declare a pointer to point to dynamically allocated arrays", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to access elements from a pointer that points to an array", "question": "how to access elements from a pointer that points to an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to store something on the heap", "question": "how to store something on the heap", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to store an array on the heap", "question": "how to store an array on the heap", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why is s being changed? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } printf(\"OMG: %d\\n\", s[0]); printf(\"OMG: %d\\n\", s[1]); printf(\"OMG: %d\\n\", s[2]); int *array1 = malloc(sizeof(int) * num_evens)", "question": "", "intention": "why is s being changed?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: is s being changed? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "", "intention": "is s being changed?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: s does not change | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "", "intention": "s does not change", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does s change? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "does s change?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what are the values of s in the beginning? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "what are the values of s in the beginning?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: should s change at the end of the code? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "should s change at the end of the code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: where is s, array1, and array2 stored? | Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "where is s, array1, and array2 stored?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: write code to return a pointer to an array of two dynamically allocated arrays of ints. The first array contains the elements of the input array s that are at even indices. The second array contains the elements of the input array s that are at odd indices.", "question": "", "intention": "", "task_description": "write code to return a pointer to an array of two dynamically allocated arrays of ints. The first array contains the elements of the input array s that are at even indices. The second array contains the elements of the input array s that are at odd indices.", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int **split_array(const int *s, int length) { int num_evens; int num_odds = length / 2; if (length % 2 == 0){ num_evens = length / 2; } else{ num_evens = (length / 2) + 1; } int *array1 = malloc(sizeof(int) * num_evens); int *array2 = malloc(sizeof(int) * num_odds); int count1 = 0; int count2 = 0; f", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you declare an array of chars?", "question": "How do you declare an array of chars?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you declare an array of chars of unknown size?", "question": "how do you declare an array of chars of unknown size?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to copy a string to an empty string", "question": "How to copy a string to an empty string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to declare empty string as destination string to for strcpy?", "question": "How to declare empty string as destination string to for strcpy?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to allocate space for 5 `struct pixel *` values", "question": "How to allocate space for 5 `struct pixel *` values", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to store two dimensional array on heap", "question": "How to store two dimensional array on heap", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is code to store two dimensional array on heap", "question": "What is code to store two dimensional array on heap", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to declare a pointer to the current date?", "question": "How to declare a pointer to the current date?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to get the current date?", "question": "How to get the current date?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: #define MAXNAME = 32; and then the declaration char name[MAXNAME]; What will this declaration line become after the program has passed through the C pre-processor?", "question": "#define MAXNAME = 32; and then the declaration char name[MAXNAME]; What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What will the declaration on line 2 become after the program has passed through the C pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; char name[MAXNAME];", "question": "What will the declaration on line 2 become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the output? | Code context (simplify for kids): #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf(\"pay is %d\\n\", (hours_worked * SUPERVISOR(regular_pay))); // rest omitted }", "question": "What is the output?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the output? | Code context (simplify for kids): #define SUPERVISOR(regular) regular + 5 #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf(\"pay is %d\\n\", (hours_worked * SUPERVISOR(regular_pay))); // rest omitted }", "question": "What is the output?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to declare strings", "question": "how to declare strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use fread?", "question": "how to use fread?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: using SEEK_CUR of fread", "question": "using SEEK_CUR of fread", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How can I use the line of a file as the arguments to my c program in a shell script", "question": "How can I use the line of a file as the arguments to my c program in a shell script", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: copy the contents of second_one into my_string | Code context (simplify for kids): #include #include int main(){ char * my_string; char * second_one = \"hola mundo\"; strcpy(my_string, second_one); printf(\"%s\\n\", my_string); return 0; }", "question": "", "intention": "copy the contents of second_one into my_string", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: if the file exists set target_time to the st_mtime which is a struct | Code context (simplify for kids): struct stat sb; struct stat sb_dep; struct timespec * target_time = NULL; struct timespec dependency_time; int status; if(access(target, F_OK) == 0){ if (stat(target, &sb) == -1) { perror(\"stat\"); exit(1); } printf(\"line test\\n\"); *(target_time) = sb.st_mtim; }", "question": "if the file exists set target_time to the st_mtime which is a struct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: how to use struct timespec st_mtim; to get the most recent file between two files", "question": "", "intention": "", "task_description": "how to use struct timespec st_mtim; to get the most recent file between two files", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is Fseek", "question": "What is Fseek", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to open a file", "question": "how to open a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if opening file caused error", "question": "how to check if opening file caused error", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: read contents in a file", "question": "read contents in a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is there a segmentation fault here | Code context (simplify for kids): FILE *picture = fopen(user->profile_pic, \"r\");", "question": "is there a segmentation fault here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Supposed to read the contents in the file picture and print it | Code context (simplify for kids): if (user->profile_pic != NULL){ FILE *picture = fopen(user->profile_pic, \"r\"); if (picture != NULL){ char line[32]; while(fgets(line, sizeof(line), picture) != NULL){ printf(\"%s\\n\", line); } } fclose(picture); }", "question": "", "intention": "Supposed to read the contents in the file picture and print it", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: ==41828== Syscall param openat(filename) points to uninitialised byte(s) what does this mean", "question": "==41828== Syscall param openat(filename) points to uninitialised byte(s) what does this mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Fix this error Syscall param openat(filename) points to uninitialised byte(s) | Code context (simplify for kids): if (user->profile_pic != NULL){ FILE *picture = fopen(user->profile_pic, \"r\"); if (picture != NULL){ char line[32]; while(fgets(line, sizeof(line), picture) != NULL){ printf(\"%s\\n\", line); } fclose(picture); } }", "question": "Fix this error Syscall param openat(filename) points to uninitialised byte(s)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Does it matter if I read the file in chunks of 32 bits | Code context (simplify for kids): if (user->profile_pic != NULL){ FILE *picture = fopen(user->profile_pic, \"r\"); if (picture != NULL){ char line[32]; while(fgets(line, sizeof(line), picture) != NULL){ printf(\"%s\\n\", line); } fclose(picture); } }", "question": "Does it matter if I read the file in chunks of 32 bits", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Should I change the fgets to 1 bit | Code context (simplify for kids): if (user->profile_pic != NULL){ FILE *picture = fopen(user->profile_pic, \"r\"); if (picture != NULL){ char line[32]; while(fgets(line, sizeof(line), picture) != NULL){ printf(\"%s\\n\", line); } fclose(picture); } }", "question": "Should I change the fgets to 1 bit", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: If I do not know the number of characters in a file, but need to use fgets. What should the second parameter be", "question": "If I do not know the number of characters in a file, but need to use fgets. What should the second parameter be", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: I dont see why I am getting a Invalid read of size 8 error on line 8 | Code context (simplify for kids): User *curr = (User*) target->friends; int friends = 0; while (curr != NULL){ // Boolean = 1 if they are friends if (strcmp(author->name, target->name) == 0/){ friends = 1; } curr = curr->next; }", "question": "I dont see why I am getting a Invalid read of size 8 error on line 8", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I am supposed to put new_post in the beginning of the target->first_post and I need help with malloc | Code context (simplify for kids): new_post->next = target->first_post; target->first_post = new_post;", "question": "", "intention": "I am supposed to put new_post in the beginning of the target->first_post and I need help with malloc", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: This is causing the new post to be added countless times | Code context (simplify for kids): // Put post at front if (target->first_post == NULL){ target->first_post = malloc(sizeof(Post)); target->first_post = new_post; } else{ Post *curr_first = (Post*) malloc(sizeof(Post)); curr_first = target->first_post; target->first_post = new_post; target->first_post->next = curr_first; }", "question": "", "intention": "This is causing the new post to be added countless times", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I want it to add the new post at the beginning of the target->first_post | Code context (simplify for kids): // Put post at front if (target->first_post == NULL){ target->first_post = new_post; } else{ Post *curr_first = target->first_post; target->first_post = new_post; target->first_post->next = curr_first; }", "question": "", "intention": "I want it to add the new post at the beginning of the target->first_post", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): // Assign space for new post Post *new_post = (Post*) malloc(sizeof(Post)); // Initialize poster strncpy(new_post->author, author->name, MAX_NAME - 1); new_post->author[MAX_NAME-1] = '\\0'; // Initialize content new_post->contents = malloc(sizeof(contents)) ; long size_content = strlen(contents); str", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: The code above creates a new post, initializes its author, contents, and date, and then puts the post at the front of the list of posts for the target user. | Code context (simplify for kids): // Assign space for new post Post *new_post = (Post*) malloc(sizeof(Post)); // Initialize poster strncpy(new_post->author, author->name, MAX_NAME - 1); new_post->author[MAX_NAME-1] = '\\0'; // Initialize content new_post->contents = malloc(sizeof(contents)) ; long size_content = strlen(contents); str", "question": "", "intention": "The code above creates a new post, initializes its author, contents, and date, and then puts the post at the front of the list of posts for the target user.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I print a time_t data", "question": "how do I print a time_t data", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: print from a time_t *", "question": "print from a time_t *", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): /printf(\"Posts:\\n\"); Post *curr = user->first_post; while (curr != NULL){ printf(\"From: %s\\n\", curr->author); printf(\"Date: %s\\n\", ctime(curr->date)); printf(\"\\n\"); printf(\"%s\\n\", curr->contents); if (curr->next != NULL){ printf(\"\\n\"); printf(\"===\"); printf(\"\\n\"); } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why am I getting a curr may not be initialized error | Code context (simplify for kids): // Print post list printf(\"Posts:\\n\"); Post *curr = user->first_post; while (curr != NULL){ printf(\"From: %s\\n\", curr->author); printf(\"Date: %s\\n\", ctime(curr->date)); printf(\"%s\\n\", curr->contents); if (curr->next != NULL){ printf(\"\\n\"); printf(\"===\"); printf(\"\\n\"); } curr = curr->next; } printf(\"", "question": "Why am I getting a curr may not be initialized error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I use calloc", "question": "How do I use calloc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Can you spot the conditional move depends on uninitialized error here | Code context (simplify for kids): if (user->first_post){ curr = user->first_post; } while (curr != NULL){ if (curr != user->first_post){ printf(\"\\n\"); printf(\"===\\n\"); printf(\"\\n\"); } printf(\"From: %s\\n\", curr->author); printf(\"Date: %s\\n\", ctime(curr->date)); printf(\"%s\\n\", curr->contents); curr = curr->next; } printf(\"------------", "question": "Can you spot the conditional move depends on uninitialized error here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Are there any issues | Code context (simplify for kids): while (curr != NULL){ if (curr != user->first_post){ printf(\"\\n\"); printf(\"===\\n\"); printf(\"\\n\"); } printf(\"From: %s\\n\", curr->author); printf(\"Date: %s\\n\", ctime(curr->date)); printf(\"%s\\n\", curr->contents); curr = curr->next; } printf(\"------------------------------------------\\n\");", "question": "Are there any issues", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): // Go through all the user's posts and free memory allocated for it Post *posts = NULL; Post *prev_post = to_delete->first_post; while (prev_post != NULL){ posts = prev_post; free(posts->contents); free(posts->date); prev_post = prev_post->next; free(posts); } // Free user itself's memory free(to_de", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I have a never terminating loop here | Code context (simplify for kids): // Go through all the user's posts and free memory allocated for it Post *posts = NULL; Post *prev_post = to_delete->first_post; while (prev_post != NULL){ posts = prev_post; free(posts->contents); free(posts->date); prev_post = prev_post->next; free(posts); } // Free user itself's memory free(to_de", "question": "", "intention": "I have a never terminating loop here", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: It is supposed to act like strncopy | Code context (simplify for kids): // Allocate Null space to all the characters in dest memset(dest, '\\0', capacity); // Go through the src string and copy characters int i = 0; for (i; i < (capacity-1); i++){ if (src[i] != '\\0'){ dest[i] = src[i]; } } return dest;", "question": "", "intention": "It is supposed to act like strncopy", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: The code is not outputting Welcome.\\r\\n even though its a new user | Code context (simplify for kids): // New user if (found == 0){ // Welcome the client char *message = \"Welcome.\\r\\n\"; write(new_user->fd, message, strlen(message)); // Note down the name strncpy(new_user->name, buf, strlen(new_user->name)); new_user->name[31] = '\\0'; } }", "question": "The code is not outputting Welcome.\\r\\n even though its a new user", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i ignore a line of input using scanf", "question": "how do i ignore a line of input using scanf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the complexity of this code | Code context (simplify for kids): AVL_Node* search(AVL_Node* node, int key) { //*** if (node == NULL) { return NULL; } if (key == node->key) { return node; } if (key < node->key) { return search(node->left, key); } return search(node->right, key); }", "question": "what is the complexity of this code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: pseudocode for avl insert?", "question": "pseudocode for avl insert?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what are processes in C", "question": "what are processes in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does dup2 do", "question": "what does dup2 do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a file descriptor", "question": "what is a file descriptor", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: lldb is telling me line 3 is causing a segfault. how do i fix this | Code context (simplify for kids): target = malloc(sizeof(char) * (strchr(makefile_line, ':') - makefile_line)); strncpy(target, makefile_line, strchr(makefile_line, ':') - makefile_line - 1); target[strchr(makefile_line, ':') - makefile_line - 1] = '\\0';", "question": "lldb is telling me line 3 is causing a segfault. how do i fix this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is this | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { Edge *min = extractMin(records->heap); records->finished[min->toVertex] = true; if (min->fromVertex != min->toVertex) { addTreeEdge(records, records->numTreeEdges, min->fromVertex, min->toVertex, min->weight); } Ad", "question": "what algorithm is this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you implement dijkstra's algorithm", "question": "how do you implement dijkstra's algorithm", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is this | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); for (int i = 0; i < graph->numVertices; i++) { Edge *min = extractMin(records->heap); records->finished[min->toVertex] = true; if (min->fromVertex != min->toVertex) { addTreeEdge(records, records->numTreeEdges, min->fromVertex, min->toVertex, min->", "question": "what algorithm is this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: consider these two functions | Code context (simplify for kids): Records *initRecords(Graph *graph, int startVertex) { Records *records = malloc(sizeof(Records)); records->numVertices = graph->numVertices; records->heap = initHeap(graph, startVertex); records->finished = malloc(sizeof(bool) * graph->numVertices); records->predecessors = malloc(sizeof(int) * graph", "question": "consider these two functions", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is getPaths returning here | Code context (simplify for kids): Edge *getShortestPaths(Graph *graph, int startVertex) { Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { Edge *min = extractMin(records->heap); records->finished[min->toVertex] = true; if (min->fromVertex != min->toVertex) { addTreeEdge(records, records->numTreeE", "question": "what is getPaths returning here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm(s) are being displayed here | Code context (simplify for kids): Edge *getShortestPaths(Graph *graph, int startVertex) { Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { Edge *min = extractMin(records->heap); records->finished[min->toVertex] = true; if (min->fromVertex != min->toVertex) { addTreeEdge(records, records->numTreeE", "question": "what algorithm(s) are being displayed here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { Edge *min = extractMin(records->heap); records->finished[min->toVertex] = true; if (min->fromVertex != min->toVertex) { addTreeEdge(records, records->numTreeEdges, min->fromVertex, min->toVertex, min->weight); } Ad", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm does this use | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { HeapNode *min = extractMin(records->heap); records->finished[min->edge.toVertex] = true; if (min->edge.fromVertex != min->edge.toVertex) { addTreeEdge(records, records->numTreeEdges, min->edge.fromVertex, min->edge", "question": "what algorithm does this use", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm does this use | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->head)) { HeapNode min = extractMin(records->heap); records->finished[min.id] = true; addTreeEdge(records, records->numTreeEdges, min.id, records->predecessors[min.id], min.priority); AdjList *neighbors = graph->vertices[min", "question": "what algorithm does this use", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm does this use | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { Heapnode min = extractMin(records->heap); records->finished[min.id] = true; addTreeEdge(records, records->numTreeEdges, min.id, records->predecessors[min.id], min.priority); AdjList *neighbors = graph->vertices[min", "question": "what algorithm does this use", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is being implemented here | Code context (simplify for kids): Records *asdfg123 = initRecords(graph, startVertex); while (!isEmpty(asdfg123->heap)) { HeapNode min = extractMin(asdfg123->heap); asdfg123->finished[min.id] = true; addTreeEdge(asdfg123, asdfg123->numTreeEdges, min.id, asdfg123->predecessors[min.id], min.priority); AdjList *neighbours = graph->vert", "question": "what algorithm is being implemented here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is being used here | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { HeapNode min = extractMin(records->heap); records->finished[min.id] = true; addTreeEdge(records, records->numTreeEdges, min.id, records->predecessors[min.id], min.priority); AdjList *neighbors = graph->vertices[min", "question": "what algorithm is being used here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: which algorithm is (1) using and which algorithm is (2) using? | Code context (simplify for kids): (1) Records *asdfg123 = initRecords(graph, startVertex); while (!isEmpty(asdfg123->heap)) { HeapNode min = extractMin(asdfg123->heap); asdfg123->finished[min.id] = true; addTreeEdge(asdfg123, asdfg123->numTreeEdges, min.id, asdfg123->predecessors[min.id], min.priority); AdjList *neighbours = graph->", "question": "which algorithm is (1) using and which algorithm is (2) using?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is this | Code context (simplify for kids): Records *records = initRecords(graph, startVertex); while (!isEmpty(records->heap)) { HeapNode min = extractMin(records->heap); records->finished[min.id] = true; addTreeEdge(records, records->numTreeEdges, min.id, records->predecessors[min.id], min.priority); AdjList *neighbors = graph->vertices[min", "question": "what algorithm is this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what algorithm is this | Code context (simplify for kids): Records *asdfg123 = initRecords(graph, startVertex); while (!isEmpty(asdfg123->heap)) { HeapNode min = extractMin(asdfg123->heap); asdfg123->finished[min.id] = true; addTreeEdge(asdfg123, asdfg123->numTreeEdges, min.id, asdfg123->predecessors[min.id], min.priority); AdjList *neighbours = graph->vert", "question": "what algorithm is this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): import web_resource as web_r import os import threading import youtube_api import util import os import google.auth import datetime from googleapiclient.discovery import build from youtube_transcript_api import YouTubeTranscriptApi class YouTubeAPI(web_r.web_results) : def result_from_youtube(self, ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int main(int argc, char **argv) { if (argc == 2){ int c; enum { START, SAW_NL, SAW_TWO_NL } state = START; while ((c = getchar()) != EOF) { if (c == 10){ if (state == START){ putchar(c); state = SAW_NL; }else if (state == SAW_NL){ putchar(c); state = SAW_TWO_NL; } }else{ state = START; putchar(c); }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. The first is a 10 character string and the second is an integer. The program takes no command-line arguments. (You will write this program from scratch, so remember to add, commit, and push.) If the integer is -1, the program prints the full string to stdout. If the integer i is between 0 | Code context (simplify for kids): #include int main(){ char phone[11]; int d; int scanf_return; scanf(\"%s\", phone); // getting first input int err = 0; // variable for return value of program do{ scanf_return = scanf(\"%d\", &d); if (d == -1){ printf(\"%s\\n\", phone); } else if (d<-1 || d>9){ printf(\"ERROR\\n\"); err = 1; } else", "question": "", "intention": "Your task is to write a small C program called phone.c that uses scanf to read two values from standard input. The first is a 10 character string and the second is an integer. The program takes no command-line arguments. (You will write this program from scratch, so remember to add, commit, and push.) If the integer is -1, the program prints the full string to stdout. If the integer i is between 0", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the | Code context (simplify for kids): #include int main(){ char phone[11]; int d; int scanf_return; scanf(\"%s\", phone); // getting first input int err = 0; // variable for return value of program do{ scanf_return = scanf(\"%d\", &d); if (d == -1){ printf(\"%s\\n\", phone); } else if (d<-1 || d>9){ printf(\"ERROR\\n\"); err = 1; } else", "question": "", "intention": "Your task is to write a C program called phone_loop.c. This program will again read from standard input using scanf and take no command-line arguments. Similar to phone.c, this program reads a 10-character string as the first input value but then it repeatedly reads integers until standard input is closed. (Hint: Use a while loop that checks the return value of scanf to accomplish this. Check the ", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *); int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why am I getting a segmentation fault | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *, char *); int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1;", "question": "why am I getting a segmentation fault", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: take input from ls -l terminal command as well as one or two command line arguments and return the number of files greater in size | Code context (simplify for kids): #include #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(const char *input_permissions, const char *required_permissions) { for (int i = 0; i < 9; i++) { if (required_permissions[i] == '-') ", "question": "", "intention": "take input from ls -l terminal command as well as one or two command line arguments and return the number of files greater in size", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do you printf a date of time_t", "question": "How do you printf a date of time_t", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: The compiler is saying that this is invalid and that a long type is necessary | Code context (simplify for kids): new_post->date = time(NULL);", "question": "The compiler is saying that this is invalid and that a long type is necessary", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: new_post->date is of type time_t but this line of code is being flagged as an error and invalid | Code context (simplify for kids): new_post->date = time(NULL);", "question": "new_post->date is of type time_t but this line of code is being flagged as an error and invalid", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What are the values of an initialized array", "question": "What are the values of an initialized array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): scanf", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int *arr[2];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): String.join()", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): String.concat()", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to make string copy", "question": "How to make string copy", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): strtol", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is struct", "question": "what is struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: waht is stored in struct", "question": "waht is stored in struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the syntax for copying a string", "question": "what is the syntax for copying a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: truncate input at n | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "", "intention": "truncate input at n", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: truncate string at n | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "", "intention": "truncate string at n", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: truncate s at n | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "", "intention": "truncate s at n", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: replace first 0 in friends of User name1 with User name2 and replace first 0 in friends of User name2 with User name1 | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *curr = head; User *user1 = NULL; User *user2 = NULL; //traverses through list, assigns curr to user 1 and user2 if(strcmp(name1, name2)==0){ return 3; } else{ while(curr != NULL){ if(strcmp(curr ->name, name1)==0 ){ user1 = c", "question": "", "intention": "replace first 0 in friends of User name1 with User name2 and replace first 0 in friends of User name2 with User name1", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: replace first 0 in friend array of User name1 with User name2 and replace the first 0 in friend array of User name 2 with User name1 | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *curr = head; User *user1 = NULL; User *user2 = NULL; //traverses through list, assigns curr to user 1 and user2 if(strcmp(name1, name2)==0){ return 3; } else{ while(curr != NULL){ if(strcmp(curr ->name, name1)==0 ){ user1 = c", "question": "", "intention": "replace first 0 in friend array of User name1 with User name2 and replace the first 0 in friend array of User name 2 with User name1", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: make all elements in new_user ->friends a 0 | Code context (simplify for kids): memset(new_user->friends, 0, MAX_FRIENDS * sizeof(new_user -> friends[0]));", "question": "", "intention": "make all elements in new_user ->friends a 0", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to cast const User struct to User struct", "question": "how to cast const User struct to User struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when do you use malloc", "question": "when do you use malloc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when should you use malloc for a struct", "question": "when should you use malloc for a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): #include int main(){ char phone_num[11]; scanf(\"%s\", phone_num); int a, contains_error = 0; while(1){ scanf(\"%d\", &a); if(a == -1){ printf(\"%s\\n\", phone_num); }else if(a >= 0 && a <= 9){ printf(\"%c\\n\", phone_num[a]); }else{ printf(\"ERROR\\n\"); contains_error = 1; } } if(contains_error){ ret", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i detect the end of stdin", "question": "how do i detect the end of stdin", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to i detect the end of stdin IN C CODE", "question": "how to i detect the end of stdin IN C CODE", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to detect the end of stdin using scanf in C code", "question": "how to detect the end of stdin using scanf in C code", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to separate a string by \\n?", "question": "How to separate a string by \\n?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign arr[0][i] to s[i] | Code context (simplify for kids): int **split_array(const int *s, int length) { int **arr = (int **)malloc(sizeof(int)*length); arr[0] = (int *) malloc(sizeof(int)* length/2); arr[1] = (int *) malloc(sizeof(int)* length/2); for(int i = 0; i < length; i++){ if(i%2 == 0){ arr[0][i] = s[i]; } if(i%2 == 1){ arr[1][i] = s[i]; } } return ", "question": "", "intention": "How can I assign arr[0][i] to s[i]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how can I assign each arr[i] for each part of a long type variable. | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(*strs,NULL,10); } return arr; }", "question": "", "intention": "how can I assign each arr[i] for each part of a long type variable.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how can I assign each arr[i] from the strtol | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(strs[i],NULL,10); } return arr; }", "question": "", "intention": "how can I assign each arr[i] from the strtol", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign i[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { long i = strtol(strs,NULL,10); i[0] = 0; }", "question": "", "intention": "How can I assign i[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign i[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { long *arr = malloc(sizeof(long)*size); arr = strtol(strs,NULL,10); arr[0] = 0; }", "question": "", "intention": "How can I assign i[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign i[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); arr = strtol(strs,NULL,10); arr[0] = 0; }", "question": "", "intention": "How can I assign i[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign i[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); arr[0] = strtol(strs[0],NULL,10); }", "question": "", "intention": "How can I assign i[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign i[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(strs[i],NULL,10); } return arr; }", "question": "", "intention": "How can I assign i[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign arr[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(strs[i],NULL,10); } return arr; }", "question": "", "intention": "How can I assign arr[0]", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How can I assign arr[0] | Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(strs,NULL,10); } return arr; }", "question": "", "intention": "How can I assign arr[0]", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int *build_array(char **strs, int size) { int *arr = malloc(sizeof(int)*size); for(int i = 0; i< size; i++){ arr[i] = strtol(strs[i],NULL,10); } return arr; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How to compare required[i] with \"-\" | Code context (simplify for kids): int check_permissions(char *file[9], char *required[9]) { for (int i = 0; i < 9; i++) { if (required[i] != \"-\") { if (file[i] != required[i]) { return 1; } } } return 0; }", "question": "", "intention": "How to compare required[i] with \"-\"", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how can I get value of index i in the required | Code context (simplify for kids): int check_permissions(char *file, char *required) { for (int i = 0; i < 9; i++) { if (required[i] != \"-\") { if (file[i] != required[i]) { return 1; } } } return 0; }", "question": "", "intention": "how can I get value of index i in the required", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i extract permissions value from ls -l", "question": "how can i extract permissions value from ls -l", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can I assign permissions form ls -l to a variable", "question": "how can I assign permissions form ls -l to a variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Can access file's index which is the output from ls-l by file[i][4] | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. char *file; scanf(\"%s\", file) // TODO: Call check_permissions as part of your solution to count the files to // compute ", "question": "Can access file's index which is the output from ls-l by file[i][4]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Can assign the output from ls-l to a string?", "question": "Can assign the output from ls-l to a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to user scanf for the output of ls-l", "question": "How to user scanf for the output of ls-l", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: The type of output of ls-l", "question": "The type of output of ls-l", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to know how many command-line arguments are being given?", "question": "How to know how many command-line arguments are being given?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can I use `argc` ?", "question": "how can I use `argc` ?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to modify a string literal?", "question": "How to modify a string literal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to reassign a string literal?", "question": "How to reassign a string literal?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Is there any issues? | Code context (simplify for kids): int check_friends(User *user1, User *user2){ for(int i = 0; i < 10; i++){ if(user1->friends[i]){ if(user1->friends[i]->name == user2->name){ return 0; } } } return 1; }", "question": "Is there any issues?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How to fix segmentation fault? | Code context (simplify for kids): char str[1000]; FILE *fptr; fptr = fopen(user->profile_pic,\"r\"); if(fptr != NULL){ if(fgets(str, 1000, fptr) != NULL){ printf(\"%s\",str); } }", "question": "", "intention": "How to fix segmentation fault?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: How to fix segmentation fault? | Code context (simplify for kids): char str[1000]; FILE *fptr; fptr = fopen(user->profile_pic,\"r\"); if(fptr != NULL){ if(fgets(str, 1000, fptr) != NULL){ printf(\"%s\",str); } } fclose(fptr);", "question": "", "intention": "How to fix segmentation fault?", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char str[1000]; FILE *fptr; fptr = fopen(user->profile_pic,\"r\"); if(fptr != NULL){ if(fgets(str, 1000, fptr) != NULL){ printf(\"%s\",str); fclose(fptr); } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i check how many digits an integer has in c", "question": "how can i check how many digits an integer has in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what kind of info does ls -l give", "question": "what kind of info does ls -l give", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why am i failing the sanity check", "question": "why am i failing the sanity check", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: reasons for sanity check fail | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. //int check_permissions(char *, char *); int check_permissions(char *given_perms, char *req_perms){ for(int i = 0; i < 9; i++){ if (req_perms[i]!='-'){ if(given_perms[i]!=req_", "question": "", "intention": "reasons for sanity check fail", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: read from a file | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. //int check_permissions(char *, char *); int check_permissions(char *given_perms, char *req_perms){ for(int i = 0; i < 9; i++){ if (req_perms[i]!='-'){ if(given_perms[i]!=req_", "question": "", "intention": "read from a file", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i cast a (const User *) to a (User *)", "question": "how can i cast a (const User *) to a (User *)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is a const", "question": "what is a const", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do linked lists work in c", "question": "how do linked lists work in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i print a text file to standard output", "question": "how can i print a text file to standard output", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: each child process needs to have a different id | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int child_num = 0; for (int i = 0; i < iterations; i++) { int n = fork(); if (n == 0", "question": "", "intention": "each child process needs to have a different id", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how can i check if a struct is null", "question": "how can i check if a struct is null", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: create a linkedlist structure that keeps track of names", "question": "", "intention": "", "task_description": "create a linkedlist structure that keeps track of names", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: check that a line starts with a tab", "question": "", "intention": "", "task_description": "check that a line starts with a tab", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: change this to strncpy | Code context (simplify for kids): strcpy(copied_action_line, action_line);", "question": "change this to strncpy", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: difference between string literal and string | Code context (simplify for kids): char *s = \"hi\"; char s[] = \"hi\";", "question": "difference between string literal and string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is y | Code context (simplify for kids): char *s = \"hi\"; char x = \"hello\" char **y = &x;", "question": "what is y", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is friends | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "what is friends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is the initial value of a string", "question": "what is the initial value of a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is null character", "question": "what is null character", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the initial value of firends | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "what is the initial value of firends", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int i, j = 0;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int i, j = 0, 0;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the pointer that point to NULL", "question": "What is the pointer that point to NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is p NULL | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User u; u = NULL; User *p = &u;", "question": "is p NULL", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to figure out a pointer is pointing to NULL?", "question": "how to figure out a pointer is pointing to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char s[10]; s = NULL;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does the function time() do?", "question": "what does the function time() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does the function ctime() do?", "question": "what does the function ctime() do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the arguments of function time()", "question": "what is the arguments of function time()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will User->next->name be? | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "what will User->next->name be?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is the argument of free()", "question": "what is the argument of free()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is string a pointer?", "question": "Is string a pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If the first part of and is False, will it check the second part of and?", "question": "If the first part of and is False, will it check the second part of and?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is and symbol", "question": "what is and symbol", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Difference between & and &&", "question": "Difference between & and &&", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to remove an element in an array", "question": "How to remove an element in an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will i[2] be? | Code context (simplify for kids): int i[2]; i[0] = 1; i[1] = 2;", "question": "what will i[2] be?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the argument of ctime()", "question": "What is the argument of ctime()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: can I set u.profile_pic to NULL | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User u; u.profile_pic = NULL;", "question": "can I set u.profile_pic to NULL", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the initial value of profile_pic? | Code context (simplify for kids): char profile_pic[32]", "question": "what is the initial value of profile_pic?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of profile_pic? | Code context (simplify for kids): char profile_pic[32] profile_pic[0] = '\\0'", "question": "what is the value of profile_pic?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Can I set a variable contains a struct to NULL?", "question": "Can I set a variable contains a struct to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of empty_friends? | Code context (simplify for kids): #define MAX_NAME 32 // Max username and profile_pic filename lengths #define MAX_FRIENDS 10 // Max number of friends a user can have typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MA", "question": "what is the value of empty_friends?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to assign to expression with array", "question": "how to assign to expression with array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When I create an object of a struct, will the values in the struct be created automatically?", "question": "When I create an object of a struct, will the values in the struct be created automatically?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to assign an array to the attributes of a struct", "question": "how to assign an array to the attributes of a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to assign variable with array", "question": "how to assign variable with array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between ptr = &value and *ptr = value?", "question": "what is the difference between ptr = &value and *ptr = value?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if I want to assign value to a string literal which is a variable of a struct, what should I do?", "question": "if I want to assign value to a string literal which is a variable of a struct, what should I do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does the for-loop counter disappear after the loop stoped", "question": "Does the for-loop counter disappear after the loop stoped", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: show the standard outpuy | Code context (simplify for kids): for (int i=0; i < 5; i++){ printf(\"%d\\n\", i); } printf(\"%d\\n\", i+1);", "question": "show the standard outpuy", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does dup2 function do", "question": "what does dup2 function do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do you know current CSC209 A3?", "question": "do you know current CSC209 A3?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to read lines of a makefile?", "question": "How to read lines of a makefile?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What does this function return if line is empty? | Code context (simplify for kids): int is_comment_or_empty(const char *line) { for (int i = 0; i < strlen(line); i++) { if (line[i] == '#') { return 1; } if (line[i] != '\\t' && line[i] != ' ') { return 0; } } return 1; }", "question": "What does this function return if line is empty?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to separate a string by \" \"?", "question": "How to separate a string by \" \"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: should we always allocate spaces on the heap for structs if we want to get access to it after function returns?", "question": "should we always allocate spaces on the heap for structs if we want to get access to it after function returns?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will this file print? | Code context (simplify for kids): #include #include int main() { char str[80] = \"This is - www.tutorialspoint.com - website\"; const char s[2] = \"-\"; char *token; token = strtok(str, s); while (token != NULL) { printf(\" %s\\n\", token); token = strtok(NULL, s); } return (0); }", "question": "what will this file print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What will fgets() function get if the line is empty", "question": "What will fgets() function get if the line is empty", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to strip a string after using fgets()?", "question": "How to strip a string after using fgets()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will it print? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; token = strtok(str, \"\\n\"); // split the string at \"\\n\" strcat(token, \"\"); // concatenate the tokens to get the final string printf(\"%s\", token); // print the string without \"\\n\" return 0; }", "question": "what will it print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what will it print?", "question": "what will it print?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will it print? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; str = strtok(str, \"\\n\"); // split the string at \"\\n\" strcat(str, \"\"); // concatenate the tokens to get the final string printf(\"%s\", str); // print the string without \"\\n\" return 0; }", "question": "what will it print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what will it print? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; str = strtok(str, \"\\n\"); // split the string at \"\\n\" // strcat(str, \"\"); // concatenate the tokens to get the final string printf(\"%s\", str); // print the string without \"\\n\" return 0; }", "question": "what will it print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is line 7 correct? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; str = strtok(str, \"\\n\"); // split the string at \"\\n\" strcat(str, \"\"); // concatenate the tokens to get the final string printf(\"%s\", str); // print the string without \"\\n\" return 0; }", "question": "is line 7 correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is line 7 correct? | Code context (simplify for kids): #include #include int main() { char *str = \"Hello, world!\\n\"; str = strtok(str, \"\\n\"); // split the string at \"\\n\" strcat(str, \"\"); // concatenate the tokens to get the final string printf(\"%s\", str); // print the string without \"\\n\" return 0; }", "question": "is line 7 correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is line 7 correct? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; token = strtok(str, \"\\n\"); // split the string at \"\\n\" strcpy(str, token); printf(\"%s\", str); // print the string without \"\\n\" return 0; }", "question": "is line 7 correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is line 7 correct? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; token = strtok(str, \"\\n\"); // split the string at \"\\n\" printf(\"%s\", token); // print the string without \"\\n\" return 0; }", "question": "is line 7 correct?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what will str be after line 8? | Code context (simplify for kids): #include #include int main() { char str[100] = \"Hello, world!\\n\"; char *token; token = strtok(str, \"\\n\"); // split the string at \"\\n\" strcpy(str, token); printf(\"%s\", token); // print the string without \"\\n\" return 0; }", "question": "what will str be after line 8?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How to read a file again?", "question": "How to read a file again?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to read a file twice in a function", "question": "how to read a file twice in a function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does fgets() return?", "question": "what does fgets() return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to report error if error occurred during malloc?", "question": "how to report error if error occurred during malloc?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if I split a string \"\\t hello world\" by strtok, what will the result be?", "question": "if I split a string \"\\t hello world\" by strtok, what will the result be?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I use strtok() to a string contains '\\t' by delimiter \" \", and then I keep printing strtok(NULL, space), will '\\t' be printed out?", "question": "If I use strtok() to a string contains '\\t' by delimiter \" \", and then I keep printing strtok(NULL, space), will '\\t' be printed out?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to debug using terminal", "question": "How to debug using terminal", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to copy a string?", "question": "how to copy a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does \\r mean?", "question": "what does \\r mean?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use strtok to strip \\n and \\r", "question": "how to use strtok to strip \\n and \\r", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain strncpy()", "question": "explain strncpy()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to strip '\\n' of a string by using strtok", "question": "how to strip '\\n' of a string by using strtok", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: 1 is equal to true or false", "question": "1 is equal to true or false", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: split line \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" by \" \" and forms an array of strings | Code context (simplify for kids): char **helper_build_action(char *line){ char **result = malloc(MAXLINE * sizeof(char)); if (result == NULL){ perror(\"Error occurred during malloc\"); exit(1); } char *tk = strtok(line, \" \"); int i = 0; tk = strtok(NULL, \" \"); while(tk != NULL){ result[i] = tk; i += 1; tk = strtok(NULL, \" \"); } result", "question": "split line \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" by \" \" and forms an array of strings", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: input: line = \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" desired output = [\"gcc\", \"-Wall\", \"-g\", \"-std=gnu99\", \"-o\", \"main\", \"linked_list.o\", \"main.o\", NULL] | Code context (simplify for kids): char **helper_build_action(char *line){ char **result = malloc(MAXLINE * sizeof(char)); if (result == NULL){ perror(\"Error occurred during malloc\"); exit(1); } char *tk = strtok(line, \"\\t\"); int i = 0; tk = strtok(NULL, \"\\t\"); while(tk != NULL){ result[i] = strdup(tk); i += 1; tk = strtok(NULL, \" \")", "question": "input: line = \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" desired output = [\"gcc\", \"-Wall\", \"-g\", \"-std=gnu99\", \"-o\", \"main\", \"linked_list.o\", \"main.o\", NULL]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: Intended Behavior: input: line = \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" result = [\"gcc\", \"-Wall\", \"-g\", \"-std=gnu99\", \"-o\", \"main\", \"linked_list.o\", \"main.o\", NULL] | Code context (simplify for kids): char **helper_build_action(char *line){ char **result = malloc(MAXLINE * sizeof(char)); if (result == NULL){ perror(\"Error occurred during malloc\"); exit(1); } char *tk = strtok(line, \"\\t\"); int i = 0; tk = strtok(NULL, \"\\t\"); while(tk != NULL){ result[i] = strdup(tk); i += 1; tk = strtok(NULL, \" \")", "question": "Intended Behavior: input: line = \"\\tgcc -Wall -g -std=gnu99 -o main linked_list.o main.o\" result = [\"gcc\", \"-Wall\", \"-g\", \"-std=gnu99\", \"-o\", \"main\", \"linked_list.o\", \"main.o\", NULL]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does execvp do", "question": "what does execvp do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to call stat?", "question": "how to call stat?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between perror and fprintf", "question": "what is the difference between perror and fprintf", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to use access to determine file existence.", "question": "How to use access to determine file existence.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialize a variable taking true/false value", "question": "how to initialize a variable taking true/false value", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is st_mtim in struct stat?", "question": "what is st_mtim in struct stat?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Explain WIFEXIT", "question": "Explain WIFEXIT", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Should child process always use exit(0) at the end?", "question": "Should child process always use exit(0) at the end?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is pid_t int?", "question": "is pid_t int?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain WIFEXITED", "question": "explain WIFEXITED", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain WEXITSTATUS", "question": "explain WEXITSTATUS", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain WEXITSTATUS", "question": "explain WEXITSTATUS", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to generate a random int between 0 to 99", "question": "How to generate a random int between 0 to 99", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does it mean if a loop header is for (;;)", "question": "what does it mean if a loop header is for (;;)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Generate a random integer from 0 to 100", "question": "", "intention": "", "task_description": "Generate a random integer from 0 to 100", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if I add a signal handler to a file, where do I add it?", "question": "if I add a signal handler to a file, where do I add it?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does setitimer do", "question": "what does setitimer do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the input of malloc function", "question": "what is the input of malloc function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain strcat", "question": "explain strcat", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what will strncat do?", "question": "what will strncat do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the strlen of \"\\n\"", "question": "what is the strlen of \"\\n\"", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does snprintf do", "question": "what does snprintf do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: asctime(localtime()), what does the return string looks like", "question": "asctime(localtime()), what does the return string looks like", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do we need to catch error for free()?", "question": "do we need to catch error for free()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: server program and client program communicate via what?", "question": "server program and client program communicate via what?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): \\usepackage[margins=2.5]{geometry}", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: If I have float *x; and float y; how do I increase the amount stored in y by the amount in x?", "question": "If I have float *x; and float y; how do I increase the amount stored in y by the amount in x?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: add the value of x to the value of y | Code context (simplify for kids): int main(int argc, char **argv) { float x = 2.2; float *y; y = &x +1", "question": "", "intention": "add the value of x to the value of y", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: return a count of ls -l file sizes larger than value parameter provided. If second parameter is 9 element permissions, the count is of files larger than first parameter that also match permissions. | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *permission, char *file) { for (int i = 0; i < 9; i++) { if (permission[i] != file[i]) { return 1; } } return 0; } int main(int argc, char** argv) {", "question": "", "intention": "return a count of ls -l file sizes larger than value parameter provided. If second parameter is 9 element permissions, the count is of files larger than first parameter that also match permissions.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: return count of files larger than given parameter | Code context (simplify for kids): #include #include // TODO: Implement a helper named check_permissions that matches the prototype below. int check_permissions(char *permission, char *file) { for (int i = 0; i < 9; i++) { if (permission[i] != file[i]) { return 1; } } return 0; } int main(int argc, char** argv) {", "question": "", "intention": "return count of files larger than given parameter", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: it should return pow 3 when run with ./o powder 3 | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "", "intention": "it should return pow 3 when run with ./o powder 3", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Assign a dynamically allocate char* array of length 4 to variable called last_names", "question": "Assign a dynamically allocate char* array of length 4 to variable called last_names", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to write a for loop in c for an array", "question": "How to write a for loop in c for an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: allocate a character array of length 20 for each element of the array pointed to by last_names", "question": "allocate a character array of length 20 for each element of the array pointed to by last_names", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I allocate a character array of length 20 for each element of the array pointed to by last_names? | Code context (simplify for kids): #include #include int main() { char **last_names; // Assign a dynamically allocated char * array of length 4 to last_names. // Then, allocate a character array of length 20 for each element of the array // pointed to by last_names. last_names = (char **) malloc(sizeof(char*)*4);", "question": "How do I allocate a character array of length 20 for each element of the array pointed to by last_names?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: allocate space on the heap for an array of 12 floats and assign it to the pointer monthly_rainfall", "question": "allocate space on the heap for an array of 12 floats and assign it to the pointer monthly_rainfall", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: rainfall has been dynamically allocated space for a floating point number and initialized in hidden code. Add 7.6 to the amount currently stored in the space rainfall points to.", "question": "rainfall has been dynamically allocated space for a floating point number and initialized in hidden code. Add 7.6 to the amount currently stored in the space rainfall points to.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Add 7.6 to the amount currently stored in the space rainfall points to.", "question": "Add 7.6 to the amount currently stored in the space rainfall points to.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Increase the amount currently stored in total_rain by the amount stored in the space pointed to by rainfall.", "question": "Increase the amount currently stored in total_rain by the amount stored in the space pointed to by rainfall.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: set the allocated_amount variable to the exact amount of space that should be allocated and pointed to by float *rainfall", "question": "set the allocated_amount variable to the exact amount of space that should be allocated and pointed to by float *rainfall", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Assign the amount in rain_today to the space rainfall points to. | Code context (simplify for kids): #include #include int main(int argc, char **argv) { float *rainfall; float rain_today; // rainfall has been dynamically allocated space for a floating point number. // Both rainfall and rain_today have been initialized in hidden code. // Assign the amount in rain_today to the sp", "question": "Assign the amount in rain_today to the space rainfall points to.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: rain_today should be used. | Code context (simplify for kids): #include #include int main(int argc, char **argv) { float *rainfall; float rain_today; // rainfall has been dynamically allocated space for a floating point number. // Both rainfall and rain_today have been initialized in hidden code. // Assign the amount in rain_today to the sp", "question": "", "intention": "rain_today should be used.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: /* Returns the sum of two integers in the string input_line. input_line is a string containing two integers separated by one or more spaces. Assume that the string will not be more than 20 characters long and that it contains two integers separated only by whitespace. There may also be spaces before the first integer and/or after the last, but there won't be any other characters in the string. For", "question": "/* Returns the sum of two integers in the string input_line. input_line is a string containing two integers separated by one or more spaces. Assume that the string will not be more than 20 characters long and that it contains two integers separated only by whitespace. There may also be spaces before the first integer and/or after the last, but there won't be any other characters in the string. For", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: return the sum of two integers in the string input_line using strtol().", "question": "return the sum of two integers in the string input_line using strtol().", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): * Returns the sum of two integers in the string input_line. input_line is a string containing two integers separated by one or more spaces. Assume that the string will not be more than 20 characters long and that it contains two integers separated only by whitespace. There may also be spaces before ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Given three variables with hidden integer values, compare their values for uniqueness and print one of the following statements: - \"none unique\" (if all variables share the same value) - \"some unique\" (if exactly two variables share the same value) - \"all unique\" (if there are no duplicates)", "question": "Given three variables with hidden integer values, compare their values for uniqueness and print one of the following statements: - \"none unique\" (if all variables share the same value) - \"some unique\" (if exactly two variables share the same value) - \"all unique\" (if there are no duplicates)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Write a for loop that prints the integers from 1 to 10 with spaces separating the values.", "question": "Write a for loop that prints the integers from 1 to 10 with spaces separating the values.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Define a string literal named tasty with the value \"doughnut\".", "question": "Define a string literal named tasty with the value \"doughnut\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Set the value of delicious (which has already been declared) to \"ice cream\".", "question": "Set the value of delicious (which has already been declared) to \"ice cream\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: The string sweet has been declared on the heap and has space for 20 characters. Set the value of sweet to \"tiramisu\" without changing its address.", "question": "The string sweet has been declared on the heap and has space for 20 characters. Set the value of sweet to \"tiramisu\" without changing its address.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: declare a struct called best_friend and initialize the members of best_friend based on the following information. Name: Jane Doe Phone Number: 377 177 377 Address: 1337 University Avenue", "question": "declare a struct called best_friend and initialize the members of best_friend based on the following information. Name: Jane Doe Phone Number: 377 177 377 Address: 1337 University Avenue", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Define a string literal called season that has the value \"winter\".", "question": "Define a string literal called season that has the value \"winter\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Define a stack-allocated string called holiday that has space for 20 characters including the null terminator. Set its initial value to \"Valentine's Day\".", "question": "Define a stack-allocated string called holiday that has space for 20 characters including the null terminator. Set its initial value to \"Valentine's Day\".", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Write a loop which traverses a linked list starting at front and prints the value of each node in the list. Separate each value with a space.", "question": "Write a loop which traverses a linked list starting at front and prints the value of each node in the list. Separate each value with a space.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the value of delicious (which has already been declared) to \"ice cream\". | Code context (simplify for kids): #include #include #include int main() { char delicious[30]; // Submitted code below // Submitted code above /* hidden test code */ return 0; } // Submitted code below", "question": "", "intention": "Set the value of delicious (which has already been declared) to \"ice cream\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the value of delicious (which has already been declared) to \"ice cream\". | Code context (simplify for kids): #include #include #include int main() { char delicious[30]; // Submitted code below delicious = \"ice cream\"; // Submitted code above /* hidden test code */ return 0; } // Submitted code below", "question": "", "intention": "Set the value of delicious (which has already been declared) to \"ice cream\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the value of delicious (which has already been declared) to \"ice cream\". | Code context (simplify for kids): #include #include #include int main() { char delicious[30]; // Submitted code below *delicious = strcpy(delicious, \"ice cream\"); // Submitted code above /* hidden test code */ return 0; } // Submitted code below", "question": "", "intention": "Set the value of delicious (which has already been declared) to \"ice cream\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the value of delicious (which has already been declared) to \"ice cream\". | Code context (simplify for kids): #include #include #include int main() { char delicious[30]; // Submitted code below delicious = strcpy(delicious, \"ice cream\"); // Submitted code above /* hidden test code */ return 0; } // Submitted code below", "question": "", "intention": "Set the value of delicious (which has already been declared) to \"ice cream\".", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the value of delicious (which has already been declared) to \"ice cream\". | Code context (simplify for kids): #include #include #include int main() { char delicious[30]; // Submitted code below delicious = strcpy(delicious, \"ice cream\"); // Submitted code above /* hidden test code */ return 0; } // Submitted code below", "question": "", "intention": "Set the value of delicious (which has already been declared) to \"ice cream\".", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What will this declaration line become after the program has passed through the C pre-processor? | Code context (simplify for kids): #include #define MAXNAME = 32; #declaration char name[MAXNAME]; int main() { #ifdef MACRO printf(\"%d\\n\", MACRO); #endif return 0; }", "question": "What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Tell me about the C preprocessor", "question": "Tell me about the C preprocessor", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can equality of two characters be verified?", "question": "how can equality of two characters be verified?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can a char be converted to an int?", "question": "how can a char be converted to an int?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int size = (int) argv[1];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I print the contents of a file line by line to standard output?", "question": "How do I print the contents of a file line by line to standard output?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: store up to n fibonacci numbers in a dynamically allocated array and print each element | Code context (simplify for kids): void fib(int** array, int n) { *array = malloc(sizeof(int) * n); int term1 = 0; int term2 = 1; int next; if (n == 1) { (*array)[0] = term1; } else if (n == 2) { (*array)[0] = term1; (*array)[1] = term2; } else { (*array)[0] = term1; (*array)[1] = term2; for (int i = 2; i < n; i++) { next = term1 + t", "question": "", "intention": "store up to n fibonacci numbers in a dynamically allocated array and print each element", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i truncate a string", "question": "how do i truncate a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is wrong with my code? | Code context (simplify for kids): int strip_q_marks(char* s) { int count = 0; for (int i = strlen(s); i == 0; i--) { if (s[i - 1] == '?' && s[i] == '\\0') { s[i - 1] = '\\0'; count++; } } return count; }", "question": "what is wrong with my code?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Use strcat to concatenate a space into a string", "question": "Use strcat to concatenate a space into a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do I read an int from 4 bytes in a binary file", "question": "how do I read an int from 4 bytes in a binary file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: I want to read 4 byte integers from file metadata | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image, 9, SEEK_SET); fread(pixel_array_offset, 4, 1, image); fseek(image, 17, SEEK_SET); fread(width, 4, 1, image); fseek(image, 21, SEEK_SET); fread(height, 4, 1, image); }", "question": "", "intention": "I want to read 4 byte integers from file metadata", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: I want to read integers from byte offsets 10-13, 18-21 and 22-25 | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image, 9, SEEK_SET); fread(pixel_array_offset, 4, 1, image); fseek(image, 17, SEEK_SET); fread(width, 4, 1, image); fseek(image, 21, SEEK_SET); fread(height, 4, 1, image); }", "question": "I want to read integers from byte offsets 10-13, 18-21 and 22-25", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: initialize multiple pointers using a for loop", "question": "initialize multiple pointers using a for loop", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why is demo_user not defined? | Code context (simplify for kids): int main() { struct user demo_user; int result = create_user(\"Dario\", &&demo_user); printf(\"%d\\n\", result); return 0; }", "question": "why is demo_user not defined?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I insert an element into the first empty spot of an array?", "question": "how do I insert an element into the first empty spot of an array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to read ascii art", "question": "how to read ascii art", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to null terminate a string resulting from strncpy", "question": "how to null terminate a string resulting from strncpy", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use time function", "question": "how to use time function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why do i get a warning for this code | Code context (simplify for kids): strcpy(new_post->contents, contents);", "question": "why do i get a warning for this code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why do i get a maybe uninitialized warning | Code context (simplify for kids): strcpy(new_post->contents, contents);", "question": "why do i get a maybe uninitialized warning", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i malloc space for size 10 array", "question": "how do i malloc space for size 10 array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to access one char of a string when we have the pointer to that string only", "question": "how to access one char of a string when we have the pointer to that string only", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how can i fix the error in line 3 | Code context (simplify for kids): int test(char *a, char*b){ for(int i; i<9; i++){ if(*b[i] != \"-\" && *b[i] != *a[i]){ return 1; } } return 0; } int main(int argc, char** argv){ return test(argv[1], argv[2]); }", "question": "how can i fix the error in line 3", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to pass command line arguements to another function one by one", "question": "how to pass command line arguements to another function one by one", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to calculate the number of digits in an int", "question": "how to calculate the number of digits in an int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to perform integer division in c", "question": "how to perform integer division in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is 9/2 in c", "question": "what is 9/2 in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to get the number from i-th place in an integer", "question": "how to get the number from i-th place in an integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the output of this code | Code context (simplify for kids): #include int main() { int number = 12345; int i; for (i = 0; i < 5; i++) { printf(\"%d\", (number / (10^i)) % 10); } return 0; }", "question": "what is the output of this code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the output when this code is run with arguements sin = 123456789 and sin_array is an integer array of 9 integers | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { int number_of_digits = 0; while(sin != 0){ sin = sin / 10; number_of_digits ++; } if(number_of_digits != 9){ return 1; } else { for(int i = 0; i < 9; i++){ sin_array[i] = (sin / (10^(8 - i))) % 10; } } }", "question": "what is the output when this code is run with arguements sin = 123456789 and sin_array is an integer array of 9 integers", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the output when this code is run with arguements sin = 012345678 and sin_array is an integer array of 9 integers | Code context (simplify for kids): int populate_array(int sin, int *sin_array) { int number_of_digits = 0; while(sin != 0){ sin = sin / 10; number_of_digits ++; } if(number_of_digits != 9){ return 1; } else { for(int i = 0; i < 9; i++){ sin_array[i] = (sin / (10^(8 - i))) % 10; } } }", "question": "what is the output when this code is run with arguements sin = 012345678 and sin_array is an integer array of 9 integers", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to get the i-th digit of a 2 digit number", "question": "how to get the i-th digit of a 2 digit number", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ int temp = sin_array[i] * mult_array[i] if(temp / 10 == 0){ total += temp; } else { int one = temp / 10; int two = temp % 10; total += (one * two); } } if(total % 10 == 0){ return 0", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6}", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ int temp = sin_array[i] * mult_array[i] if(temp / 10 == 0){ total += temp; } else { int one = temp / 10; int two = temp % 10; total += (one * two); } } if(total % 10 == 0){ return 0", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7}", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ int temp = sin_array[i] * mult_array[i] if(temp / 10 == 0){ total += temp; } else { int one = temp / 10; int two = temp % 10; total += (one * two); } } if(total % 10 == 0){ return 0", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ int temp = sin_array[i] * mult_array[i] if(temp / 10 == 0){ total += temp; } else { int one = temp / 10; int two = temp % 10; total += (one * two); } } if(total % 10 == 0){ return 0", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_array[i]) / 10; int two = (sin_array[i] * mult_array[i", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_array[i]) / 10; int two = (sin_array[i] * mult_array[i", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 6} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_array[i]) / 10; int two = (sin_array[i] * mult_array[i", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int check_sin(int *sin_array) { int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1} int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_array[i]) / 10; int two = (sin_array[i] * mult_array[i", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { check_sin takes an array of integers as an argument int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1}; int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_a", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total. can i track every step | Code context (simplify for kids): int check_sin(int *sin_array) { check_sin takes an array of integers as an argument int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1}; int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) / 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_a", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total. can i track every step", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total | Code context (simplify for kids): int check_sin(int *sin_array) { check_sin takes an array of integers as an argument int *mult_array = {1, 2, 1, 2, 1, 2, 1, 2, 1}; int total = 0; for(int i = 0; i<9; i++){ if((sin_array[i] * mult_array[i]) < 10 == 0){ total += (sin_array[i] * mult_array[i]); } else { int one = (sin_array[i] * mult_a", "question": "what would the output be for sin_array = {8, 1, 0, 6, 2, 0, 7, 1, 7} and the value of total", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to initialize an array of integers in c", "question": "how to initialize an array of integers in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does populating an integer array mean", "question": "what does populating an integer array mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i change a global array inside another function and retain the changes", "question": "how do i change a global array inside another function and retain the changes", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to differentiate between files and directories", "question": "how to differentiate between files and directories", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i change sin_array initialisation or modification so the changes made to it in populate_array are global changes so i can use the modified sin_array in check_sin | Code context (simplify for kids): #include #include // TODO: Implement populate_array /* * Convert a 9 digit int to a 9 element int array. */ int populate_array(int sin, int *sin_array) { int number_of_digits = 0; while(sin != 0){ sin = sin / 10; number_of_digits ++; } if(number_of_digits != 9){ return 1; } else", "question": "how do i change sin_array initialisation or modification so the changes made to it in populate_array are global changes so i can use the modified sin_array in check_sin", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is the result of atoi(\"012345\")", "question": "what is the result of atoi(\"012345\")", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to make a function take a non negative int as one parameter", "question": "how to make a function take a non negative int as one parameter", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a char is equal to a ?", "question": "how to check if a char is equal to a ?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of greeting when the piece of code is run. | Code context (simplify for kids): char greeting[20]; strncpy(greeting, \"Top of the morning to you\", sizeof(greeting) - 1);", "question": "what is the value of greeting when the piece of code is run.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the sizeof(greeting) | Code context (simplify for kids): char greeting[20]; strncpy(greeting, \"Top of the morning to you\", sizeof(greeting) - 1);", "question": "what is the sizeof(greeting)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of greeting when the piece of code is run | Code context (simplify for kids): char greeting[20]; strncpy(greeting, \"Top of the morning to you\", 19);", "question": "what is the value of greeting when the piece of code is run", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to store something read by fread() in a variable", "question": "how to store something read by fread() in a variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialise space for 10 structs at once", "question": "how to initialise space for 10 structs at once", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to find the length of a string in c", "question": "how to find the length of a string in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is sizeof(Kaavya) | Code context (simplify for kids): char *name = \"Kaavya\"", "question": "what is sizeof(Kaavya)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is sizeof(name) | Code context (simplify for kids): char *name = \"Kaavya\"", "question": "what is sizeof(name)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is sizeof(*name) | Code context (simplify for kids): char *name = \"Kaavya\"", "question": "what is sizeof(*name)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the output of sizeof(*name) | Code context (simplify for kids): char *name = \"Kaavya\"", "question": "what is the output of sizeof(*name)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: does something like strlen exist in c", "question": "does something like strlen exist in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is strlen(name) | Code context (simplify for kids): char *name = \"Kaavya\"", "question": "what is strlen(name)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: syntax of strcmp", "question": "syntax of strcmp", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a current item is the last node of a linked list in c", "question": "how to check if a current item is the last node of a linked list in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to create an instance of am empty struct", "question": "how to create an instance of am empty struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: syntax of strcpy", "question": "syntax of strcpy", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to cast datatypes in c", "question": "how to cast datatypes in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to cast (const User *head) from a (const User *) to a (User *)", "question": "how to cast (const User *head) from a (const User *) to a (User *)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: usage of -> in structs", "question": "usage of -> in structs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the syntax for calloc and an example", "question": "what is the syntax for calloc and an example", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there an equivalent of count feature in C?", "question": "is there an equivalent of count feature in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialise a boolean value", "question": "how to initialise a boolean value", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when u initialise an array of pointers of length 32, what are all elements by default set to", "question": "when u initialise an array of pointers of length 32, what are all elements by default set to", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to printf a combination of strings and variables", "question": "how to printf a combination of strings and variables", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to read a ascii file", "question": "how to read a ascii file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: equivalent of break in c", "question": "equivalent of break in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to set char *contents to char *contentt;", "question": "how to set char *contents to char *contentt;", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is time(NULL) output", "question": "what is time(NULL) output", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will be the output of ctime(time_address) | Code context (simplify for kids): time_t post_time = time(NULL); time_t *time_address = &post_time;", "question": "what will be the output of ctime(time_address)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to allocate space for time(NULL)", "question": "how to allocate space for time(NULL)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: fscanf vs fgets", "question": "fscanf vs fgets", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do you have to allocate memory for individual attributes of structs as well to avoid memory leak", "question": "do you have to allocate memory for individual attributes of structs as well to avoid memory leak", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how to allocate space for each item in struct | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "how to allocate space for each item in struct", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to allocate space for every attribute separately even if i allocate space with sizeof(User) | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "do i need to allocate space for every attribute separately even if i allocate space with sizeof(User)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: do i have to free memory only when i malloc or in other cases too?", "question": "do i have to free memory only when i malloc or in other cases too?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to free a linked list example", "question": "how to free a linked list example", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to free a calloc memory", "question": "how to free a calloc memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to fix invalid reads", "question": "how to fix invalid reads", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does calloc work", "question": "how does calloc work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i allocate space for each of the attributes of user | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User;", "question": "how do i allocate space for each of the attributes of user", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to allocate space for an array of pointers to ints", "question": "how to allocate space for an array of pointers to ints", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: syntax to calloc for a string", "question": "syntax to calloc for a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is wrong with the memory allocations | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; User *new_node = calloc(1, sizeof(User)); new_node->name = calloc(1, sizeof(char) * MAX_NAME);", "question": "what is wrong with the memory allocations", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i allocate space for this using calloc | Code context (simplify for kids): char *a[32];", "question": "how do i allocate space for this using calloc", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: do i need to close the file here? if yes, where all do i need to close the file | Code context (simplify for kids): int update_pic(User *user, const char *filename) { if(strlen(filename) >= MAX_NAME){ return 2; } else if((fopen(filename, \"r\")) == NULL){ return 1; } else { strcpy(user->profile_pic, filename); return 0; } }", "question": "do i need to close the file here? if yes, where all do i need to close the file", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to set a string attribute of a struct to null", "question": "how to set a string attribute of a struct to null", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does \"\" mean NULL", "question": "does \"\" mean NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to initialise an array of 32 NULL", "question": "how to initialise an array of 32 NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to set a string to NULL", "question": "how to set a string to NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is a == NULL? | Code context (simplify for kids): char *a = '\\0'", "question": "is a == NULL?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how to close the file in this | Code context (simplify for kids): int update_pic(User *user, const char *filename) { if(strlen(filename) >= MAX_NAME){ return 2; } else if((fopen(filename, \"r\")) == NULL){ return 1; } else { strcpy(user->profile_pic, filename); return 0; } }", "question": "how to close the file in this", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: i want to close the file | Code context (simplify for kids): int update_pic(User *user, const char *filename) { if(strlen(filename) >= MAX_NAME){ return 2; } else if((fopen(filename, \"r\")) == NULL){ return 1; } else { strcpy(user->profile_pic, filename); return 0; } }", "question": "", "intention": "i want to close the file", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is fclose(fp)", "question": "what is fclose(fp)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: tons of valgrind error makes valgrind stuck and does not show me heap summary. what to do.", "question": "tons of valgrind error makes valgrind stuck and does not show me heap summary. what to do.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use gdb to debug", "question": "how to use gdb to debug", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when i intialise char *profile, what is its default value set to", "question": "when i intialise char *profile, what is its default value set to", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if malloc fails", "question": "how to check if malloc fails", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is memset", "question": "what is memset", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: c_helper.py:125: in _t stdout, stderr, returncode = self._run_exec(args=args, input_=input_, timeout=timeout) c_helper.py:85: in _run_exec return _exec([os.path.join(\".\", self.executable_name)] + (args or []), **kwargs) c_helper.py:471: in _exec stdout, stderr = proc.communicate(timeout=timeout, input=input_) /local/packages/python-3.10/lib/python3.10/subprocess.py:1152: in communicate stdout, std", "question": "c_helper.py:125: in _t stdout, stderr, returncode = self._run_exec(args=args, input_=input_, timeout=timeout) c_helper.py:85: in _run_exec return _exec([os.path.join(\".\", self.executable_name)] + (args or []), **kwargs) c_helper.py:471: in _exec stdout, stderr = proc.communicate(timeout=timeout, input=input_) /local/packages/python-3.10/lib/python3.10/subprocess.py:1152: in communicate stdout, std", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: strncpy(char *dest, \"ananyajain\", 7) output?", "question": "strncpy(char *dest, \"ananyajain\", 7) output?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the output of the code | Code context (simplify for kids): #include #include // Initialize two parallel lists. void initialize(int *a1, int *a2, int n) { for (int i = 0; i < n; i++) { a1[i] = i; a2[i] = i; } } int main() { int numbers1[3]; int *numbers2 = malloc(sizeof(int) * 3); initialize(numbers1, numbers2, 3); for (int i = 0; i < 3;", "question": "what is the output of the code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what exactly is the second parameter of strtol", "question": "what exactly is the second parameter of strtol", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is strlen(a) | Code context (simplify for kids): char *a = \"Hello I\"", "question": "what is strlen(a)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: is strlen(a) 7 or 8 or 9", "question": "is strlen(a) 7 or 8 or 9", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is strlen(a) 7 or 8 or 9 | Code context (simplify for kids): char *a = \"Hello I\"", "question": "is strlen(a) 7 or 8 or 9", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what is strlen(a) when char *a = \"Hello I\"", "question": "what is strlen(a) when char *a = \"Hello I\"", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what will be the output | Code context (simplify for kids): char *a = \"Hello Bruh\" char *b = strchr(a, ' ') printf(\"%s\", b)", "question": "what will be the output", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: output | Code context (simplify for kids): char *a = \"Hello Bruh\" char *b = strchr(a, ' ') - 1 printf(\"%s\", b)", "question": "output", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: output | Code context (simplify for kids): char *a = \"Hello Bruh\" char *b = strchr(a, ' ') - 2 printf(\"%s\", b)", "question": "output", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how does grep work", "question": "how does grep work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does cut work", "question": "how does cut work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: my child calls a different program using execl which has different exit values. how do i get the exit value the program exited with back to my child", "question": "my child calls a different program using execl which has different exit values. how do i get the exit value the program exited with back to my child", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to write \"swim\" to stdin", "question": "how to write \"swim\" to stdin", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: a program called validate is expecting 2 inputs from stdin. my function calls validate using execl. how do i pass the variables i need to as stdin to it.", "question": "a program called validate is expecting 2 inputs from stdin. my function calls validate using execl. how do i pass the variables i need to as stdin to it.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the difference between exit(0) and return 0", "question": "what is the difference between exit(0) and return 0", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does strtok work", "question": "how does strtok work", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Let a string be s = \"main : linked_list.o main.o\". What is the output of strtok(s, \" \")", "question": "Let a string be s = \"main : linked_list.o main.o\". What is the output of strtok(s, \" \")", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check is a string starts with \\t", "question": "how to check is a string starts with \\t", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of b | Code context (simplify for kids): a = \"\\tHello World\" b = strncmp(a, \"\\t\", 1);", "question": "what is the value of b", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of token | Code context (simplify for kids): char *a = \"\\tHello Boss\" char *token = strtok(a, \" \")", "question": "what is the value of token", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does strncmp returning 3 mean", "question": "what does strncmp returning 3 mean", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to find if a char is in a string", "question": "how to find if a char is in a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of a[0] | Code context (simplify for kids): char *a = \"Hello I am Kaavya\";", "question": "what is the value of a[0]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how does stat work?", "question": "how does stat work?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use access to check if a file exists or not", "question": "how to use access to check if a file exists or not", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a string is NULL", "question": "how to check if a string is NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is return value of args_to_string({\"Hi\" , \"Kaavya\" , NULL}, a, 3 | Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; } char *a = malloc(256);", "question": "what is return value of args_to_string({\"Hi\" , \"Kaavya\" , NULL}, a, 3", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is return value of args_to_string({\"Hi\" , \"Kaavya\" , NULL}, a, 256) | Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; } char *a = malloc(256);", "question": "what is return value of args_to_string({\"Hi\" , \"Kaavya\" , NULL}, a, 256)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to update the updated time of a file", "question": "how to update the updated time of a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you use variables declared in the main stack directly in a function and change its value globally (variable of type int)", "question": "Can you use variables declared in the main stack directly in a function and change its value globally (variable of type int)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to mention the start and end numbers for random()", "question": "how to mention the start and end numbers for random()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use random() to generate numbers between 0 to 99 inclusive in C", "question": "how to use random() to generate numbers between 0 to 99 inclusive in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: how to use random() to generate numbers between 0 to 99 inclusive in C", "question": "", "intention": "", "task_description": "how to use random() to generate numbers between 0 to 99 inclusive in C", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is a[2] | Code context (simplify for kids): char *a = \"Hello\"", "question": "what is a[2]", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: area=`expr $width * $height` why is this incorrect", "question": "area=`expr $width * $height` why is this incorrect", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does the given code work | Code context (simplify for kids): char *a; a = \"Hello\";", "question": "does the given code work", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I reassign a string in C", "question": "How do I reassign a string in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I read a file through stdin in C", "question": "How do I read a file through stdin in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use scanf to read a redirected file", "question": "How do I use scanf to read a redirected file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use a function in one C file in another C file", "question": "How do I use a function in one C file in another C file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to convert char to int", "question": "How to convert char to int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: split string on spaces", "question": "split string on spaces", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i read a file line by line", "question": "how do i read a file line by line", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: read character by character in a string", "question": "read character by character in a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does fgets overwrite the string array", "question": "does fgets overwrite the string array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: dictionaries in C", "question": "dictionaries in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: count number of spaces in string", "question": "count number of spaces in string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to read the last string in a string delimeted by a delimeter using strtok", "question": "how to read the last string in a string delimeted by a delimeter using strtok", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: strtok doesnt work as expected, last string in line cannot be obtained | Code context (simplify for kids): //get the target name targets = strtok(line, \" \"); printf(\"%s \\n\", targets); //create the Rule datatype if (curr_rule == NULL){ curr_rule = malloc(sizeof(Rule)); head = curr_rule; }else{ Rule * new_rule = malloc(sizeof(Rule)); (curr_rule -> next_rule) = new_rule; curr_rule = new_rule; } curr_rule ->", "question": "strtok doesnt work as expected, last string in line cannot be obtained", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): //get the target name targets = strtok(line, \" \"); printf(\"%s \\n\", targets); //create the Rule datatype if (curr_rule == NULL){ curr_rule = malloc(sizeof(Rule)); head = curr_rule; }else{ Rule * new_rule = malloc(sizeof(Rule)); (curr_rule -> next_rule) = new_rule; curr_rule = new_rule; } curr_rule ->", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: skip the first character in a string literal", "question": "skip the first character in a string literal", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: print a char** array", "question": "print a char** array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how does recursion work in C?", "question": "how does recursion work in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i make my function wait on a recursive call without using fork in C?", "question": "how do i make my function wait on a recursive call without using fork in C?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i use random in C? it says it need RAND_MAX, how do i set it myself?", "question": "how do i use random in C? it says it need RAND_MAX, how do i set it myself?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: not reading binary file correctly. giving me random values. | Code context (simplify for kids): #include #include #include #include #include #define MESSAGE \"%ld reads were done in %ld seconds.\\n\" long num_reads, seconds; int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, \"Usage: time_reads s filename\\n\"); exit(1); } secon", "question": "not reading binary file correctly. giving me random values.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: I am unable to use asprintf, eventhough i have defined _GNU_SOURCE and imported stdio.h", "question": "I am unable to use asprintf, eventhough i have defined _GNU_SOURCE and imported stdio.h", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is the function strcpy safe?", "question": "Is the function strcpy safe?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to copy a string to an array of char in C safely?", "question": "How to copy a string to an array of char in C safely?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): hile (scanf(\" %c %s %*d %*s %*s %d %*s %*d %*s %*s\", &file_type, permissions, &file_size) != EOF) {", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): while (scanf(\" %c %s %*d %*s %*s %d %*s %*d %*s %*s\", &file_type, permissions, &file_size) != EOF) {scanf(\" %s %d \", temp_s, &temp_i); while (scanf(\" %c %s %*d %*s %*s %d %*s %*d %*s %*s \", &file_type, permissions, &file_size) != EOF) { if (file_type == '-' && file_size > cutoff_size) { if (argc == ", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): while (scanf(\" %c %s %*d %*s %*s %d %*s %*d %*s %*s \", &file_type, permissions, &file_size) != EOF) { if (file_type == '-' && file_size > cutoff_size) { if (argc == 2){ count_so_far++; } else { if (check_permissions(permissions, argv[2]) == 0) { count_so_far++; } } } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why should I put a space after the last %*s | Code context (simplify for kids): while (scanf(\" %c %s %*d %*s %*s %d %*s %*d %*s %*s \", &file_type, permissions, &file_size) != EOF) { if (file_type == '-' && file_size > cutoff_size) { if (argc == 2){ count_so_far++; } else { if (check_permissions(permissions, argv[2]) == 0) { count_so_far++; } } } }", "question": "why should I put a space after the last %*s", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int age[5] = {4, 70, 52, 18, 16}; int *p = age;", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is phone used instead of &phone? | Code context (simplify for kids): char phone[11]; scanf(\"%s %d\", phone, &index);", "question": "Why is phone used instead of &phone?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: get string input and store it in phone. | Code context (simplify for kids): char phone[11]; scanf(\"%s %d\", &phone);", "question": "", "intention": "get string input and store it in phone.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: why is system(\"ls -l\") of type int?", "question": "why is system(\"ls -l\") of type int?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does scanf read multiple lines?", "question": "does scanf read multiple lines?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do I only print certain part of stdin? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } if (argc == 2) { char line[32]; while (fgets(line, 32, stdin) != NULL) { printf(\"%s\", line); } } return 0; }", "question": "how do I only print certain part of stdin?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i parse stdin without strtok? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } if (argc == 2) { char line[32]; while (fgets(line, 32, stdin) != NULL) { printf(\"%s\", line); } } return 0; }", "question": "how do i parse stdin without strtok?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i parse stdin with strtol? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } if (argc == 2) { char line[32]; while (fgets(line, 32, stdin) != NULL) { printf(\"%s\", line); } } return 0; }", "question": "how do i parse stdin with strtol?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: inputs of scanf? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } if (argc == 2) { char line[32]; while (fgets(line, 32, stdin) != NULL) { printf(\"%s\", line); } } return 0; }", "question": "inputs of scanf?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if my stdin is \"hello yo 3 191 so what\" what are my scanf arguments?", "question": "if my stdin is \"hello yo 3 191 so what\" what are my scanf arguments?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if my stdin is \"-rwxrwxrwx 1 kimluci2 kimluci2 763 Jan 22 18:05 Makefile\" what are my scanf arguments?", "question": "if my stdin is \"-rwxrwxrwx 1 kimluci2 kimluci2 763 Jan 22 18:05 Makefile\" what are my scanf arguments?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i skip the first line of stdin when scanf?", "question": "how do i skip the first line of stdin when scanf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the type of %c%10s", "question": "what is the type of %c%10s", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i initialize a variable of %c%10s", "question": "how do i initialize a variable of %c%10s", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is %c variable declared as char", "question": "is %c variable declared as char", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does EOF do | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (argc == 2) { int total = 0; char dir; char perms[10]; int size; int param1 = strtol(argv[1], NULL, 10); while (scanf", "question": "what does EOF do", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does == 3 in the while loop do | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (argc == 2) { int total = 0; char dir; char perms[10]; int size; int param1 = strtol(argv[1], NULL, 10); while (scanf", "question": "what does == 3 in the while loop do", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i make scanf ignore the first line?", "question": "how do i make scanf ignore the first line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i make scanf skip a specific line? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (argc == 2) { int total = 0; char dir; char perms[10]; int size; int param1 = strtol(argv[1], NULL, 10); while (scanf", "question": "how do i make scanf skip a specific line?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: %*[^\\n] what does ths do", "question": "%*[^\\n] what does ths do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i ONLY skip the first line from stdin?? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (argc == 2) { int total = 0; char dir; char perms[10]; int size; int param1 = strtol(argv[1], NULL, 10); while (scanf", "question": "how do i ONLY skip the first line from stdin??", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is (dir == \"-\") giving me errors? | Code context (simplify for kids): int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } // TODO: Process command line arguments. if (argc == 2) { int total = 0; char dir; char perms[10]; int size; int param1 = strtol(argv[1], NULL, 10); scanf(\"%*[^\\", "question": "why is (dir == \"-\") giving me errors?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to check a given integer is 9 digits using % 10 or / 10", "question": "how to check a given integer is 9 digits using % 10 or / 10", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return | Code context (simplify for kids): int help = 100000000 % 10; printf(\"%d\", help);", "question": "what does this return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return | Code context (simplify for kids): int help = 100923999 % 10; printf(\"%d\", help);", "question": "what does this return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i check that a given integer is 9 digits?", "question": "how do i check that a given integer is 9 digits?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i check that a given integer is 9 digits with math operations?", "question": "how do i check that a given integer is 9 digits with math operations?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i use % 10 and / 10 to calculate the digits?", "question": "how do i use % 10 and / 10 to calculate the digits?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i populate an array with a given integer?", "question": "how do i populate an array with a given integer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i separate an integer 123 to array [1,2,3]", "question": "how do i separate an integer 123 to array [1,2,3]", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check how many digits an integer has", "question": "how to check how many digits an integer has", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if i % 2 == 1", "question": "if i % 2 == 1", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print | Code context (simplify for kids): printf(2 / 10);", "question": "what does this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: waht does this print | Code context (simplify for kids): int i = 2/10; printf(\"%d\", i);", "question": "waht does this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print | Code context (simplify for kids): int i = 12/10; printf(\"%d\", i);", "question": "what does this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to check if integer is divisible by 10", "question": "how to check if integer is divisible by 10", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i get the length of all argv", "question": "how do i get the length of all argv", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int c = 6/2; printf(\"%d\", c);", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print? | Code context (simplify for kids): int c = 6/2; printf(\"%d\", c);", "question": "what does this print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do i pass in an array of argv elements", "question": "how do i pass in an array of argv elements", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i get all argv and pass it in an array to helper method", "question": "how do i get all argv and pass it in an array to helper method", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i build an array from argv inputs?", "question": "how do i build an array from argv inputs?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you loop through the argv elements", "question": "how do you loop through the argv elements", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print | Code context (simplify for kids): int c = 3/2; printf(\"%d\", c);", "question": "what does this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you do ceiling?", "question": "how do you do ceiling?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you do ceiling without importing libraries??????", "question": "how do you do ceiling without importing libraries??????", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i make this return 2 | Code context (simplify for kids): int c = 3/2; printf(\"%d\", c);", "question": "how do i make this return 2", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return | Code context (simplify for kids): int c = 3/2.0; printf(\"%d\", c);", "question": "what does this return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return? | Code context (simplify for kids): int c; c = (int) 3/2; printf(\"%d\", c);", "question": "what does this return?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what doe sthis return | Code context (simplify for kids): int c = (3 / 2) + ((3 % 2) != 0); printf(\"%d\", c);", "question": "what doe sthis return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return? | Code context (simplify for kids): int c = (4 / 2) + ((4 % 2) != 0); printf(\"%d\", c);", "question": "what does this return?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: rwjat does this reutn | Code context (simplify for kids): int c = int((4 / 2) + ((4 % 2) != 0)); printf(\"%d\", c);", "question": "rwjat does this reutn", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: waht does this reutnr? | Code context (simplify for kids): int c = (4 / 2) + ((4 % 2) != 0); printf(\"%d\", c);", "question": "waht does this reutnr?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print? | Code context (simplify for kids): int c; printf(\"%d\", c+1);", "question": "what does this print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of c+1? | Code context (simplify for kids): int c; printf(\"%d\", c+1);", "question": "what is the value of c+1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is c=+1? | Code context (simplify for kids): int c; printf(\"%d\", c=+1);", "question": "what is c=+1?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of c? | Code context (simplify for kids): int c; c+=1;", "question": "what is the value of c?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is the value of c? | Code context (simplify for kids): int c=0; c+=1;", "question": "what is the value of c?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: print Same if the 2 arguments are the same. | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { printf(\"Invalid\\n\"); } else { if (s1 == s2) { printf(\"Same\\n\"); } else { printf(\"Different\\n\"); } } return 0; }", "question": "", "intention": "print Same if the 2 arguments are the same.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: compare argv[1] to argv[2] without using strcmp | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { printf(\"Invalid\\n\"); } else { if (argv[1] == argv[2]) { printf(\"Same\\n\"); } else { printf(\"Different\\n\"); } } return 0; }", "question": "", "intention": "compare argv[1] to argv[2] without using strcmp", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how do i concatenate a space after copying hi to greeting? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, \"Usage: greeting message name\\n\"); return 1; } char greeting[20]; char *name = argv[2]; // Your code goes here char *hi = argv[1]; strncpy(greeting, hi, sizeof(greeting) - 1); strncat(greeting, ' ', sizeof(greeting) - strlen(greeting", "question": "", "intention": "how do i concatenate a space after copying hi to greeting?", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how do i make sure greeting is properly null terminated after strncpy call? | Code context (simplify for kids): int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, \"Usage: greeting message name\\n\"); return 1; } char greeting[20]; char *name = argv[2]; // Your code goes here char *hi = argv[1]; strncpy(greeting, hi, sizeof(greeting) - 1); strncat(greeting, \" \", sizeof(greeting) - strlen(greeting", "question": "", "intention": "how do i make sure greeting is properly null terminated after strncpy call?", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you remove the last few question marks from a given string?", "question": "how do you remove the last few question marks from a given string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: if p-s-1 != \"?\" return 0, else return the value | Code context (simplify for kids): int strip_q_marks(char *s) { char *p; p = strchr(s, '\\0'); if (s[p-s-1] != \"?\") { return 0; } else { printf(\"%d\\n\", p-s-1); } }", "question": "", "intention": "if p-s-1 != \"?\" return 0, else return the value", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: change s to be s of length at most n | Code context (simplify for kids): int truncate(char *s, int n) { int p = strlen(s); if (p <= n) { return 0; } else { strncpy(s, s, n); int q = strlen(s); return p - q; } }", "question": "", "intention": "change s to be s of length at most n", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: modify s to a string with max character of n in line 7. | Code context (simplify for kids): int truncate(char *s, int n) { int p = strlen(s); if (p <= n) { return 0; } else { strncpy(s, s, n); s[n+1] = '\\0'; int q = strlen(s); return p - q; } }", "question": "", "intention": "modify s to a string with max character of n in line 7.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Does fseek in c take in bits or bytes for offset?", "question": "Does fseek in c take in bits or bytes for offset?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does fread take in bytes as element size?", "question": "does fread take in bytes as element size?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When you fseek with pointer by 0 distance with respect to end of file what value do you print?", "question": "When you fseek with pointer by 0 distance with respect to end of file what value do you print?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how many characters does this have? | Code context (simplify for kids): \"Someone over there is calling you. we are going for work. take care of yourself.\"", "question": "how many characters does this have?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Why do i get this error? assignment to ‘int *’ from ‘size_t’ {aka ‘long unsigned int’} makes pointer from integer without a cast [-Wint-conversion] 13 | pixel_array_offset = fread(&pointer, 4, 1, image); | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { int pointer; pointer = fseek(image, 10, SEEK_SET); pixel_array_offset = fread(&pointer, 4, 1, image); pointer = fseek(image, 18, SEEK_SET); width = fread(&pointer, 4, 1, image); pointer = fseek(image, 22, SEEK", "question": "", "intention": "Why do i get this error? assignment to ‘int *’ from ‘size_t’ {aka ‘long unsigned int’} makes pointer from integer without a cast [-Wint-conversion] 13 | pixel_array_offset = fread(&pointer, 4, 1, image);", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: why does this not free the memory i used for pixels? | Code context (simplify for kids): for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { free(pixels[i][j]); } } free(pixels);", "question": "", "intention": "why does this not free the memory i used for pixels?", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why would you pass in User **user_ptr_add here | Code context (simplify for kids): /* * Create a new user with the given name. Insert it at the tail of the list * of users whose head is pointed to by *user_ptr_add. * * Return: * - 0 if successful * - 1 if a user by this name already exists in this list * - 2 if the given name cannot fit in the 'name' array * (don't forget about th", "question": "why would you pass in User **user_ptr_add here", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why is user_ptr_add passed in as a pointer to a pointer | Code context (simplify for kids): int create_user(const char *name, User **user_ptr_add) { User *curr = user_ptr_add; while (curr->next != NULL) { curr = curr->next } return -1; }", "question": "why is user_ptr_add passed in as a pointer to a pointer", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: traverse through the Users until it reaches the end | Code context (simplify for kids): int create_user(const char *name, User **user_ptr_add) { User *curr = user_ptr_add; while (curr->next != NULL) { curr = curr->next } return -1; }", "question": "", "intention": "traverse through the Users until it reaches the end", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what happens when you make a struct with members and don't initialize all its contents?", "question": "what happens when you make a struct with members and don't initialize all its contents?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you do \"pass\" in c", "question": "how do you do \"pass\" in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this the right way to return 1 if the file does not exist or cannot be opened? | Code context (simplify for kids): int update_pic(User *user, const char *filename) { // file cannot be opened FILE *file = fopen(filename, \"rb\"); if (file == NULL) { return 2; } return -1; }", "question": "is this the right way to return 1 if the file does not exist or cannot be opened?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does this return 2 if the file does not exist or cannot be opened? | Code context (simplify for kids): int update_pic(User *user, const char *filename) { // file cannot be opened FILE *file = fopen(filename, \"rb\"); if (file == NULL) { return 2; } return -1; }", "question": "does this return 2 if the file does not exist or cannot be opened?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how do i return 1 if the two users are already friends? | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *curr1 = head; User *curr2 = head; User *store1 = NULL; User *store2 = NULL; while (curr1 != NULL) { if (strcmp(curr1->name, name1) == 0) { store1 = curr1; } else { curr1 = curr1->next; } } while (curr2 != NULL) { if (strcmp(c", "question": "", "intention": "how do i return 1 if the two users are already friends?", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *curr1 = head; User *curr2 = head; User *store1 = NULL; User *store2 = NULL; while (curr1 != NULL) { if (strcmp(curr1->name, name1) == 0) { store1 = curr1; } else { curr1 = curr1->next; } } while (curr2 != NULL) { if (strcmp(c", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you write file to standard output?", "question": "how do you write file to standard output?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: make 2 valid users friends if they are not already friends | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *curr1 = head; User *curr2 = head; while (curr1 != NULL && strcmp(curr1->name, name1) != 0) { curr1 = curr1->next; } while (curr2 != NULL && strcmp(curr2->name, name2) != 0) { curr2 = curr2->next; } if (curr1 == NULL || curr2 ", "question": "", "intention": "make 2 valid users friends if they are not already friends", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: gives a nice human-readable representation of the date and time of each post in the format, \"Friday Jan 27 23:01:00 2023\". Use the time and ctime functions to find the current time and convert a time value to a string, respectively.", "question": "gives a nice human-readable representation of the date and time of each post in the format, \"Friday Jan 27 23:01:00 2023\". Use the time and ctime functions to find the current time and convert a time value to a string, respectively.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i use ctime to convert this into a string? | Code context (simplify for kids): time_t current_time = time(NULL);", "question": "how do i use ctime to convert this into a string?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? (You do not need to include the options to display warnings, build the symbol table for the debugger or select the C standard.) | Code context (simplify for kids): #include int main() { #ifdef MACRO printf(\"%d\\n\", MACRO); #endif return 0; }", "question": "What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? (You do not need to include the options to display warnings, build the symbol table for the debugger or select the C standard.)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #define MAXNAME = 32; and then the declaration char name[MAXNAME];", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: in the program. What will this declaration line become after the program has passed through the C pre-processor? | Code context (simplify for kids): #define MAXNAME = 32; and then the declaration char name[MAXNAME];", "question": "in the program. What will this declaration line become after the program has passed through the C pre-processor?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What will be the output of the following program fragment? | Code context (simplify for kids): #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf(\"pay is %d\\n\", (hours_worked * SUPERVISOR(regular_pay))); // rest omitted }", "question": "What will be the output of the following program fragment?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is the line to compile it into an executable named a.out that it will print the value 5 to stdout? | Code context (simplify for kids): #include int main() { #ifdef MACRO printf(\"%d\\n\", MACRO); #endif return 0; }", "question": "What is the line to compile it into an executable named a.out that it will print the value 5 to stdout?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to you hard code strncpy?", "question": "how to you hard code strncpy?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print? | Code context (simplify for kids): src = \"abcdefghijklmno\" strncpy(dest, src, 10); dest[9] = '\\0'; printf(\"%s\", dest);", "question": "what does this print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: does dest have a null terminator | Code context (simplify for kids): src = \"abcdefghijklmno\" strncpy(dest, src, 10); dest[9] = '\\0'; printf(\"%s\", dest);", "question": "does dest have a null terminator", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print | Code context (simplify for kids): src = \"abcdefghijklmno\" strncpy(dest, src, 10); dest[7] = '\\0'; printf(\"%s\", dest);", "question": "what does this print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 4 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this print? | Code context (simplify for kids): #include #define SIZE 4 #define OVERFLOW 4 int main() { int index = 0; int i; int before[SIZE] = {10, 10, 10, 10}; int a[SIZE] = {0, 0, 0, 0}; int after[SIZE] = {10, 10, 10, 10}; printf(\"Address of the variables:\\n\"); for (index = 0; index < SIZE; index++) { printf(\"%lx -> &after[%d]\\n\", (", "question": "what does this print?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: if i set the middle of a char array to '\\0', would the values after it become null values as well", "question": "if i set the middle of a char array to '\\0', would the values after it become null values as well", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if i have char *s with size 10 and s[6] is originally 'a', then make s[5]='\\0', what would s[6] be", "question": "if i have char *s with size 10 and s[6] is originally 'a', then make s[5]='\\0', what would s[6] be", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: What are all possible combinations that the output can be | Code context (simplify for kids): #include #include #include int main() { int ret; printf(\"A\\n\"); ret = fork(); printf(\"B\\n\"); if (ret < 0) { perror(\"fork\"); exit(1); } else if (ret == 0) { printf(\"C\\n\"); } else { printf(\"D\\n\"); } printf(\"E\\n\"); return 0; }", "question": "What are all possible combinations that the output can be", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: can the output be something other than A B D E B C E | Code context (simplify for kids): #include #include #include int main() { int ret; printf(\"A\\n\"); ret = fork(); printf(\"B\\n\"); if (ret < 0) { perror(\"fork\"); exit(1); } else if (ret == 0) { printf(\"C\\n\"); } else { printf(\"D\\n\"); } printf(\"E\\n\"); return 0; }", "question": "can the output be something other than A B D E B C E", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: how do i modify the program so that each process creates exactly one a new process? | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "how do i modify the program so that each process creates exactly one a new process?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: modify the program so that each process creates exactly one a new process. | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "modify the program so that each process creates exactly one a new process.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: how do you add an if statement that checks if the process is a child | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0) { perror(\"fork\"); ", "question": "", "intention": "how do you add an if statement that checks if the process is a child", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do you check if a line from fgets starts with a tab?", "question": "how do you check if a line from fgets starts with a tab?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: what is line[0] from this? | Code context (simplify for kids): char line[50]; line = \" hello\";", "question": "what is line[0] from this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what is line[0] from this? | Code context (simplify for kids): char line[50]; strcpy(line, \" hello\");", "question": "what is line[0] from this?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return | Code context (simplify for kids): char line[50]; strcpy(line, \" hello\"); if (line[0] == \"\\t\") { printf(\"yay\"); }", "question": "what does this return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what does this return | Code context (simplify for kids): char line[50]; strcpy(line, \" hello\"); if (line[0] == \\t) { printf(\"yay\"); }", "question": "what does this return", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): char *args_to_string(char **args, char *buffer, int size) { buffer[0] = '\\0'; int i = 0; while (args[i] != NULL) { strncat(buffer, args[i], size - strlen(buffer)); strncat(buffer, \" \", size - strlen(buffer)); i++; } return buffer; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: explain how fseek works", "question": "explain how fseek works", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there a difference between exit(0) and return 0 from main in C", "question": "is there a difference between exit(0) and return 0 from main in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i free malloced memory", "question": "how do i free malloced memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: explain the C dup2 function", "question": "explain the C dup2 function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does my truncate function not change s | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "Why does my truncate function not change s", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I change the value of s | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "How do I change the value of s", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I create the function truncate from the information in lines 6 to 12 | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "How do I create the function truncate from the information in lines 6 to 12", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I change s in truncate to a different string | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "How do I change s in truncate to a different string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate | Code context (simplify for kids): #include #include #include /* Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters ", "question": "", "intention": "Write a function named truncate() that takes a string s and a non-negative integer n. If s has more than n characters (not including the null terminator), the function should truncate s at n characters and return the number of characters that were removed. If s has n or fewer characters, s is unchanged and the function returns 0. For example, if s is the string \"function\" and n is 3, then truncate", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What is wrong with my code | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User user1 = NULL; User user2 = NULL; while(head != NULL){ if (strcmp(name1, head->name) == 0){ user1 = *head; } else if (strcmp(name2, head->name) == 0){ user2 = *head; } else{ head = head->next; } } if ((user1 == NULL) || (user2 ", "question": "What is wrong with my code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What's wrong with my code | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *user1 = NULL; User *user2 = NULL; while(head != NULL){ if (strcmp(name1, head->name) == 0){ user1 = head; } else if (strcmp(name2, head->name) == 0){ user2 = head; } else{ head = head->next; } } if ((user1 == NULL) || (user2 ", "question": "What's wrong with my code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What's wrong with my code | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User *user1 = NULL; User *user2 = NULL; while(head != NULL){ if (strcmp(name1, head->name) == 0){ user1 = head; } else if (strcmp(name2, head->name) == 0){ user2 = head; } else{ head = head->next; } } if ((user1 == NULL) || (user2 ", "question": "What's wrong with my code", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What does my code print | Code context (simplify for kids): #define SUPERVISOR(regular) regular + 5 int main() { int regular_pay = 20; int hours_worked = 10; printf(\"pay is %d\\n\", (hours_worked * SUPERVISOR(regular_pay))); }", "question": "What does my code print", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why am I getting a warning when I try to wait for the child process to finish (line 24) | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid = getpid(); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0", "question": "Why am I getting a warning when I try to wait for the child process to finish (line 24)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: what should I put in the parameter of wait so that the child process finishes first (line 24) | Code context (simplify for kids): #include #include #include int main(int argc, char **argv) { if (argc != 2) { fprintf(stderr, \"Usage: forkloop \\n\"); exit(1); } int iterations = strtol(argv[1], NULL, 10); int pid = getpid(); for (int i = 0; i < iterations; i++) { int n = fork(); if (n < 0", "question": "what should I put in the parameter of wait so that the child process finishes first (line 24)", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to initialize the pointer allocated to point to heap-allocated space for an entire row of pixel data.", "question": "how to initialize the pointer allocated to point to heap-allocated space for an entire row of pixel data.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: byte 10 - 13 should be the value for pixel_array_offset, byte 18 - 21 should be the value for width and byte 22-25 should be the height. | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image, 10, SEEK_SET); error = fread(pixel_array_offset,4,1,image); fseek(image, 18, SEEK_SET); error = fread(width,4,1,image); fseek(image, 22, SEEK_SET); error = fread(height,4,1,image); }", "question": "", "intention": "byte 10 - 13 should be the value for pixel_array_offset, byte 18 - 21 should be the value for width and byte 22-25 should be the height.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: pixel_array_offset should assign the value in byte 10 - 13 of the file, byte 18 - 21 should be the value for width should be assigned the value of byte 18 - 21 of the file, height should be assign the value of byte 22-25 of the file | Code context (simplify for kids): void read_bitmap_metadata(FILE *image, int *pixel_array_offset, int *width, int *height) { fseek(image, 10, SEEK_SET); error = fread(pixel_array_offset,4,1,image); fseek(image, 18, SEEK_SET); error = fread(width,4,1,image); fseek(image, 22, SEEK_SET); error = fread(height,4,1,image); }", "question": "", "intention": "pixel_array_offset should assign the value in byte 10 - 13 of the file, byte 18 - 21 should be the value for width should be assigned the value of byte 18 - 21 of the file, height should be assign the value of byte 22-25 of the file", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: assign arg[v] to cmd_permission | Code context (simplify for kids): char cmd_permission[10]; cmd_permission = argv[2];", "question": "", "intention": "assign arg[v] to cmd_permission", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to assign string to char array", "question": "how to assign string to char array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: assign string to char array without strcpy()", "question": "assign string to char array without strcpy()", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: initialize an array with height elements | Code context (simplify for kids): struct pixel **read_pixel_array(FILE *image, int pixel_array_offset, int width, int height) { struct pixel *pixel_arr[height]; }", "question": "", "intention": "initialize an array with height elements", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to use gdb with multiple files", "question": "how to use gdb with multiple files", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use gdb", "question": "how to use gdb", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to run next line in gdb", "question": "how to run next line in gdb", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does fopen() return if file does not exist?", "question": "what does fopen() return if file does not exist?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to go back in gdp?", "question": "how to go back in gdp?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i pass a User * type into a const User * type?", "question": "can i pass a User * type into a const User * type?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you negative index an array?", "question": "can you negative index an array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you initialise an array of 0 elements?", "question": "can you initialise an array of 0 elements?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i set all elements of an array to NULL?", "question": "how can i set all elements of an array to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to run until breakpoint in gdb?", "question": "how to run until breakpoint in gdb?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i set a string to NULL?", "question": "can i set a string to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: ho to print contents of a text file with fopen?", "question": "ho to print contents of a text file with fopen?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: do you have to fclose on a NULL stream?", "question": "do you have to fclose on a NULL stream?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: fgets return value?", "question": "fgets return value?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to define char array in function parameter?", "question": "how to define char array in function parameter?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use ctime?", "question": "how to use ctime?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: assign the pointer value to time(NULL) | Code context (simplify for kids): *curr_time = time(NULL);", "question": "", "intention": "assign the pointer value to time(NULL)", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: does fgets() read empty lines?", "question": "does fgets() read empty lines?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the purpose of NULL passed to execl()?", "question": "what is the purpose of NULL passed to execl()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to write multiple values to a pipe?", "question": "how to write multiple values to a pipe?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i use strtok() to split on spaces and tabs?", "question": "how can i use strtok() to split on spaces and tabs?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use strtok() to find comments?", "question": "how to use strtok() to find comments?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i index a char *pointer?", "question": "can i index a char *pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does fgets() read \\n character for blank lines?", "question": "does fgets() read \\n character for blank lines?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i tell if a string starts with a \\t tab character?", "question": "how can i tell if a string starts with a \\t tab character?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you compare characters with == ?", "question": "can you compare characters with == ?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i set a struct attribute to a read-only string in a helper function?", "question": "can i set a struct attribute to a read-only string in a helper function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when should i malloc a string vs just assign it in a helper function?", "question": "when should i malloc a string vs just assign it in a helper function?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to call strtok repeatedly on the same line?", "question": "how to call strtok repeatedly on the same line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is there a function to count the number of words in a string?", "question": "is there a function to count the number of words in a string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you initailize an array of size 0?", "question": "can you initailize an array of size 0?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is returned if strtok() is called on a whitespace line?", "question": "what is returned if strtok() is called on a whitespace line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to strip a string of specific characters?", "question": "how to strip a string of specific characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does strtok remove tabs when passed \" \"?", "question": "does strtok remove tabs when passed \" \"?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what's the \\r character?", "question": "what's the \\r character?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what happens if you call strtok() with NULL?", "question": "what happens if you call strtok() with NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to strip \\n character with gets?", "question": "how to strip \\n character with gets?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to strip \\n character with fgets?", "question": "how to strip \\n character with fgets?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when does strtok end?", "question": "when does strtok end?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does strncpy copy the null terminator?", "question": "does strncpy copy the null terminator?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to edit value of a dynamically allocated string?", "question": "how to edit value of a dynamically allocated string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to get the size of an array?", "question": "how to get the size of an array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what type does malloc(sizeof(char *)) return?", "question": "what type does malloc(sizeof(char *)) return?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i check if a variables been declaared or not?", "question": "can i check if a variables been declaared or not?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use strchr to replace a character with another?", "question": "how to use strchr to replace a character with another?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Student question: replace \\r character with \\0 | Code context (simplify for kids): if ((newline_index = strchr(curr_line, '\\r')) != NULL) { *newline_index = '\\0'; }", "question": "replace \\r character with \\0", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to clear a character array?", "question": "how to clear a character array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you set a character array to NULL?", "question": "can you set a character array to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to write ineteger to a binary file?", "question": "how to write ineteger to a binary file?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can i use % string formating in a write() call?", "question": "can i use % string formating in a write() call?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is the first argument passed to select()?", "question": "what is the first argument passed to select()?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to check if a pointer points to NULL?", "question": "how to check if a pointer points to NULL?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to malloc an int for a struct", "question": "how to malloc an int for a struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: will this code safely allocate an int on the heap? | Code context (simplify for kids): int *ptr = malloc(sizeof(int)); int num = 42; *ptr = num;", "question": "will this code safely allocate an int on the heap?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to use write to write to a buffer string?", "question": "how to use write to write to a buffer string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: when do you have to close a fd?", "question": "when do you have to close a fd?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: does this properly set buf to an empty string? | Code context (simplify for kids): char buf[5]; buf = {'/0'};", "question": "does this properly set buf to an empty string?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is it that if I sigint at position A, the process is terminated? I didn't call quit in the handler function | Code context (simplify for kids): int x = 5; void handler(int sig) { x += 3; fprintf(stderr, \"inside %d \", x); } int main() { fprintf(stderr, \"start \"); struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); x += 2; fprintf(stderr, \"outside %d\", x); return 0; }", "question": "Why is it that if I sigint at position A, the process is terminated? I didn't call quit in the handler function", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: A signal handling function that you write must always have the same signature.Why is this true?", "question": "A signal handling function that you write must always have the same signature.Why is this true?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Set the time of the post to the current time using time() | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents) { // check if users exist if (author == NULL || target == NULL){ return 2; } // check if they are friends int isFriend = 0; for (int i = 0; i < MAX_FRIENDS; i++){ if (author->friends[i] == target){ isFriend = 1; break; } } if (isFriend ", "question": "", "intention": "Set the time of the post to the current time using time()", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Print user profile and any associated posts. However the time is not printed properly. | Code context (simplify for kids): int print_user(const User *user) { if (user == NULL){ return 1; } printf(\"------------------------------------------\\n\"); printf(\"Posts:\\n\"); // print posts Post* currPost = user->first_post; while (currPost != NULL){ printf(\"From: %s\\n\", currPost->author); printf(\"Date: %s\\n\", ctime(currPost->date)", "question": "", "intention": "Print user profile and any associated posts. However the time is not printed properly.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: the time is not printed properly from line 71 | Code context (simplify for kids): int make_post(const User *author, User *target, char *contents) { // check if users exist if (author == NULL || target == NULL){ return 2; } // check if they are friends int isFriend = 0; for (int i = 0; i < MAX_FRIENDS; i++){ if (author->friends[i] == target){ isFriend = 1; break; } } if (isFriend ", "question": "the time is not printed properly from line 71", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: /* * Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if t | Code context (simplify for kids): int make_friends(const char *name1, const char *name2, User *head) { User* curr1 = find_user(name1, head); User* curr2 = find_user(name2, head); // check if user exists if (curr1 == NULL || curr2 == NULL){ return 4; } // check if the same user is passed in twice if (curr1 == curr2){ return 3; } // c", "question": "", "intention": "/* * Make two users friends with each other. This is symmetric - a pointer to * each user must be stored in the 'friends' array of the other. * * New friends must be added in the first empty spot in the 'friends' array. * * Return: * - 0 on success. * - 1 if the two users are already friends. * - 2 if the users are not already friends, but at least one already has * MAX_FRIENDS friends. * - 3 if t", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Student question: This code recursively evaluates rules by comparing the most recent modification time. | Code context (simplify for kids): void evaluate_rule(Rule *rule, struct stat *parent_stat){ // given some conditions, execute action of the rule (compares dependencies) struct stat rule_stat; stat(rule->target, &rule_stat); Dependency *cur_dep = rule->dependencies; if(cur_dep != NULL){ // recursively call on dependency rules while(c", "question": "This code recursively evaluates rules by comparing the most recent modification time.", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: I want to write code that recursively calls the function through a linked list structure with each node being its own linked list. For each function call, I want to call a helper function: evaluate(Node).", "question": "", "intention": "", "task_description": "I want to write code that recursively calls the function through a linked list structure with each node being its own linked list. For each function call, I want to call a helper function: evaluate(Node).", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Write function: Evaluate. This function traverses a linked list with linked list nodes and recursively calls the function. The base case prints the value at the node.", "question": "", "intention": "", "task_description": "Write function: Evaluate. This function traverses a linked list with linked list nodes and recursively calls the function. The base case prints the value at the node.", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I print an emoji to stdout?", "question": "How do I print an emoji to stdout?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: Implement a max-heap data structure", "question": "", "intention": "", "task_description": "Implement a max-heap data structure", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you read a string from stdin using scanf?", "question": "How do you read a string from stdin using scanf?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does %10s do?", "question": "What does %10s do?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the type for a pointer to a struct?", "question": "What is the type for a pointer to a struct?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Write Code", "problem_stem": "Task: I want to take a string like \"main : dep1 dep2\" and split it into the two strings \"main\" and \"dep1 dep2\"", "question": "", "intention": "", "task_description": "I want to take a string like \"main : dep1 dep2\" and split it into the two strings \"main\" and \"dep1 dep2\"", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How can you use strtok to handle multiple delimiter characters?", "question": "How can you use strtok to handle multiple delimiter characters?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Explain Code", "problem_stem": "Code context (simplify for kids): #include #include #include int main() { char str_to_delim[] = \"name : dep1 dep2\"; strtok(str_to_delim, \" :\"); return 0; }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how do I get the size of an array that's passed into the main function", "question": "how do I get the size of an array that's passed into the main function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you get the size of **argv", "question": "how do you get the size of **argv", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do you get the size of **argv that's passed into main", "question": "How do you get the size of **argv that's passed into main", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use command line from within a program", "question": "How do I use command line from within a program", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the variable type of system(\"ls -l\")", "question": "What is the variable type of system(\"ls -l\")", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do I use char** to hold the information of system(\"ls -l\")", "question": "Do I use char** to hold the information of system(\"ls -l\")", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do I call scanf for each line that directed to it from the shell", "question": "Do I call scanf for each line that directed to it from the shell", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Supposed to take in a single line of input with 9 different variables and print the 5th one | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; scanf(\"%10s %31s %31s %31s %d %3s %3s %6s %31s\", s, idk, username, groupname, &size, month, date, time, filename", "question": "", "intention": "Supposed to take in a single line of input with 9 different variables and print the 5th one", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Supposed to take in a single line of input with 9 different variables and print the 5th one | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; scanf(\"%9s %30s %30s %30s %d %2s %2s %5s %30s\", s, idk, username, groupname, &size, month, date, time, filename)", "question": "", "intention": "Supposed to take in a single line of input with 9 different variables and print the 5th one", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Supposed to take in a single line of input with 9 different variables and print the 5th one (which is an integer) | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; scanf(\"%9s %30s %30s %30s %d %2s %2s %5s %30s\", s, idk, username, groupname, &size, month, date, time, filename)", "question": "", "intention": "Supposed to take in a single line of input with 9 different variables and print the 5th one (which is an integer)", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is it printing a random number instead of the number I inputted | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; scanf(\"%9s %30s %30s %30s %d %2s %2s %5s %30s\", s, idk, username, groupname, &size, month, date, time, filename)", "question": "Why is it printing a random number instead of the number I inputted", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is printf printing a random number when scanf sets the number before the printf function | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; scanf(\"%9s %30s %30s %30s %d %2s %2s %5s %30s\", s, idk, username, groupname, &size, month, date, time, filename)", "question": "Why is printf printing a random number when scanf sets the number before the printf function", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why is printf printing a 0 when scanf should change size before the printf function | Code context (simplify for kids): #include #include int main(){ char s[10]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; char date[3]; char time[6]; char filename[31]; size = 0; scanf(\"%9s %30s %30s %30s %d %2s %2s %5s %30s\", s, idk, username, groupname, &size, month, date, time,", "question": "Why is printf printing a 0 when scanf should change size before the printf function", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: If we are inputting a file into a program from shell, can we tell how many lines are in the file", "question": "If we are inputting a file into a program from shell, can we tell how many lines are in the file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I take a subsection of a string", "question": "How do I take a subsection of a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I split an input into two variables if there is no space between them", "question": "Can I split an input into two variables if there is no space between them", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I split the input of a string into two by using %c first and then %8s", "question": "Can I split the input of a string into two by using %c first and then %8s", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 4 strings and an int. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print directory, permissions and size to make sure the first string was split properly and the integer was also taken correctly. | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char groupname[31]; int size; size = 0; scanf(\"%c %8s %30s %30s %30s %d\", directory, permissions, idk, username, groupname, &size); printf(\"%c %8s %d \\n\", directory, permissions, ", "question": "", "intention": "Code is supposed to take 4 strings and an int. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print directory, permissions and size to make sure the first string was split properly and the integer was also taken correctly.", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Does char name[10] specify a string that's 10 characters long or 9 characters long", "question": "Does char name[10] specify a string that's 10 characters long or 9 characters long", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 4 strings and an int. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print directory, permissions and size to make sure the first string was split properly and the integer was also taken correctly. | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char groupname[31]; int size; size = 0; scanf(\"%c %9s %31s %31s %31s %d\", &directory, permissions, idk, username, groupname, &size); printf(\"%c %9s %d \\n\", directory, permissions,", "question": "", "intention": "Code is supposed to take 4 strings and an int. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print directory, permissions and size to make sure the first string was split properly and the integer was also taken correctly.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why do I get the message \"zsh: abort ./testing\" after the proper output when the input is \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char groupname[31]; int size; size = 0; scanf(\"%c %9s %31s %31s %31s %d\", &directory, permissions, idk, username, groupname, &size); printf(\"%c %9s %d \\n\", directory, permissions,", "question": "Why do I get the message \"zsh: abort ./testing\" after the proper output when the input is \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why do I get the message: \"- rwx------ 1734 zsh: abort ./testing\" When the input is \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char groupname[31]; int size; size = 0; scanf(\"%c %9s %31s %31s %31s %d\", &directory, permissions, idk, username, groupname, &size); printf(\"%c %9s %d \\n\", directory, permissions,", "question": "Why do I get the message: \"- rwx------ 1734 zsh: abort ./testing\" When the input is \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 7 strings and 2 ints. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print the variables. | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char groupname[31]; int size; char month[3]; int date; char time[5]; char filename[31]; size = 0; scanf(\" %c %9s %31s %31s %31s %d %3s %d %5s %31s\", &directory, permissions, idk, ", "question": "", "intention": "Code is supposed to take 7 strings and 2 ints. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. The printf will print the variables.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does this input \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\", give this output \"- rwx------ 1 reid staff 1536 Jun 0 14:52 prog zsh: abort ./testing\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; int size; char month[3]; int date; char time[5]; char filename[31]; size = 0; scanf(\" %c %9s %31s %31s %31s %d %3s %d %5s %31s\", &directory, permissions, idk,", "question": "Why does this input \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\", give this output \"- rwx------ 1 reid staff 1536 Jun 0 14:52 prog zsh: abort ./testing\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the correct characters and strings in the printf but wrong ints | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; int size; char month[3]; int date; char time[5]; char filename[31]; size = 0; scanf(\"%c %s %s %s %s %d %s %d %s %s\", &directory, permissions, idk, username, g", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the correct characters and strings in the printf but wrong ints", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the correct characters and strings in the printf but size = 1536 and date = 0 | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; int size; char month[3]; int date; char time[5]; char filename[31]; size = 0; scanf(\"%c %s %s %s %s %d %s %d %s %s\", &directory, permissions, idk, username, g", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the correct characters and strings in the printf but size = 1536 and date = 0", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 9 strings. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[3]; char date[2]; char time[5]; char filename[31]; scanf(\"%c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, username, ", "question": "", "intention": "Code is supposed to take 9 strings. The first string will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 9 strings. The first string is 10 characters long and will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[3]; char date[2]; char time[5]; char filename[31]; scanf(\"%c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, username, ", "question": "", "intention": "Code is supposed to take 9 strings. The first string is 10 characters long and will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\" | Code context (simplify for kids): -rwx------ 1 reid staff 1734 Jun 22 14:52 prog", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\" %c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, userna", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\"%c%s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, username", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" give the error of \"zsh: abort\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I get the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" to not give the error of \"zsh: abort\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\"%c%s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, username", "question": "How do I get the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" to not give the error of \"zsh: abort\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I get the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" to not give the error of \"zsh: abort\" | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\"%c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, usernam", "question": "How do I get the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\" to not give the error of \"zsh: abort\"", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\", give correct print statement, but still give an error after | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\"%c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, usernam", "question": "Why does the input of \"-rwx------ 1 reid staff 1734 Jun 22 14:52 prog\", give correct print statement, but still give an error after", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Code is supposed to take 9 strings. The first string is 10 characters long and will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed | Code context (simplify for kids): #include #include int main(){ char directory; char permissions[9]; char idk[31]; char username[31]; char group_name[31]; char s_size[31]; char month[31]; char date[31]; char time[31]; char filename[31]; scanf(\"%c %s %s %s %s %s %s %s %s %s\", &directory, permissions, idk, usernam", "question": "", "intention": "Code is supposed to take 9 strings. The first string is 10 characters long and will be split into two with directory taking the first character of the string and then permissions taking the other 9 characters. Then s_size will be converted into an integer. Then all the variables except s_size are printed", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t | Code context (simplify for kids): #include #include int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } int min_size = strtol(argv[1], NULL, 10); int num_filtered_files = 0; int eof = 1; int first = 0; char directory; char per", "question": "", "intention": "The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t | Code context (simplify for kids): #include #include int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr, \"USAGE: count_large size [permissions]\\n\"); return 1; } int min_size = strtol(argv[1], NULL, 10); int num_filtered_files = 0; int eof = 1; int first = 0; char directory; char per", "question": "", "intention": "The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t | Code context (simplify for kids): #include #include int check_permissions(char *given, char *needed){ int same = 0; for(int i = 0; i < 9; i++){ if(needed[i] != '-'){ if(needed[i] != given[i]){ same = 1; break; } } } return same; } int main(int argc, char** argv) { if (!(argc == 2 || argc == 3)) { fprintf(stderr,", "question": "", "intention": "The main takes in a number and potentially a string in argv. min_size is supposed to be the number given in argv. Then, a \"ls -l\" of the current directory is given as the input. The first line is supposed to be skipped as it does not match the form of the listed files. The size of the file is first taken as a string, and then converted to an int. If the size of the file is greater than min_size, t", "task_description": "", "has_code": true} {"feature_type": "Help Write Code", "problem_stem": "Task: given an int, and an empty int array, convert each digit into a single place in the int array", "question": "", "intention": "", "task_description": "given an int, and an empty int array, convert each digit into a single place in the int array", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use modulo to get the individual digits of an int", "question": "How do I use modulo to get the individual digits of an int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I give a helper function an empty array, how do I keep the changes to the array in main without returning the array", "question": "If I give a helper function an empty array, how do I keep the changes to the array in main without returning the array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I give the address of an int array to helper function, what should the argument for the helper function be.", "question": "If I give the address of an int array to helper function, what should the argument for the helper function be.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is it possible to keep the value of an int array that is edited in a helper function if the helper function's argument is also int array, and it doesn't return the array?", "question": "Is it possible to keep the value of an int array that is edited in a helper function if the helper function's argument is also int array, and it doesn't return the array?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Populate the empty integer array in a helper function, and return whether the given int was 9 digits long. In the main function print the digits in the now populated array and whether the given number was 9 digits long | Code context (simplify for kids): #include #include int t_populate_array(int sin, int *sin_array) { for (int i = 8; -1 < i; i--){ sin_array[i] = sin % 10; if(sin == 0){ return 1; } sin = sin / 10; } return 0; } int main() { int sin_arrayy[9]; int sin = 999999999; int valid = t_populate_array(sin, &sin_arrayy); f", "question": "", "intention": "Populate the empty integer array in a helper function, and return whether the given int was 9 digits long. In the main function print the digits in the now populated array and whether the given number was 9 digits long", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Populate the empty integer array in a helper function, and return whether the given int was 9 digits long. In the main function print the digits in the now populated array and whether the given number was 9 digits long by either printing 0 or 1 | Code context (simplify for kids): #include #include int t_populate_array(int sin, int *sin_array) { for (int i = 8; -1 < i; i--){ sin_array[i] = sin % 10; if(sin == 0){ return 1; } sin = sin / 10; } return 0; } int main() { int sin_arrayy[9]; int sin = 999999999; int valid = t_populate_array(sin, sin_arrayy); fo", "question": "", "intention": "Populate the empty integer array in a helper function, and return whether the given int was 9 digits long. In the main function print the digits in the now populated array and whether the given number was 9 digits long by either printing 0 or 1", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Can you keep the value of a variable in a helper function without malloc or returning the variable", "question": "Can you keep the value of a variable in a helper function without malloc or returning the variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I set the address of an int array to be an already declared integer", "question": "How do I set the address of an int array to be an already declared integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If node *next is a pointer to a node, what is the value of next.", "question": "If node *next is a pointer to a node, what is the value of next.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If node *two is a pointer to a node, what is the value of two", "question": "If node *two is a pointer to a node, what is the value of two", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Are structs classes?", "question": "Are structs classes?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If you pass an array to a function, do you need to use malloc to keep the changes to the array", "question": "If you pass an array to a function, do you need to use malloc to keep the changes to the array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: To keep changes to variables made in a function, do you pass a pointer to the variable", "question": "To keep changes to variables made in a function, do you pass a pointer to the variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I compare strings in", "question": "How do I compare strings in", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I take a string as an argument in the function, can I use strlen on it", "question": "If I take a string as an argument in the function, can I use strlen on it", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If a function is given a string, can you directly edit the string in the function or do you need to use malloc", "question": "If a function is given a string, can you directly edit the string in the function or do you need to use malloc", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does strcpy also copy the null terminator", "question": "Does strcpy also copy the null terminator", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I use strcat with a string and a character", "question": "Can I use strcat with a string and a character", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you use memset to set characters to null pointer", "question": "Can you use memset to set characters to null pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use malloc on a char * given to the function. How do I then assign characters to that char *.", "question": "How do I use malloc on a char * given to the function. How do I then assign characters to that char *.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I'm given a char * in a function, how do I make the changes stay outsides the function", "question": "If I'm given a char * in a function, how do I make the changes stay outsides the function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If the parameter to my function is char *, how do I make changes to the variable that will stay in main.", "question": "If the parameter to my function is char *, how do I make changes to the variable that will stay in main.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: char *copy copies the string in *src to *dest, but it makes sure that *dest ends with a '\\0'. capacity is supposed to be the maximum amount of characters copied to *dest, including the '\\0' at the end. | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { dest = malloc(sizeof(char) * capacity); memset(dest, '\\0', capacity); for(int i = 0; i < (capacity - 1); i++){ dest[i] = src[i]; } return dest; }", "question": "", "intention": "char *copy copies the string in *src to *dest, but it makes sure that *dest ends with a '\\0'. capacity is supposed to be the maximum amount of characters copied to *dest, including the '\\0' at the end.", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: char *copy copies the string in *src to *dest, but it makes sure that *dest ends with a '\\0'. capacity is supposed to be the maximum amount of characters copied to *dest, including the '\\0' at the end. | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { dest = malloc(sizeof(char) * capacity); memset(dest, '\\0', capacity); dest[capacity] = '\\0'; for(int i = 0; i < (capacity - 1); i++){ dest[i] = src[i]; } return dest; }", "question": "", "intention": "char *copy copies the string in *src to *dest, but it makes sure that *dest ends with a '\\0'. capacity is supposed to be the maximum amount of characters copied to *dest, including the '\\0' at the end.", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Why don't my changes to dest remain in main? | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { dest = malloc(sizeof(char) * capacity); memset(dest, '\\0', capacity); for(int i = 0; i < (capacity - 1); i++){ dest[i] = src[i]; } return dest; }", "question": "Why don't my changes to dest remain in main?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: How do I make changes to dest remain in main | Code context (simplify for kids): char *copy(char *dest, const char *src, int capacity) { dest = malloc(sizeof(char) * capacity); memset(dest, '\\0', capacity); for(int i = 0; i < (capacity - 1); i++){ dest[i] = src[i]; } return dest; }", "question": "How do I make changes to dest remain in main", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Do you need to use malloc when changing the values of an array in a function", "question": "Do you need to use malloc when changing the values of an array in a function", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you change the value of a macro from the command line?", "question": "Can you change the value of a macro from the command line?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I ask for equivalence to null", "question": "How do I ask for equivalence to null", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Does strlen include the null pointer", "question": "Does strlen include the null pointer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If a function is given a **struct, is the actual struct: *struct", "question": "If a function is given a **struct, is the actual struct: *struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I'm creating a struct, if I don't initialize the values, are they automatically set to null", "question": "If I'm creating a struct, if I don't initialize the values, are they automatically set to null", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If my struct has a variable that is a list of structs, can I set that value to NULL", "question": "If my struct has a variable that is a list of structs, can I set that value to NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the else if statement in C called", "question": "What is the else if statement in C called", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I compare strings", "question": "How do I compare strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Let User be a struct. If I wanted a function to return a pointer to a User, would the return statement be *user_name or **user_name", "question": "Let User be a struct. If I wanted a function to return a pointer to a User, would the return statement be *user_name or **user_name", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Let char *name1 be a string. If I want a new char *name2 to be equal to name1, do I do char *name2 = *name1 or char *name2 = name1", "question": "Let char *name1 be a string. If I want a new char *name2 to be equal to name1, do I do char *name2 = *name1 or char *name2 = name1", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does open return if a file doesn't exist", "question": "What does open return if a file doesn't exist", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If an object has a list of structs, how do I find the size of this list.", "question": "If an object has a list of structs, how do I find the size of this list.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is an int the same as an unsigned integer", "question": "is an int the same as an unsigned integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can I use index numbers to iterate through a list of structs", "question": "Can I use index numbers to iterate through a list of structs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If User is a struct that has the variable: struct user *friends[MAX_FRIENDS], If new_user is an empty User, would I be able to do new_user->friends[32]; to initialize the array", "question": "If User is a struct that has the variable: struct user *friends[MAX_FRIENDS], If new_user is an empty User, would I be able to do new_user->friends[32]; to initialize the array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If a macro is defined in a different file, but the same folder, can that macro value be accessed from a different file.", "question": "If a macro is defined in a different file, but the same folder, can that macro value be accessed from a different file.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If *name is a string, do I do strlen(*name) or strlen(name)", "question": "If *name is a string, do I do strlen(*name) or strlen(name)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is a pointer to a NULL == NULL", "question": "Is a pointer to a NULL == NULL", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I print the contents f a file using fopen", "question": "How do I print the contents f a file using fopen", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use time_t to record the time", "question": "How do I use time_t to record the time", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I'm creating a function to free heap memory. Should I give the function the pointer to the variable or just the variable", "question": "If I'm creating a function to free heap memory. Should I give the function the pointer to the variable or just the variable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is the function that frees hap memory", "question": "What is the function that frees hap memory", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: Am I freeing the right memory | Code context (simplify for kids): int remove_post(Post **head_post){ Post *head = *head_post; free(head); }", "question": "Am I freeing the right memory", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Am I freeing the right memory | Code context (simplify for kids): int remove_post(struct post **head_post){ free(**head_post); }", "question": "Am I freeing the right memory", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Am I freeing the right memory | Code context (simplify for kids): int remove_post(struct post **head_post){ struct post *head = *head_post; free(head); }", "question": "Am I freeing the right memory", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What memory am I freeing | Code context (simplify for kids): int remove_post(struct post **head_post){ free(*head); }", "question": "What memory am I freeing", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: What memory am I freeing | Code context (simplify for kids): int remove_post(struct post **head_post){ free(*head_post); }", "question": "What memory am I freeing", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: Am I freeing the right memory | Code context (simplify for kids): int remove_post(struct post **head_post){ free(*head_post); }", "question": "Am I freeing the right memory", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: If I'm treeing to free the object, am I freeing the right memory | Code context (simplify for kids): int remove_post(struct post **post){ free(*post); }", "question": "If I'm treeing to free the object, am I freeing the right memory", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: Is this valid: &(head->next)", "question": "Is this valid: &(head->next)", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I have a struct user with the variable time_t *date, do I free free(&(head->date)) or free(head->date);", "question": "If I have a struct user with the variable time_t *date, do I free free(&(head->date)) or free(head->date);", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I set a char array after it's been initialized", "question": "How do I set a char array after it's been initialized", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Traverse through a linked structure to find a specific User | Code context (simplify for kids): User *find_user(const char *name, const User *head) { if(head == NULL){ return NULL; } User *curr = *head; if(strcmp(curr->name, name) == 0){ return *curr; } while(curr->next != NULL) curr = curr->next; if(strcmp(curr->name, name) == 0){ return *curr; } return NULL; }", "question": "", "intention": "Traverse through a linked structure to find a specific User", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: How do I make scanf ignore spaces", "question": "How do I make scanf ignore spaces", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I make scanf ignore spaces but not \\n", "question": "How do I make scanf ignore spaces but not \\n", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Delete Posts in a linked structure recursively | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "", "intention": "Delete Posts in a linked structure recursively", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: Delete Posts in a linked structure recursively | Code context (simplify for kids): typedef struct user { char name[MAX_NAME]; char profile_pic[MAX_NAME]; // This is a *filename*, not the file contents. struct post *first_post; struct user *friends[MAX_FRIENDS]; struct user *next; } User; typedef struct post { char author[MAX_NAME]; char *contents; time_t *date; struct post *next; ", "question": "", "intention": "Delete Posts in a linked structure recursively", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: What is the minimum value strcpy work with", "question": "What is the minimum value strcpy work with", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: After declaring a char *, how do I fill it.", "question": "After declaring a char *, how do I fill it.", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you add a variable to the heap after having initialized it", "question": "Can you add a variable to the heap after having initialized it", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I declare a char[15], does that mean 16 bytes are allocated to the char * as it has 15 bytes of characters as well as one byte for the null terminator?", "question": "If I declare a char[15], does that mean 16 bytes are allocated to the char * as it has 15 bytes of characters as well as one byte for the null terminator?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you put '\\n' as a character in a string", "question": "Can you put '\\n' as a character in a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: would the output of strlen(\"five\") be four", "question": "would the output of strlen(\"five\") be four", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you malloc something when it's value has already been assigned", "question": "Can you malloc something when it's value has already been assigned", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I declare a char array like this: char name[x]; Would x be equivalent to the number of bits the array can hold", "question": "If I declare a char array like this: char name[x]; Would x be equivalent to the number of bits the array can hold", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I have int array[3] = {1, 2, 3}; would the value of array be the pointer to the first int?", "question": "If I have int array[3] = {1, 2, 3}; would the value of array be the pointer to the first int?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do child processes return information to the parent process", "question": "How do child processes return information to the parent process", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you create a 2d array by using to square brackets", "question": "Can you create a 2d array by using to square brackets", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Is argc one more than the amount of inputs", "question": "Is argc one more than the amount of inputs", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I'm using pipes pipes, and I want to read an int, do I give the address of the int", "question": "If I'm using pipes pipes, and I want to read an int, do I give the address of the int", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I use pipes to read an integer, how do I use that integer from fd", "question": "If I use pipes to read an integer, how do I use that integer from fd", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I'm reading a file, how do I make sure I read it line by line", "question": "If I'm reading a file, how do I make sure I read it line by line", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Do a lines of a file end with '\\n' or '\\0'", "question": "Do a lines of a file end with '\\n' or '\\0'", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I have a FILE *fp, do I use fopen(fp, \"r\") to open the file for reading", "question": "If I have a FILE *fp, do I use fopen(fp, \"r\") to open the file for reading", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I use fgets, and \\n is the last index position of the string, does fgets replace \\n with \\0", "question": "If I use fgets, and \\n is the last index position of the string, does fgets replace \\n with \\0", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Can you add index positions to an array", "question": "Can you add index positions to an array", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use FSEEK to reset my file position to the top of the file", "question": "How do I use FSEEK to reset my file position to the top of the file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I make sure I'm assigning a read-only string to a member of a struct so that I don't use more memory than is assigned to the struct", "question": "How do I make sure I'm assigning a read-only string to a member of a struct so that I don't use more memory than is assigned to the struct", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I use strcpy, will the destination string will have different memory address than the source string?", "question": "If I use strcpy, will the destination string will have different memory address than the source string?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I do char *name = \"bob\"; will *name have the memory address of the read only memory of bob, meaning it's size will only be the size of a pointer?", "question": "If I do char *name = \"bob\"; will *name have the memory address of the read only memory of bob, meaning it's size will only be the size of a pointer?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: char *rule_names[max_rules]; Is this an array of pointers to strings?", "question": "char *rule_names[max_rules]; Is this an array of pointers to strings?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I use FSEEK to go up one line a file without knowing the size of the line", "question": "How do I use FSEEK to go up one line a file without knowing the size of the line", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: If I have code that is accepting input from a socket, and will stop when it detects \"\\r\\n\" using the function strstr, how do I print \"\\r\\n\" from input", "question": "If I have code that is accepting input from a socket, and will stop when it detects \"\\r\\n\" using the function strstr, how do I print \"\\r\\n\" from input", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: char *flights[3]; Is this equivalent to a char **flights = malloc(3* sizeof(char *));", "question": "char *flights[3]; Is this equivalent to a char **flights = malloc(3* sizeof(char *));", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: When trying to send a sigaction signal to a process from shell (assume it is SIGUSR1), is it: kill -USR1 pid or kill -SIGUSR1 pid", "question": "When trying to send a sigaction signal to a process from shell (assume it is SIGUSR1), is it: kill -USR1 pid or kill -SIGUSR1 pid", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is it chmod 555 file.txt or chmod file.txt 555", "question": "is it chmod 555 file.txt or chmod file.txt 555", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What is : cp ../*.in . do", "question": "What is : cp ../*.in . do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if I do printf(\"%d\", x); will it print the bit value of x", "question": "if I do printf(\"%d\", x); will it print the bit value of x", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if you have char *name1 and char *name2; To set the address of name1 to name2, do you do name1 = name2;", "question": "if you have char *name1 and char *name2; To set the address of name1 to name2, do you do name1 = name2;", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: if you have char *name1 and char *name2. To set the address of name1 to the address of name2, do you do name1 = name2;", "question": "if you have char *name1 and char *name2. To set the address of name1 to the address of name2, do you do name1 = name2;", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: What does r+ do with fopen", "question": "What does r+ do with fopen", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: I have this error with C program: phone.c:6:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10]’ [-Wformat=] 6 | scanf(\"%s %d\", &str, &num); | ~^ ~~~~ | | | | char * char (*)[10] how do i fix it?", "question": "I have this error with C program: phone.c:6:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10]’ [-Wformat=] 6 | scanf(\"%s %d\", &str, &num); | ~^ ~~~~ | | | | char * char (*)[10] how do i fix it?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: why wont this work? int main(int argc, char **argv) { char str[10]; int num; scanf(\"%s %d\", str, &num); if (num == -1) { printf(\"%s\", str); } else if (0 <= num && num < 10) { printf(\"%s\", *(&str+num)); } else { printf(\"ERROR\"); } }", "question": "why wont this work? int main(int argc, char **argv) { char str[10]; int num; scanf(\"%s %d\", str, &num); if (num == -1) { printf(\"%s\", str); } else if (0 <= num && num < 10) { printf(\"%s\", *(&str+num)); } else { printf(\"ERROR\"); } }", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you make an array of an array of strings in C", "question": "how do you make an array of an array of strings in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How to convert a string to an integer", "question": "How to convert a string to an integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: How do I make a dynamically sized array in C", "question": "How do I make a dynamically sized array in C", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to make an arraylist in C like python and how to append to it", "question": "how to make an arraylist in C like python and how to append to it", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what type is scanf output", "question": "what type is scanf output", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is the output of ls -l a string", "question": "is the output of ls -l a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you print an initialized integer", "question": "how do you print an initialized integer", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you skip a line in the input stream", "question": "how do you skip a line in the input stream", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i compile a file", "question": "how do i compile a file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do i put ls into standard input of a executable", "question": "how do i put ls into standard input of a executable", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: can you alternate between fgets and fscan for the same file", "question": "can you alternate between fgets and fscan for the same file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do you remove the first element from a string", "question": "how do you remove the first element from a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what is pipe in c", "question": "what is pipe in c", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to compile two programs at once", "question": "how to compile two programs at once", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Help Fix Code", "problem_stem": "Code context (simplify for kids): void fib(int **fib_sequence, int count){ *fib_sequence = malloc(sizeof(int) * count); if(count >= 1){ *fib_sequence[0] = 0; } printf(\"HI\\n\"); if(count >= 2){ *fib_sequence[1] = 1; int i; for(i = 2; i < count; i++){ *fib_sequence[i] = *fib_sequence[i - 1] + *fib_sequence[i - 2]; } } }", "question": "", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: why am i getting a segmentation error | Code context (simplify for kids): void fib(int **fib_sequence, int count){ *fib_sequence = malloc(sizeof(int) * count); if(count >= 1){ *fib_sequence[0] = 0; } printf(\"HI\\n\"); if(count >= 2){ *fib_sequence[1] = 1; int i; for(i = 2; i < count; i++){ *fib_sequence[i] = *fib_sequence[i - 1] + *fib_sequence[i - 2]; } } }", "question": "why am i getting a segmentation error", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: how to compare strings", "question": "how to compare strings", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does strlen include the null terminator", "question": "does strlen include the null terminator", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to trim a string", "question": "how to trim a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to get a sub string", "question": "how to get a sub string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use strncat", "question": "how to use strncat", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: is the struct stored in the stack", "question": "is the struct stored in the stack", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: does strlen count the null terminator", "question": "does strlen count the null terminator", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to use fopen to see if a file exists", "question": "how to use fopen to see if a file exists", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how to print an ascii file", "question": "how to print an ascii file", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: why is there an infinite loop | Code context (simplify for kids): User *find_user(const char *name, const User *head) { User *curr = (User *)head; while(curr != NULL){ if (strcmp(curr->name, name) == 0){ return curr; } } return NULL; }", "question": "why is there an infinite loop", "intention": "", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: what does the time function do", "question": "what does the time function do", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how do u use st_mtim", "question": "how do u use st_mtim", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Write a sample code for tim Sort using python", "question": "Write a sample code for tim Sort using python", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: in c, how can i restrict scanf() to only read the first 10 characters inputed", "question": "in c, how can i restrict scanf() to only read the first 10 characters inputed", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: what does char phone[11] mean?", "question": "what does char phone[11] mean?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "Question from Code", "problem_stem": "Student question: is this an array or string | Code context (simplify for kids): char file[31];", "question": "is this an array or string", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Question from Code", "problem_stem": "Student question: is this valid in c? | Code context (simplify for kids): char file; file = '1234';", "question": "is this valid in c?", "intention": "", "task_description": "", "has_code": true} {"feature_type": "Help Fix Code", "problem_stem": "Goal: file should be a string | Code context (simplify for kids): char file; file = '1234';", "question": "", "intention": "file should be a string", "task_description": "", "has_code": true} {"feature_type": "General Question", "problem_stem": "Student question: in c, how can we read input from stand input in function main?", "question": "in c, how can we read input from stand input in function main?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i concatenate a space to a string", "question": "how can i concatenate a space to a string", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: how can i test if the pixels of a 24 bitmap is correctly printed out?", "question": "how can i test if the pixels of a 24 bitmap is correctly printed out?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: Any advices for aceing CSC209?", "question": "Any advices for aceing CSC209?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: any recommendation for vs code studio c language configuration?", "question": "any recommendation for vs code studio c language configuration?", "intention": "", "task_description": "", "has_code": false} {"feature_type": "General Question", "problem_stem": "Student question: 'gcc' is not recognized as an internal or external command, operable program or batch file.", "question": "'gcc' is not recognized as an internal or external command, operable program or batch file.", "intention": "", "task_description": "", "has_code": false}