logo

AQA A-Level Computer Science practice

Which Python dictionary represents the function that maps 0 to 2.0, 1 to 3.14159, 2 to -1.0 and 3 to 2.718281828?

Try the question first, then check the answer and practise the same topic again.

At a glance

MCQ

Type

practice

Style

Topic

Vectors

Exam-style question

Try this first

Which Python dictionary represents the function that maps 0 to 2.0, 1 to 3.14159, 2 to -1.0 and 3 to 2.718281828?.

  1. A.{0: 2.0, 1: 3.14159, 2: -1.0, 3: 2.718281828}
  2. B.{2.0: 0, 3.14159: 1, -1.0: 2, 2.718281828: 3}
  3. C.{0: 1, 1: 2, 2: 3, 3: 4}
  4. D.[0: 2.0, 1: 3.14159, 2: -1.0, 3: 2.718281828]

Answer and explanation

Concise answer

{0: 2.0, 1: 3.14159, 2: -1.0, 3: 2.718281828}

Why this is correct

In the function interpretation, each index is mapped to the corresponding real-number entry. A Python dictionary stores each index as a key and its vector value as the associated value.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions