1. Home
  2. Data Science
  3. NumPy
  4. Array a has shape (3, 4). What is the shape of…

Added 2 Nov 2026

Array a has shape (3, 4). What is the shape of a.mean(axis=1)?

  1. (3,) Correct answer
  2. (4,)
  3. (3, 4)
  4. (1,)

Correct answer

A. (3,)

18 views

MCQSEXAM

Explanation

axis=1 averages across columns within each row, collapsing that axis and leaving one mean per row: shape (3,). Add keepdims=True to keep (3, 1).

Reference

Asked in: Data Science Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs