Q20Comprehension5 Marks24 Dec 2023
Passage
Consider a graph generated from n rows of the "Scores" dataset that is represented by a matrix M. Each node in the graph corresponds to a student from the dataset. SeqNo is used to label the nodes in the graph. Study the given pseudocode and answer the given subquestions.
```
M = createMatrix(n, n)
foreach i in rows(M){
foreach j in columns(M){
M[i][j] = []
}
}
L = ["Chemistry", "Mathematics", "Physics"]
while(Table 1 has more rows){
Read the first row X in Table 1
Move X to Table 2
while(Table 1 has more rows){
Read the first row Y in Table 1
foreach Subject in L {
if(X.Subject > Y.Subject){
M[X.SeqNo][Y.SeqNo] = M[X.SeqNo][Y.SeqNo] ++ [Subject]
}
if(X.Subject < Y.Subject){
M[Y.SeqNo][X.SeqNo] = M[Y.SeqNo][X.SeqNo] ++ [Subject]
}
}
Move Y to Table 3
}
Move all rows from Table 3 to Table 1
}
```
For each pair of vertices i and j with i != j, choose the correct statement about M[i][j].