← 2023 questions

2023 / SHOPEE / QUESTION 32

Anonymous reviews

Try the question in your own editor, then check your output below.

THE QUESTION

Valerie received a package of headphones from Shoppee a week ago. She enjoys using them and wants to leave a review on the product. However, she does not want to show her username. Create a code that will prompt her to enter her review, which includes rating, performance, best feature, product quality, review and if she wants to leave her review anonymously. Her username is valerie8588. She would rate it 4/5, and likes that it has a powerful sound performance. She finds that the best feature is how it is easy to use and thinks the headphones are of superb quality. In her review she writes “Thank you for the fast and smooth transaction. The item arrived in good condition and is working well.” Print the review that is posted on the product’s page.

Hint: hidden usernames show only the first and last letter, and the rest are replaced with asterisks(eg. tristangrab would become t*********b)

Question by Amanda. Source: Girls In Code SEA — Behind the Screens, 2023, slide 52.

PRACTICE CHECK

Try your answer.

Checks the anonymisation step; the full exercise also prints the review fields.

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

Enter the displayed username after hiding the middle characters of valerie8588.

Reveal worked answer

Anonymous username

v*********8

valerie8588 has 11 characters. Keep v and the final 8, replacing the nine middle characters with asterisks.