gs gs122 Dynamic Programming - Counting Boolean Parenthesizations - Quiz No.1
gs gs122 Data Communication and Computer Network Quiz
This quiz belongs to book/course code gs gs122 Data Communication and Computer Network of gs organization. We have 268 quizzes available related to the book/course Data Communication and Computer Network. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Dynamic Programming. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
int count_bool_parenthesization(char *sym, char *op) { int str_len = strlen(sym); int True[str_len][str_len],False[str_len][str_len]; int row,col,length,l; for(row = 0, col = 0; row < str_len; row++,col++) { if(sym[row] == 'T') { True[row][col] = 1; False[row][col] = 0; } else { True[row][col] = 0; False[row][col] = 1; } } for(length = 1; length < str_len; length++) { for(row = 0, col = length; col < str_len; col++, row++) { True[row][col] = 0; False[row][col] = 0; for(l = 0; l < length; l++) { int pos = row + l; int t_row_pos = True[row][pos] + False[row][pos]; int t_pos_col = True[pos+1][col] + False[pos+1][col]; if(op[pos] == '|') { _______________; } if(op[pos] == '&') { _______________; } if(op[pos] == '^') { _______________; } } } } return True[0][str_len-1]; }
Which of the following lines should be added to complete the "if(op[pos] == '|')" part of the code?
int count_bool_parenthesization(char *sym, char *op) { int str_len = strlen(sym); int True[str_len][str_len],False[str_len][str_len]; int row,col,length,l; for(row = 0, col = 0; row < str_len; row++,col++) { if(sym[row] == 'T') { True[row][col] = 1; False[row][col] = 0; } else { True[row][col] = 0; False[row][col] = 1; } } for(length = 1; length < str_len; length++) { for(row = 0, col = length; col < str_len; col++, row++) { True[row][col] = 0; False[row][col] = 0; for(l = 0; l < length; l++) { int pos = row + l; int t_row_pos = True[row][pos] + False[row][pos]; int t_pos_col = True[pos+1][col] + False[pos+1][col]; if(op[pos] == '|') { _______________; } if(op[pos] == '&') { _______________; } if(op[pos] == '^') { _______________; } } } } return True[0][str_len-1]; }