Question 1
Which pseudo-code statement assigns the length of the string film to a variable called value ?
Shade one lozenge.
[1 mark]
Answer
The POSITION subroutine returns the position of the first occurrence of a character in a string.
For example:
• POSITION("Godzilla vs. Kong", "o") would return 1
• POSITION("Godzilla vs. Kong", "z") would return 3
letter and film are variables used in the algorithm in Figure 1.
Complete the pseudo-code statement to find the position of the first occurrence of the contents of letter in film and store this position in the variable location You must use the POSITION subroutine in your answer.
location
[1 mark]
Answer
Which of the following would be the most suitable data type for the variable year ?
Shade one lozenge.
[1 mark]
Answer
Describe what is meant by an assignment statement in a program.
[1 mark]
Answer
Write a C# program that:
gets the user to enter the name of a film
displays You entered followed by the name of the film entered by the user.
The output from the program must be on one line.
You should use meaningful variable name(s) and C# syntax in your answer.
The answer grid below contains vertical lines to help you indent your code accurately.
[2 marks]
Answer