Quiz on Condition Variables

It's quiz time! Answer the following questions to test your knowledge and understanding of the condition variables.

1

What would be printed as a result of running following code:

void *child(void *arg) {
    printf("3");
    done = 1;
    return NULL;
}

int main(int argc, char *argv[]) {
    pthread_t p;
    printf("1");
    Pthread_create(&p, NULL, child, NULL);
    while (done == 0); 
    printf("2");
    return 0;
}
A)

123

B)

132

C)

312

D)

321

Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.