names = ['Ali', 'Bo', 'Cy']. What is names[2]?
- Indexing starts at 0.
- names[0] = Ali, names[1] = Bo, names[2] = Cy.
Answer 'Cy'
A-level Computer Science revision · Programming
Common data types are integer, real (float), Boolean, character and string. Casting converts between types. String operations include length, substring and concatenation. Arrays hold many values of the same type, accessed by index, usually from 0. Files are opened, read or written, and closed.
Watch out In a zero-indexed array of length n, the last index is n − 1.
names = ['Ali', 'Bo', 'Cy']. What is names[2]?
Answer 'Cy'
An array has 12 elements, indexed from 0. What is the index of the last element?
Which data type is best for storing a telephone number such as 07700900123?
word = 'COMPUTER'. What is word.length?
A-level Computer Science Pro, OCR H446
£119 once
Price rises to £199 on 1 January. Save £80 by joining before then.
At least 12 months of access
No VAT is charged.