AI & Machine Learning NumPy Arrays Quiz

This quiz checks the NumPy basics every data science and machine learning workflow uses. You will predict the output of short snippets that create, index, slice, filter and reshape arrays, and spot the one that fails.

Easy 10 questions ~5 minutes Pass at 80%

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 10

What does this print?

import numpy as np
a = np.array([1, 2, 3])
print((a * 2).tolist())
Show the answer

B. [2, 4, 6] NumPy applies * 2 to every element, so you get [2, 4, 6]. Repeating the items, [1, 2, 3, 1, 2, 3], is what * does to a plain Python list.

What this quiz covers

  • Element-wise math on arrays vs lists
  • shape, dtype and reshape()
  • Indexing, slicing and boolean masks
  • Slices are views, not copies
  • Summing along an axis

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.