Question 2 - Week 3 Practice | Prasnya
Prasnya
Continue with Google
Practice path
Dashboard
Exam
Quiz 2
Go to subject
Computational Thinking
Go to chapter
Week 3
Question 2
00:00
Est. 2 min
Marks:
+4.00
0.00
Consider the following pseudocode. If at the end of execution,
B
=
[
3
,
5
]
B = [3, 5]
, then choose the correct code for procedure `checkCondition`. ``` A = [3, 8, 15, 6, 10, 5] B = [] foreach number in A { if(checkCondition(number)) { B = B ++ [number] } } ```
Single correct
Medium Difficulty
03 August 2025
A
``` Procedure checkCondition(X) j = 2 flag = False while(j < X) { if(remainder(X, j) == 0) { flag = False } j = j + 1 } return(flag) End checkCondition ```
B
``` Procedure checkCondition(X) j = 3 flag = True while(j < X) { if(remainder(X, j) == 0) { flag = False } j = j + 1 } return(flag) End checkCondition ```
C
``` Procedure checkCondition(X) j = 3 flag = False while(j < X) { if(remainder(X, j) == 0) { flag = False } j = j + 1 } return(flag) End checkCondition ```
D
``` Procedure checkCondition(X) j = 2 flag = True while(j < X) { if(remainder(X, j) == 0) { flag = False } j = j + 1 } return(flag) End checkCondition ```