Data and processes in computing
Data and processes in computing

Start this free course now. Just create an account and sign in. Enrol and complete the course for a free statement of participation or digital badge if available.

Exercises on Section 1

Exercise 1

  • (a) How many characters are there in the string “This text.”?

  • (b) Which of the following are integers: 3, 0, 98, 4, –22,, ‘7’, [56]?

  • (c) How many integers are there in the sequence [11, 23, 4, 56, 32]?



  • (a) There are ten characters: four in each word, a space, and a full stop.

  • (b) Each of 3, 0, 98, 4 and −22 is an integer. is not an integer because it is not a whole number. ‘7’ is a character, and is not an integer. [56] is a sequence containing one integer, but is not an integer.

  • (c) There are five integers in the sequence.

Exercise 2

Suppose that the variable till2 holds data in the form of a sequence of barcodes. When an item is read at the checkout, the state of till2 is changed by appending the barcode of the item to the end of the sequence giving the state of till2. Suppose that till2 currently has the state [50222, 50345], and that an item with barcode 50111 is read, and then an item with barcode 50456 is read. Write out the state of the variable till2 at each stage.



In turn, the state takes the following values:

[50222, 50345] (at the start).
[50222, 50345, 50111] (after 50111 is read).
[50222, 50345, 50111, 50456] (after 50456 is read).

Exercise 3

With item prices as given in Table 1, what is the sequence of prices corresponding to the sequence of barcodes [33050, 33050, 77502, 53151, 77502]? What is the total price of the items given by this sequence?



The sequence of prices (given as integer numbers of pence, as in Table 1) is: [299, 299, 89, 440, 89]. The total price (in pence) is 1216 (or £12.16).

Take your learning further

Making the decision to study can be a big step, which is why you'll want a trusted University. The Open University has 50 years’ experience delivering flexible learning and 170,000 students are studying with us right now. Take a look at all Open University courses.

If you are new to University-level study, we offer two introductory routes to our qualifications. You could either choose to start with an Access module, or a module which allows you to count your previous learning towards an Open University qualification. Read our guide on Where to take your learning next for more information.

Not ready for formal University study? Then browse over 1000 free courses on OpenLearn and sign up to our newsletter to hear about new free courses as they are released.

Every year, thousands of students decide to study with The Open University. With over 120 qualifications, we’ve got the right course for you.

Request an Open University prospectus371