Q3Comprehension5 Marks1 Sep 2024
Passage
Based on the above data, answer the given subquestions.
Let a and b be positive integers. Procedure remainder(a, b) returns the remainder if a is divided by b.
```
Procedure dosomething(X)
j = 2, Flag = True
if(X == 1){
return(False)
}
while(j < X){
if(remainder(X, j) == 0){
Flag = False
exitloop
}
j = j + 1
}
return(Flag)
End dosomething
```
Consider the procedure discussed above. What will the value of M be at the end of the execution of the given pseudocode below?
```
L = [8, 12, 13, 23, 11, 40]
M = []
position = 1
foreach element in L{
if(dosomething(position) and dosomething(element)){
M = M ++ [element]
}
position = position + 1
}
```