Computer Science – IGCSE Past Papers
Match Computer Science paper codes and variants, then practise tracing data representations and logic questions.
Quick Answer
The Computer Science – IGCSE archive includes question papers and mark schemes for Paper 1 and Paper 2. Select the same session and paper variant in both files.

Trace an output across four input cases
A greenhouse indicator lights when a moisture reading is low and the manual override is off. Give each condition its own Boolean variable. List the four combinations of low moisture and override. Only the combination true and false should switch the light on. If your table has two true outputs, check whether you used OR in place of AND or forgot to negate the override. Verify the correction against the original sentence before looking at the mark scheme.
Interpret and Apply Negations, Conjunctions, and Disjunctions
The negation of a statement will have the opposite truth value of the original statement. When is true, is false, and when is false, is true.
Finding the Truth Value of a Negation
For each logical statement, determine the truth value of its negation.
- :
- : All horses are mustangs.
- : New Delhi is not the capital of India.
Solution
- is true because 3 + 5 does equal 8; therefore, the negation of , , is false.
- is false because there are other types of horses besides mustangs, such as Clydesdales or Arabians; therefore, the negation of , , is true.
- is false because New Delhi is the capital of India; therefore, the negation of , , is true.
A conjunction is a logical and statement. For a conjunction to be true, both statements that make up the conjunction must be true. If at least one of the statements is false, the and statement is false.
Finding the Truth Value of a Conjunction
Given and determine the truth value of each conjunction.
Solution
- is true, and is false. Because one statement is true, and the other statement is false, this makes the complete conjunction false.
- is false, so is true, and is true. Therefore, both statements are true, making the complete conjunction true.
- is false, and is false. Because both statements are false, the complete conjunction is false.
A disjunction is a logical inclusive or statement, which means that a disjunction is true if one or both statements that form it are true. The only way a logical inclusive or statement is false is if both statements that form the disjunction are false.
Finding the Truth Value of a Disjunction
Given and determine the truth value of each disjunction.
Solution
- is true, and is false. One statement is true, and one statement is false, which makes the complete disjunction true.
- is false, so is true, and is true. Therefore, one statement is true, and the other statement is true, which makes the complete disjunction true.
- is false, and is false. When all of the component statements are false, the disjunction is false.
In the next example, you will apply the dominance of connectives to find the truth values of compound statements containing negations, conjunctions, and disjunctions and use a table to record the results. When constructing a truth table to analyze an argument where you can determine the truth value of each component statement, the strategy is to create a table with two rows. The first row contains the symbols representing the components that make up the compound statement. The second row contains the truth values of each component below its symbol. Include as many columns as necessary to represent the value of each compound statement. The last column includes the complete compound statement with its truth value below it.
Finding the Truth Value of Compound Statements
Given and construct a truth table to determine the truth value of each compound statement
Solution
- Step 1: The statement “” contains three basic logical statements, , , and , and three connectives, When we place parentheses in the statement to indicate the dominance of connectives, the statement becomes Step 2: After we have applied the dominance of connectives, we create a two row table that includes a column for each basic statement that makes up the compound statement, and an additional column for the contents of each parentheses. Because we have three sets of parentheses, we include a column for the innermost parentheses, a column for the next set of parentheses, and in the last column for the third parentheses. Step 3: Once the table is created, we determine the truth value of each statement starting from left to right. The truth values of , , and are true, false, and true, respectively, so we place T, F, and T in the second row of the table. Because is true, is false. Step 4: Next, evaluate from the table: is false, and is also false, so is false, because a conjunction is only true if both of the statements that make it are true. Place an F in the table below its heading. Step 5: Finally, using the table, we understand that is false and is true, so the complete statement is false or true, which is true (because a disjunction is true whenever at least one of the statements that make it is true). Place a T in the last column of the table. The complete statement is true.
T F T F F T - Step 1: Applying the dominance of connectives to the original compound statement , we get
Step 2: The table needs columns for and
Step 3:The truth values of , , , and are the same as in Question 1.
Step 4: Next, is false or false, which is false, so we place an F below this statement in the table. This is the only time that a disjunction is false.
Step 5: Finally, and are the conjunction of the statements, and , and so the expressions evaluate to false and true, which is false. Recall that the only time an "and" statement is true is when both statements that form it are also true. The complete statement is false.
T F T F F F - Step 1: Applying the dominance of connectives to the original statement, we have: .
Step 2: So, the table needs the following columns: and
Step 3: The truth values of , , and are the same as in Questions 1 and 2.
Step 4: From the table it can be seen that is true and true, which is true. So the negation of and is false, because the negation of a statement always has the opposite truth value of the original statement.
Step 5: Finally, is the disjunction of with , and so we have false or false, which makes the complete statement false.
T F T T F F
Construct Truth Tables to Analyze All Possible Outcomes
Recall from Statements and Questions that the negation of a statement will always have the opposite truth value of the original statement; if a statement is false, then its negation is true, and if a statement is true, then its negation is false. To create a truth table for the negation of statement , add a column with a heading of , and for each row, input the truth value with the opposite value of the value listed in the column for , as depicted in the table below.
| Negation | |
| T | F |
| F | T |
Conjunctions and disjunctions are compound statements formed when two logical statements combine with the connectives “and” and “or” respectively. How does that change the number of possible outcomes and thus determine the number of rows in our truth table? The multiplication principle, also known as the fundamental counting principle, states that the number of ways you can select an item from a group of items and another item from a group with items is equal to the product of and . Because each proposition and has two possible outcomes, true or false, the multiplication principle states that there will be possible outcomes: {TT, TF, FT, FF}.
The tree diagram and table in diagram demonstrate the four possible outcomes for two propositions and .
A conjunction is a logical and statement. For a conjunction to be true, both the statements that make up the conjunction must be true. If at least one of the statements is false, the and statement is false.
A disjunction is a logical inclusive or statement. Which means that a disjunction is true if one or both statements that make it are true. The only way a logical inclusive or statement is false is if both statements that make up the disjunction are false.
| Conjunction (AND) | Disjunction (OR) | |||||
| T | T | T | T | T | T | |
| T | F | F | T | F | T | |
| F | T | F | F | T | T | |
| F | F | F | F | F | F |
Constructing Truth Tables to Analyze Compound Statements
Construct a truth table to analyze all possible outcomes for each of the following arguments.
Solution
- Step 1: Because there are two basic statements, and , and each of these has two possible outcomes, we will have rows in our table to represent all possible outcomes: TT, TF, FT, and FF. The columns will include , , , and
Step 2: Every value in column will have the opposite truth value of the corresponding value in column : F, T, F, and T.
Step 3: To complete the last column, evaluate each element in column with the corresponding element in column using the connective or.
T T F T T F T T F T F F F F T T - Step 1: The columns will include , , and . Because there are two basic statements, and , the table will have four rows to account for all possible outcomes.
Step 2: The column will be completed by evaluating the corresponding elements in columns and respectively with the and connective.
Step 3: The final column, , will be the negation of the column.
T T T F T F F T F T F T F F F T - Step 1: This statement has three basic statements, , , and . Because each basic statement has two possible truth values, true or false, the multiplication principal indicates there are possible outcomes. So eight rows of outcomes are needed in the truth table to account for each possibility. Half of the eight possibilities must be true for the first statement, and half must be false.
Step 2: So, the first column for statement , will have four T’s followed by four F’s. In the second column for statement , when is true, half the outcomes for must be true and the other half must be false, and the same pattern will repeat for when is false. So, column will have TT, FF, FF, FF.
Step 3: The column for the third statement, , must alternate between T and F. Once, the three basic propositions are listed, you will need a column for, , and .
Step 4: The column for the negation of , , will have the opposite truth value of each value in column .
Step 5: Next, fill in the truth values for the column containing the statement The or statement is true if at least one of or is true, otherwise it is false.
Step 6: Finally, fill in the column containing the conjunction . To evaluate this statement, combine column and column with the and connective. Recall, that only time "and" is true is when both values are true, otherwise the statement is false. The complete truth table is:
T T T F T T T T F F T F T F T T T T T F F T T F F T T F F F F T F F F F F F T T T T F F F T T F
Determine the Validity of a Truth Table for a Compound Statement
A logical statement is valid if it is always true regardless of the truth values of its component parts. To test the validity of a compound statement, construct a truth table to analyze all possible outcomes. If the last column, representing the complete statement, contains only true values, the statement is valid.
Determining the Validity of Compound Statements
Construct a truth table to determine the validity of each of the following statements.
Solution
- Step 1: Because there are two statements, and , and each of these has two possible outcomes, there will be rows in our table to represent all possible outcomes: TT, TF, FT, and FF.
Step 2: The columns, will include , , and Every value in column will have the opposite truth value of the corresponding value in column .
Step 3: To complete the last column, evaluate each element in column with the corresponding element in column using the connective and . The last column contains at least one false, therefore the statement is not valid.
T T F F T F F F F T T T F F T F - Step 1: Because the statement only contains one basic proposition, the truth table will only contain two rows. Statement may be either true or false.
Step 2: The columns will include , , and Evaluate column with the and connective, because the symbol represents a conjunction or logical and statement. True and false is false, and false and true is also false.
Step 3: The final column is the negation of each entry in the third column, both of which are false, so the negation of false is true. Because all the truth values in the final column are true, the statement is valid.
T F F T F T F T
Check Your Understanding
Video
- Logic Part 2: Truth Values of Conjunctions: Is an "AND" statement true or false?
- Logic Part 3: Truth Values of Disjunctions: Is an "OR" statement true or false?
- Logic Part 4: Truth Values of Compound Statements with "and", "or", and "not"
- Logic Part 5: What are truth tables? How do you set them up?
- Logic Part 6: More on Truth Tables and Setting Up Rows and Column Headings
Conversion of Another Base into Base 10 and Other Bases
We saw in Hindu-Arabic Positional System that our Hindu-Arabic system uses base 10, which is a system using place values of digits that depend on powers of 10 (or, are based on powers of 10). We’ve already worked with bases other than base 10: The Babylonian system was base 60, while the Mayan system was base 20.
To explore how our base 10 system is used, answer the following question: What’s the following quantity: 4,572? You probably said four thousand five hundred seventy-two (no, there is no “and” between hundred and seventy). But why do you think that 4 means four thousand? A very young person when learning their numbers might say that’s a four five seven and two. But you added the context of thousands to the four. Why?
Place value, that’s why. You learned early on that where the numeral was gave it different meanings. Ten thousands, thousands, hundreds, tens, and ones. So, you translate that symbol string (4,572) into “four thousand five hundred seventy-two.” As we saw in Hindu-Arabic Positional System, expanding a Hindu-Arabic number involved writing the number using each digit times its appropriate power of 10. So, we could write 4,572 as .
One possible reason we use base 10 is that we have 10 fingers, and in the cultures where the Hindu-Arabic system developed, that became the standard. Other cultures may have used other ways of organizing numbers, perhaps using 20 by including toes, or using 60 because 60 has many divisors. Mathematically though, base 10 is an awkward base to work in since 10 has limited divisors. But we think it is easy and simple because that’s what we’ve been taught to use.
Using a base 10 system means we need 10 symbols to make our numbering system work: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Now imagine that we all only had 6 fingers instead of 10 and our counting system was based on those 6 fingers. We would be counting in groups of 6, not groups of 10. How would this change how we work with quantity?
First, we’d need only six symbols. Let’s use 0, 1, 2, 3, 4, 5. Second, our place values would be based on powers of 6, not powers of 10. For instance, the number 3,024 in base 6 would be .
That is how you can translate a base 6 number into a base 10 number. When we calculate that expression we get .
This means the base 6 number 3,024 is equal to the base 10 number 664.
From now on, if we are using a base 6 number, we will follow it with the subscript 6, like the following: 3,0246 means the number is in base 6.
A base 10 number gets no subscript (it’s the standard). So, 3,024 is a base 10 number. A base 13 number would be 4,67213.
So, a base 6 system uses only the symbols 0, 1, 2, 3, 4, and 5. Also, the place values use powers of 6. However, we still don’t know how to count in base 6. In order to do so, we’d have to know how to represent the quantities larger than five in base 6. Let’s review how our base 10 system works by counting from 0 to 100, which shows how larger values are represented.
In writing the base 10 numbers, you start with these first 10 values:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
But you’ve run out of symbols. So, we use two digits:
| 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
The 1 out front means you’ve run out of digits one time.
But now you’ve run out twice. Continuing with those numbers gives:
| 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
And so on,
| 30 | 31 | 32 | 33 | 34 | etc.… |
Eventually, you hit the 90s,
| 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 |
And you’ve run out of the digits again! So, we say we’ve run out of digits in the tens place one time, hence:
| 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 |
That’s the pattern we use in base 10. We write out the symbols until we’ve used all the symbols, then add a digit in front that counts how many times we’ve used the digits. Knowing the numbers, or being able to count higher and higher, is necessary to understand how all the arithmetic works, as it all goes back to counting.
The counting pattern is the same for any other base, including base 6. So, let’s start:
| 0 | 1 | 2 | 3 | 4 | 5 |
But we’ve run out of symbols! Just like in base 10, we use a second digit, where the first digit will tell us we’ve run out of symbols one time.
| 10 | 11 | 12 | 13 | 14 | 15 |
And we use the same pattern:
| 20 | 21 | 22 | 23 | 24 | 25 |
| 30 | 31 | 32 | 33 | 34 | 35 |
| 40 | 41 | 42 | 43 | 44 | 45 |
| 50 | 51 | 52 | 53 | 54 | 55 |
But we’ve run out of symbols for that front digit. So, we indicate it the same way as in base 10…by adding a third digit in front, indicating we’ve run out of symbols once in the second place:
| 100 | 101 | 102 | 103 | 104 | 105 |
| 110 | 111 | etc. |
The symbol pattern is the same, but truncated. We only use the six symbols. So that is how we represent base 6. Being able to write out these numbers is important when working with addition in the base.
When using a base larger than 10, though, we need more symbols. Instead of creating new symbols, we use capital letters, with A representing the digit for "10," B representing the digit for "11," and so on.
Determining Digits of a Base with Less Than 10 Digits
What are the digits used for base 7?
Solution
Since this is base 7, we need only 7 symbols: 0, 1, 2, 3, 4, 5, 6.
Determining Digits of a Base with More Than 10 Digits
What are the digits used for base 14?
Solution
Since this is base 14, we need 14 symbols. We don’t have single character numbers for 10, 11, 12, and 13, so, in a fit of inspired creativity, we use capital letters A, B, C, D to represent those quantities. So, the digits in base 14 are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D.
Converting from One Base into Another
Convert 3,6017 into base 10.
Solution
In base 7, the place values are powers of 7. Since there are four digits, the highest power of 7 that is used is 3. This yields .
Converting from Base 14 to Base 10
Convert 4B714 into base 10.
Solution
In base 14, the place values are powers of 14. Since there are three digits, the highest power of 14 is 2. Also recall that in base 14, 10 is represented by A, 11 is represented by B, 12 is represented by C, and 13 is represented by D. Using that, we convert to base 10:
.
Converting from Base 12 to Base 10
Convert A1612 into base 10.
Solution
In base 12, the place values are powers of 12. Since there are three digits, the highest power of 12 is 2. Also recall that in base 12, 10 is represented by A and 11 is represented by B. Using that, we convert to base 10:
.
Converting from Base 2 to Base 10
Convert 10112 into base 10.
Solution
In base 2, the place values are powers of 2. Since there are four digits, the highest power of 2 is 3. Using that, we convert to base 10:
.
Writing Numbers in Base Systems Other Than Base 10
Write the numbers in base 7 up to 1007.
Solution
Step 1: Using the patterns we indicated earlier, we begin with the first seven digits.
0, 1, 2, 3, 4, 5, 6
Step 2: Since we’ve run out of digits, we start with 10, indicating we’ve run out of symbols once.
10, 11, 12, 13, 14, 15, 16
Step 3: Continuing in the same way, we get:
20, 21, 22, 23, 24, 25, 26
30, 31, 32, 33, 34, 35, 36
40, 41, 42, 43, 44, 45, 46
50, 51, 52, 53, 54, 55, 56
60, 61, 62, 63, 64, 65, 66
Now, all the digits have been used in the leading digits. Since the digits have all been used in that leading digit, we use 100, as in base 10.
100
Writing Numbers in Bases with More Than 10 Symbols
Write the numbers in base 14 up to 10014.
Solution
Step 1: Using the patterns we indicated earlier, we begin with the first 14 digits.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D
Step 2: Since we’ve run out of digits, we start with 10, indicating we’ve run out of symbols once.
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D
Step 3: Continuing in the same way, we get:
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B, 2C, 2D
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 3A, 3B, 3C, 3D
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 4A, 4B, 4C, 4D
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 5A, 5B, 5C, 5D
60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 6A, 6B, 6C, 6D
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 7A, 7B, 7C, 7D
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 8A, 8B, 8C, 8D
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 9A, 9B, 9C, 9D
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, AA, AB, AC, AD
B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, BA, BB, BC, BD
C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, CA, CB, CC, CD
D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, DA, DB, DC, DD
100
Base 2 is important in the digital age, as it is the system used by computers. It is the simplest base to work with, but has the drawback that the numbers in base 2 may use many, many digits. In Addition and Subtraction in Base Systems and Multiplication and Division in Base Systems, we will look at base 2 in each situation.
Writing Numbers in Base 2
Write the numbers in base 2 up to 1002.
Solution
Base 2 uses only two symbols: 0 and 1. Following the pattern established previously, the numbers in base 2 up to 1002 are 0, 1, 10, 11, and 100.
Conversion of Base 10 into Another Base
Converting from base 10 into another base uses repeated division, recording the remainder at each step. Then, the number in the new base is the remainder starting from the last remainder found. To be accurate in what we’re saying, we need to remind ourselves of some terminology associated with division. When integers are divided, the one being divided is the dividend, and the one that is dividing the dividend is the divisor. The quotient is the largest natural number that can be multiplied by the divisor where the product is less than the dividend.
When the integer is divided by the integer , is called the dividend and is the divisor.
To convert a base 10 number into base , we divide by , recording the remainder. Then we divide the quotient from that step by the base , and record the remainder again. We continue this process until the quotient is 0. Then, the base number has digits that start with the last remainder and use each remainder in reverse order.
Converting from Base 10 into a Lower Base
Convert 298 to base 6.
Solution
We divide 298 by 6, and record the remainder. Then we divide the quotient from that step by 6, and record the remainder again. We continue this process until the quotient is 0. Then, the base 6 number has digits that start with the last remainder and use each remainder in reverse order.
Step 1: When we divide 298 by 6, we get . The quotient is 49 and the remainder is 4.
Step 2: Now we divide the quotient, 49, by 6. This gives . The quotient is 8 and the remainder is 1.
Step 3: Repeating, we get . The quotient is 1 and the remainder is 2.
Step 4: Finally, we perform the operation on the quotient 1, giving us a quotient of 0 and a remainder of 1.
Step 5: The base 6 number has digits equal to the remainders in reverse order, 12146. So, 298 in base 10 when converted to base 6 is 12146.
Converting from Base 10 into a Higher Base
Convert 45,134 to base 13.
Solution
We divide 45,134 by 13, and record the remainder. Then we divide the quotient from that step by 13, and record the remainder again. We continue this process until the quotient is 0. Then, the base 13 number has digits that start with the last remainder and use each remainder in reverse order. It is at this step that we’ll convert to the base 13 digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C.
Step 1: When we divide 45,134 by 13, we get . The quotient is 3,471 and the remainder is 11.
Step 2: Now we divide the quotient, 3,471, by 13. This gives . The quotient is 267 and the remainder is 0.
Step 3: Repeating, we get . The quotient is 20 and the remainder is 7.
Step 4: Again, and we get . The quotient is 1 and the remainder is 7.
Step 5: Finally, we get , with quotient 0 and a remainder 1.
Step 6: The base 13 number has digits equal to the remainders in reverse order, which were 1, 7, 7, 0, and 11. The 11 is written as B in base 13. So, 45,134 in base 10 when converted to base 13 is 1770B13.
Converting from Base 10 into Base 2
Convert 100 to base 2.
Solution
Following the pattern above:
Step 1: We divide 100 by 2, and record the remainder.
Step 2: Then we divide the quotient from that step by 2, and record the remainder again.
Step 3: We continue this process until the quotient is 0.
Step 4: Following this process, the remainders are, in order, 0, 0, 1, 0, 0, 1, 1. Writing those in reverse order gives the number in base 2, 11001002.
Notice that 100 in base 2 took seven digits.
