ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
10 marks · Standard algorithms
The procedure below is used to display the position of all ‘Thriller’ titles in the genre array. Line 1 PROCEDURE search (ARRAY OF STRING genre) Line 2 DECLARE position INITIALLY 0 Line 3 FOR index FROM 0 TO length(genre)−1 DO Line 4 IF genre[index] = "Thriller" THEN Line 5 SET position TO index Line 6 END IF Line 7 END FOR Line 8 SEND position TO DISPLAY Line 9 END PROCEDURE Using the sample data provided, state the output from this procedure. Explain why this procedure is not fit for purpose. Describe the changes needed to make this procedure fit for purpose. The streaming service wants to analyse the number of TV dramas in their full library. Using a design technique of your choice, design an algorithm to calculate the number of TV dramas and write this number to an external file called ‘tvDramas.txt’. The software developer has used Unicode to represent the text in the program instead of extended ASCII. Describe one advantage of using Unicode instead of extended ASCII to represent text. The streaming service uses tracking cookies. Describe how tracking cookies can impact users’ privacy. An online streaming service that offers TV shows, movies and documentaries, uses a program to manage its media library. The program stores data in four parallel 1D arrays called: title, type, genre, releaseYear. A sample of the data is shown below. Grace, TV Show, Thriller, 2024 Beneath the Blue Sky, Movie, Drama, 2023 Life in the City, TV Show, Drama, 2020 Echoes of Yesterday, Movie, Thriller, 2022 West Street, Movie, Action, 2018 Marine Life, Documentary, Nature, 2024
3 • only stores/displays the position of the last (thriller) • does not display multiple positions Position is set to 0 (and will be returned as 0 if none found). • move line 8 to after line 5/display within if statement • create an array/concatenate a string to store each position value • remove line 8 and change line 5 to display Index Award 1 mark for any one bullet. • initialise and update number of movies • loop for entire array • if current genre = "Drama" and current type = "TV Show" • open/create file • write the number of movies to file Can represent a larger amount of characters/languages. Can build profile of sites that are visited/target advertisements.