-
What are whole number called in programing?
Integers
-
What name is given to the items stored in a sequence?
Elements
-
Individual letters in a word are called characters, as indicated by single inverted commas (e.g. 'c') What is the name given to a word contained in double inverted commas (e.g. "cat")?
String
-
Are any sequences other than characters contained between double inverted commas (e.g. "cat")?
No, all other sequences are kept between square brackets [ ], unless they are specifically contained in a set, identified by curly brackets { }.
-
What is a variable?
A refernce to a piece og memory.
-
What do you call the data stored in a variable at any point in time?
Its state
-
How many characters are there in the string “This text.”?
10 including a space character ' ' and a full stop '.'.
-
Which of the following are integers: 3, 0, 98, 4,−22,1/4, ‘7’, [56]?
All of them except 1/4, which isn't a whole number, '7', which is a character due to the inverted commas and [56], which is a sequence due to the brackets.
-
How many integers are there in the sequence [11, 23, 4, 56, 32]?
5
-
What are the truth values?
The boolean values, true and false.
-
What are the features of a set?
- A set is a collection of a elements of the same type
- Items don't hold a particular order
- Repeated values have no significance
- Written a ∈ X to mean that the item a is a member of the set X
- Is identified by curly brackets { }
-
What are the feastures of a sequence?
- A sequence is a collection of elements of the same type
- A sequence of characters is called a string
- Have a particular order
- Repeated values are of significance
- Is identified by square brackets [ ]
-
Let A be the set of integers between 100 and 999 inclusive.
(a) Express A in the form A = {x ∈?? : condition}
(b) What is the cardinality of A?
- (a) A = {x ∈ Int : 100 ≤ x and x ≤ 999}. (There are other correct solutions.)
- (b) There are 999 integers between 1 and 999 inclusive. The set A does not contain the integers between 1 and 99 inclusive, and there are 99 of these. So A has cardinality 999 − 99 = 900.
-
If B = {s ∈SeqOfChar : s starts with ‘T’ and s haslength4},which of the following is a member of the set B?
(a) “This”.
(b) [‘T’, ‘h’, ‘i’, ‘s’, ‘.’].
(c) [“T”, “h”, “i”, “s”].
- (a) is correct
- (b) has a length of 5
- (c) is a sequence of strings
|
|