Question 15
Consider the following program.

Editable program transcription:
set ket_qua = “A”
repeat until ket_qua contains no ‘A’:
- choose an ‘A’ in ket_qua at random and replace it with ‘1’, “A1” or “B0”
repeat until ket_qua contains no ‘B’:
- choose a ‘B’ in ket_qua at random and replace it with “10” or “1B”
How many of the following strings can be the value of ket_qua after executing the program?
(i) 100
(ii) 111111
(iii) 111100
(iv) 1110011
(v) 1011100

Editable program transcription:
set ket_qua = “A”
repeat until ket_qua contains no ‘A’:
- choose an ‘A’ in ket_qua at random and replace it with ‘1’, “A1” or “B0”
repeat until ket_qua contains no ‘B’:
- choose a ‘B’ in ket_qua at random and replace it with “10” or “1B”
How many of the following strings can be the value of ket_qua after executing the program?
(i) 100
(ii) 111111
(iii) 111100
(iv) 1110011
(v) 1011100