Skip to content / Đến nội dung
ThichHocToan.com

Bebras 2022 - Level 6 Question 15

BEBRAS · Bebras 2022 - Level 6

Question 15

Consider the following program.

Question illustration

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
  1. 2
  2. 3
  3. 4
  4. 5