Data Types, Data Structures & Algorithms Quiz

Test your knowledge of Data Types, Data Structures & Algorithms with these A-Level Computer Science exam style questions.

This quiz consists of 15 questions. Scroll down to start the quiz!

Questions

Describe the different primitive data types and explain their uses in programming.

Primitive data types are the basic building blocks of data in programming. Integers represent whole numbers, real (floating-point) numbers represent decimal values, characters represent single symbols, strings represent sequences of characters, and Booleans represent true or false values. These types are essential for storing and manipulating data. 

Explain how positive integers are represented in binary, with an example.

Positive integers are represented in binary using base-2, where only digits 0 and 1 are used. Each position represents a power of 2. For example, the denary number 13 is represented as 1101 in binary (8 + 4 + 0 + 1). 

Compare sign and magnitude with two’s complement for representing negative numbers in binary.

Sign and magnitude uses the most significant bit to represent the sign, while the remaining bits represent the magnitude. Two’s complement represents negative numbers by inverting the bits of the positive number and adding 1. Two’s complement is more widely used because it simplifies arithmetic operations and avoids issues like having two representations of zero. 

Describe how binary addition and subtraction are performed.

Binary addition follows rules similar to decimal addition, with carries when sums exceed 1. For example, 1 + 1 = 10. Binary subtraction is often performed using two’s complement by adding the negative of a number instead of subtracting directly. 

Explain how to convert between binary, denary, and hexadecimal number systems.

Binary to hexadecimal conversion involves grouping binary digits into sets of four and converting each group to its hexadecimal equivalent. Denary to binary conversion involves repeated division by 2, while denary to hexadecimal involves division by 16. 

Describe how floating-point numbers are represented and explain the concept of normalisation.

Floating-point numbers are represented using three components: sign, exponent, and mantissa. Normalisation ensures that the mantissa starts with a non-zero digit, maximising precision and consistency in representation. 

Explain how floating-point addition and subtraction are carried out.

To add or subtract floating-point numbers, their exponents must first be aligned by adjusting the mantissa. The arithmetic operation is then performed on the mantissas, and the result is normalised. 

Describe bitwise operations (AND, OR, XOR, shifts) and explain their practical uses.

Bitwise operations manipulate individual bits. AND is used for masking bits, OR for setting bits, XOR for toggling bits, and shifts for multiplying or dividing by powers of 2. These operations are efficient and commonly used in low-level programming. 

Compare ASCII and Unicode character sets.

ASCII is a 7-bit character set that represents 128 characters, mainly for English text. Unicode is a much larger character set that supports a wide range of languages and symbols, making it suitable for global applications. 

Describe arrays, records, lists, and tuples, highlighting their differences.

Arrays store elements of the same type in contiguous memory locations. Records store multiple fields of different types. Lists are ordered collections that can contain mixed data types. Tuples are similar to lists but are immutable. 

Explain how linked lists, stacks, queues, and trees store and manage data.

Linked lists consist of nodes connected by pointers, allowing dynamic memory usage. Stacks follow a last-in, first-out structure, while queues follow first-in, first-out. Trees organise data hierarchically, enabling efficient searching and sorting. 

Describe how graphs are structured and explain how they can be traversed.

Graphs consist of vertices connected by edges and can be directed or undirected. They can be traversed using Depth-First Search (DFS) or Breadth-First Search (BFS), depending on the application. 

Explain how hash tables work, including how collisions are handled.

Hash tables store key-value pairs using a hash function to determine the storage location. Collisions occur when multiple keys map to the same index and can be handled using methods such as chaining or open addressing. 

Describe how Boolean algebra can be used to simplify logical expressions, including the use of Karnaugh maps and De Morgan’s laws.

Boolean algebra simplifies logical expressions using rules and identities. Karnaugh maps visually group values to simplify expressions, while De Morgan’s laws provide ways to transform expressions involving AND, OR, and NOT operations. 

Explain the function of logic gates, truth tables, and the roles of D-type flip flops, half adders, and full adders.

Logic gates perform basic logical operations such as AND, OR, and NOT. Truth tables show all possible input combinations and outputs. D-type flip flops store a single bit of data, while half adders and full adders perform binary addition, forming the basis of arithmetic circuits.

sign up to revision world banner
Slot