Show Working
Open the app

GCSE Computer Science · Algorithms and programmingOCR, AQA, Edexcel and Eduqas

Boolean logic, languages and IDEs: GCSE questions with answers

34 GCSE Computer Science questions on this topic. Pick your answer, then tap to see if you were right and why. Every one comes from the Show Working Computer Science bank and is checked against the source named under it.

Quiz yourself: 34 questions 1 exam question

01 / Quiz yourselfTry it, then tap to check

Boolean logic, languages and IDEs questions to try

Choose your answer before you open it. Then read why, so it sticks.

01 / Boolean logic, languages and IDEsEvery board

Which logic gate gives an output of 1 only when both inputs are 1?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: B AND

An AND gate outputs 1 (True) only if input A and input B are both 1. If either input is 0, the output is 0.

Checked against ocr.org.uk

02 / Boolean logic, languages and IDEsEvery board

Which logic gate gives an output of 1 when at least one input is 1?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: A OR

An OR gate outputs 1 if A is 1, B is 1, or both are 1. It only outputs 0 when both inputs are 0.

Checked against ocr.org.uk

03 / Boolean logic, languages and IDEsEvery board

What does a NOT gate do?

  1. AIt outputs 1 when both inputs are 1
  2. BIt outputs 1 when either input is 1
  3. CIt reverses its single input
  4. DIt always outputs 0
Show the answer

Answer: C It reverses its single input

A NOT gate has one input and flips it: 1 becomes 0 and 0 becomes 1. It is also called negation.

Checked against ocr.org.uk

04 / Boolean logic, languages and IDEsEvery board

A burglar alarm sounds when the alarm is switched on and a door is opened.

Which logic gate matches this rule?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: B AND

Both conditions must be true at the same time for the alarm to sound, so the rule is ON AND DOOR. Words like “both” or “and” in a scenario usually point to an AND gate.

Checked against ocr.org.uk

05 / Boolean logic, languages and IDEsEvery board

A shop door opens if a customer steps on the mat or a member of staff presses a button.

Which logic gate matches this rule?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: A OR

Either condition on its own is enough to open the door, and both together still open it. That is how an OR gate behaves: the output is 1 when at least one input is 1.

Checked against ocr.org.uk

06 / Boolean logic, languages and IDEsEvery board

A car beeps when the engine is on (E) and the seatbelt is not fastened (S).

Which expression matches the rule?

  1. AE OR NOT S
  2. BNOT (E AND S)
  3. CNOT E AND S
  4. DE AND NOT S
Show the answer

Answer: D E AND NOT S

The beep needs two things at once: the engine on (E) and the seatbelt not fastened (NOT S). Joining them with AND gives E AND NOT S. Turn each part of a scenario into a condition, then join them.

Checked against ocr.org.uk

07 / Boolean logic, languages and IDEsEvery board

A heater should turn on when the room is not warm. W is 1 when the room is warm.

Which expression turns the heater on?

  1. AW
  2. BW OR W
  3. CW AND W
  4. DNOT W
Show the answer

Answer: D NOT W

The heater should be on when W is 0 and off when W is 1. A NOT gate flips W, so NOT W gives exactly that. W AND W and W OR W both just equal W.

Checked against ocr.org.uk

08 / Boolean logic, languages and IDEsEvery board

What does a truth table show?

  1. AThe output for every possible combination of inputs
  2. BThe data types of each variable
  3. CThe steps of a sorting algorithm
  4. DThe value of every variable at each step as an algorithm runs
Show the answer

Answer: A The output for every possible combination of inputs

A truth table lists every combination of input values with the output for each, using 1 for True and 0 for False. It shows exactly how a gate or circuit behaves.

Checked against ocr.org.uk

09 / Boolean logic, languages and IDEsEvery board

How many rows of input combinations does a truth table with two inputs have?

  1. A2
  2. B3
  3. C4
  4. D6
Show the answer

Answer: C 4

Each extra input doubles the number of combinations: 2 inputs give 4 rows and 3 inputs give 8. Listing them in counting order (000, 001, 010 and so on) makes sure none is missed.

Checked against cdn.sanity.io

10 / Boolean logic, languages and IDEsAQA, OCR and Eduqas

In logic diagrams, which gate is drawn as a triangle with a small circle at its tip?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: C NOT

The NOT symbol is a triangle with a small circle on its output; leaving the circle off, or adding one to AND or OR, is a common mistake. AND has a flat back and a D-shaped front, and OR has a curved back and a pointed front.

Checked against ocr.org.uk

11 / Boolean logic, languages and IDEsAQA and Eduqas

When does an XOR gate output 1?

  1. AWhen its two inputs are different
  2. BWhen its two inputs are the same
  3. CWhen both inputs are 0
  4. DWhen both inputs are 1
Show the answer

Answer: A When its two inputs are different

XOR (exclusive OR) outputs 1 when exactly one input is 1, so the inputs differ. Unlike OR, it outputs 0 when both inputs are 1.

Checked against cdn.sanity.io

12 / Boolean logic, languages and IDEsAQA and Eduqas

In the Boolean expression A . B, what does the dot mean?

  1. AOR
  2. BAND
  3. CNOT
  4. DXOR
Show the answer

Answer: B AND

In Boolean expressions a dot means AND, a plus means OR, a bar over a term means NOT and ⊕ means XOR. AQA expects these symbols rather than words, and Eduqas uses the same ones.

Checked against cdn.sanity.io

13 / Boolean logic, languages and IDEsEduqas

In Boolean algebra, what does A . 1 simplify to?

  1. A0
  2. B1
  3. CA
  4. DNOT A
Show the answer

Answer: C A

ANDing with 1 leaves A unchanged (the identity rule), while ORing with 1 always gives 1, whatever A is (annulment). Eduqas pupils use rules like these to simplify expressions.

Checked against eduqas.co.uk

14 / Boolean logic, languages and IDEsEduqas

In Boolean algebra, what does A AND NOT A always equal?

  1. A0
  2. B1
  3. CA
  4. DNOT A
Show the answer

Answer: A 0

A and NOT A are always opposite, so they can never both be 1: A AND NOT A is always 0. One of them is always 1, so A OR NOT A is always 1. These are the complement rules.

Checked against eduqas.co.uk

15 / Boolean logic, languages and IDEsEvery board

In Python, a condition mixes and with or and has no brackets. Which is worked out first?

  1. AWhichever comes first, reading left to right
  2. Bor
  3. Cand
  4. DWhichever comes last
Show the answer

Answer: C and

In Python, and is applied before or, just as multiplication comes before addition. So a or b and c means a or (b and c). Adding brackets makes the meaning clear to anyone reading the code.

Checked against docs.python.org

16 / Boolean logic, languages and IDEsEvery board

What is a logic circuit?

  1. AA loop that repeats a logical test
  2. BA table that lists every possible combination of inputs and outputs
  3. CLogic gates joined so some outputs feed other inputs
  4. DA cable that links two computers
Show the answer

Answer: C Logic gates joined so some outputs feed other inputs

A logic circuit combines gates, with the output of one gate becoming an input to another. Each circuit matches a Boolean expression, such as (A AND B) OR NOT C, and its behaviour can be shown in a truth table.

Checked against ocr.org.uk

17 / Boolean logic, languages and IDEsEvery board

Which is a feature of a high-level language?

  1. AEach instruction matches one machine code instruction
  2. BIt uses English-like words and must be translated
  3. CIt is written as binary 1s and 0s
  4. DThe processor can run it with no translation
Show the answer

Answer: B It uses English-like words and must be translated

High-level languages such as Python use English-like keywords, so they are easier to read, write and debug. One line can stand for many machine code instructions, and the code must be translated before the processor can run it.

Checked against cdn.sanity.io

18 / Boolean logic, languages and IDEsEvery board

Why is most software written in high-level languages?

  1. AIt always runs faster than machine code
  2. BIt never needs translating
  3. CIt is quicker to write, read and debug
  4. DIt gives direct control of each register
Show the answer

Answer: C It is quicker to write, read and debug

High-level code is easier for people to work with and is portable: it can be translated for different processors. Low-level code gives more control and can be faster, but it is harder to write and tied to one processor family.

Checked against cdn.sanity.io

19 / Boolean logic, languages and IDEsEvery board

What is machine code?

  1. APseudocode written on paper
  2. BShort words such as ADD and SUB
  3. CBinary instructions the processor runs directly
  4. DEnglish-like code that must be compiled
Show the answer

Answer: C Binary instructions the processor runs directly

Machine code is the binary that a processor actually executes, so it needs no translating. Each type of processor has its own instruction set, so machine code for one may not run on another.

Checked against cdn.sanity.io

20 / Boolean logic, languages and IDEsEvery board

Low-level code written with short codes such as ADD and SUB is called:

  1. Aassembly language
  2. Bmachine code
  3. Ca high-level language
  4. Dpseudocode
Show the answer

Answer: A assembly language

Assembly language uses mnemonics, short memorable codes like ADD, in place of binary. Each assembly instruction matches one machine code instruction, so it is still low level and still has to be translated.

Checked against cdn.sanity.io

21 / Boolean logic, languages and IDEsEvery board

When might a programmer choose a low-level language?

  1. ATo control specific hardware in an embedded system
  2. BTo make the code easy for beginners to read and change
  3. CTo make the code run on any processor
  4. DTo write a large app quickly
Show the answer

Answer: A To control specific hardware in an embedded system

Low-level code gives direct control of the processor and memory, and can be small and fast. That suits embedded systems, device drivers and other code that controls specific hardware.

Checked against cdn.sanity.io

22 / Boolean logic, languages and IDEsEvery board

Why must code in a high-level language be translated?

  1. ATo make the code easier to read
  2. BTo check that input is sensible
  3. CThe processor can only run machine code
  4. DTo add comments to the code
Show the answer

Answer: C The processor can only run machine code

A processor understands only machine code. Translators turn source code into machine code it can execute. Assembly language and high-level code must be translated; machine code itself needs no translation.

Checked against cdn.sanity.io

23 / Boolean logic, languages and IDEsEvery board

Which is a feature of a compiler?

  1. AIt translates the whole code into an executable file
  2. BIt stops at the very first error it finds while the code is running
  3. CIt translates and runs one line at a time
  4. DIt must be present every time the code runs
Show the answer

Answer: A It translates the whole code into an executable file

A compiler translates all the source code in one go into an executable file, listing any errors at the end. The executable runs quickly, and users need neither the source code nor the compiler, which also keeps the code private.

Checked against ocr.org.uk

24 / Boolean logic, languages and IDEsEvery board

Which is a feature of an interpreter?

  1. AIt translates and runs the code one line at a time
  2. BIt translates all of the code at once before any of it can run
  3. CIt turns assembly language into machine code
  4. DIt produces an executable file to share
Show the answer

Answer: A It translates and runs the code one line at a time

An interpreter translates and runs code line by line, stopping when it reaches an error, which makes testing and debugging easy. But the code runs more slowly, and the interpreter is needed every time it runs.

Checked against ocr.org.uk

25 / Boolean logic, languages and IDEsEvery board

Put these steps in order for code that is compiled.

  1. AThe compiler translates all of the code
  2. BAn executable file is produced
  3. CThe programmer writes the source code
  4. DThe user runs the executable
Show the answer

The right order:

  1. The programmer writes the source code
  2. The compiler translates all of the code
  3. An executable file is produced
  4. The user runs the executable

The programmer writes source code, the compiler translates all of it and produces an executable file, and users then run that executable. They need neither the compiler nor the source code.

Checked against ocr.org.uk

26 / Boolean logic, languages and IDEsEvery board

A games company wants to sell its game without letting buyers see the source code. Which translator suits this?

  1. AAn interpreter
  2. BA web browser
  3. CA text editor
  4. DA compiler
Show the answer

Answer: D A compiler

A compiler produces an executable that buyers can run without the source code, which protects the company’s work. With an interpreter, buyers would need both the source code and the interpreter.

Checked against ocr.org.uk

27 / Boolean logic, languages and IDEsAQA and Eduqas

Which translator turns assembly language into machine code?

  1. AA debugger
  2. BAn interpreter
  3. CAn assembler
  4. DA compiler
Show the answer

Answer: C An assembler

An assembler translates assembly language into machine code. Because assembly has a one-to-one match with machine code, each assembly instruction becomes one machine code instruction.

Checked against cdn.sanity.io

28 / Boolean logic, languages and IDEsOCR and Eduqas

What is an IDE?

  1. AA set of tools for writing and testing code
  2. BA list of a language’s keywords
  3. CA cable that connects a hard drive
  4. DA type of high-level language used for websites
Show the answer

Answer: A A set of tools for writing and testing code

An integrated development environment brings the tools a programmer needs into one place: an editor, error diagnostics, a run-time environment and a translator, plus debugging tools.

Checked against ocr.org.uk

29 / Boolean logic, languages and IDEsOCR and Eduqas

Colouring keywords, auto-indenting and suggesting the rest of a word are features of which IDE tool?

  1. AThe translator
  2. BThe editor
  3. CThe run-time environment
  4. DThe firewall
Show the answer

Answer: B The editor

The editor is where code is typed. Features such as syntax highlighting, automatic indentation, line numbers and auto-complete make code easier to read and help avoid mistakes.

Checked against ocr.org.uk

30 / Boolean logic, languages and IDEsOCR and Eduqas

Which IDE feature points out mistakes in the code and explains them with messages?

  1. AError diagnostics
  2. BAuto-complete
  3. CThe run-time environment
  4. DLine numbering
Show the answer

Answer: A Error diagnostics

Error diagnostics point out errors, often underlining the line and giving a message, such as a missing bracket. This helps the programmer find and fix errors quickly.

Checked against ocr.org.uk

31 / Boolean logic, languages and IDEsOCR

Which IDE tool lets the programmer run the code inside the IDE and see its output?

  1. AError diagnostics
  2. BThe editor
  3. CAuto-indentation
  4. DThe run-time environment
Show the answer

Answer: D The run-time environment

The run-time environment lets code be run and tested without leaving the IDE, showing its output and any errors that happen while it runs.

Checked against ocr.org.uk

32 / Boolean logic, languages and IDEsEduqas

A programmer wants the code to pause at line 20 so they can inspect it. Which tool should they use?

  1. AAuto-complete
  2. BA variable watch
  3. CA breakpoint
  4. DSyntax highlighting
Show the answer

Answer: C A breakpoint

Debugging tools help find logic errors. A breakpoint pauses the code at a chosen line, stepping runs it one line at a time, and a variable watch shows how chosen variables change, like a live trace table.

Checked against eduqas.co.uk

33 / Boolean logic, languages and IDEsEduqas

Which stage of compilation breaks the source code into tokens and removes comments and spaces?

  1. ACode generation
  2. BLexical analysis
  3. CSemantic analysis
  4. DSyntax analysis
Show the answer

Answer: B Lexical analysis

Lexical analysis splits the source code into tokens and removes comments and white space. Syntax analysis checks the tokens follow the rules of the language, semantic analysis checks the meaning makes sense, and code generation produces machine code, which can then be optimised.

Checked against eduqas.co.uk

34 / Boolean logic, languages and IDEsEvery board

Which translator is usually better when a beginner is testing small pieces of code?

  1. AAn interpreter
  2. BA defragmenter
  3. CA compiler that is run only at the end
  4. DA firewall
Show the answer

Answer: A An interpreter

An interpreter runs code straight away, line by line, and stops at the line with the error, so a beginner sees results and problems at once. A compiler suits finished software that is shared with users.

Checked against ocr.org.uk

02 / Exam questionsMarked by levels

Exam questions on this topic

Write your answer first, on paper. Then open it and tick off the points you made. The marks are as on that board’s paper.

6 marks / Languages for a smart thermostatEdexcel

A company is making a smart thermostat. Inside is a small embedded processor with very little memory that reads a temperature sensor and switches the boiler on and off. There is also a phone app so users can change the settings from anywhere.

Discuss the use of high-level and low-level languages to develop the software for this product.

What a full answer includes
  • High-level languages use English-like statements, so code is quicker to write, easier to read and easier to fix and update.
  • High-level code can run on different devices after translation, and comes with libraries, which suits the phone app.
  • High-level code must be translated by a compiler or interpreter, and the result may be larger and slower than hand-written low-level code.
  • Low-level assembly language gives direct control of the processor and its registers, so it can make small, fast code that fits in very little memory.
  • Assembly is specific to one type of processor, is harder and slower to write, and mistakes are easier to make.
  • A justified conclusion, for example a high-level language for the app and most of the thermostat, with assembly only for parts that must be very small or fast.

Model answer

The phone app should be written in a high-level language. High-level languages use English-like keywords, so the code is quicker to write and easier for other programmers to read, test and update when new features are added. They also come with libraries, for example for drawing screens and connecting to the internet, which would save a lot of work. A compiler would translate the code before the app is released, so users can run it without seeing the source code. The thermostat is different, because its embedded processor has very little memory. Low-level assembly language gives the programmer direct control over the processor’s registers and the sensor and boiler connections, and produces small, fast code. However, assembly only works on that one type of processor, and it is slow to write and easy to get wrong, so bugs could leave a house without heating. A high-level language can also be compiled for small processors, so most of the thermostat code could be high-level, which is easier to maintain. Overall, the company should use a high-level language for the app and most of the thermostat, and assembly only for small parts that must be very fast or control the hardware directly.

Where marks slip

Saying high-level languages are “easier to understand” earns little unless you say why. Link each point to this product: the phone app on one side and the small embedded processor on the other.

03 / In the appShow Working

All 34 questions in Show Working

This page shows 34 of them. In the app, choose your exam board and you only see what your exam asks for. Tap through questions, or open Read the answers to see the whole topic at once, covered until you tap.

More GCSE Computer Science topics

Our own questions, written for every board. Show Working is independent and not affiliated with any exam board.

Show WorkingFree on the App StoreFree in your browser, no download

Open it free