Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 6 subjective questions Introduction to NumPy

ECAP776 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Define a NumPy array. Explain how it differs from a Python list with respect to data type, memory usage, and supported operations.

  2. Question 2 of 20

    Compare the result of multiplication and addition operations on Python lists and NumPy arrays using suitable examples.

  3. Question 3 of 20

    Explain the meaning and importance of the NumPy array attributes ndim, shape, size, and dtype.

  4. Question 4 of 20

    Why are NumPy arrays generally more suitable than Python lists for large numerical computations? Discuss vectorization and memory efficiency.

  5. Question 5 of 20

    Describe homogeneous storage and type promotion in NumPy arrays. What happens when integers and floating-point values are supplied together?

  6. Question 6 of 20

    Explain how np.zeros(), np.ones(), and np.full() create arrays. Give examples of creating arrays with shape .

  7. Question 7 of 20

    Describe np.empty(). How does it differ from np.zeros(), and why must its contents not be treated as initialized values?

  8. Question 8 of 20

    Explain the syntax and behavior of np.arange(). Determine the output of np.arange(2, 12, 3) and state an important limitation for floating-point steps.

  9. Question 9 of 20

    Compare np.arange() and np.linspace(). When should each routine be used?

  10. Question 10 of 20

    Derive the spacing produced by np.linspace(a, b, n) when the endpoint is included. Then find the output of np.linspace(0, 1, 5).

  11. Question 11 of 20

    Explain the purpose of np.eye() and np.identity(). Create a identity matrix and describe a case where np.eye() is more flexible.

  12. Question 12 of 20

    Describe how a one-dimensional sequence created with an array creation routine can be converted into a multidimensional array using reshape(). State the necessary size condition.

  13. Question 13 of 20

    Explain how NumPy arrays are created from existing Python lists and tuples. Include examples of one-dimensional and two-dimensional input.

  14. Question 14 of 20

    Distinguish between np.array() and np.asarray() when converting existing data, especially when the input is already a NumPy array.

  15. Question 15 of 20

    Describe the purpose of np.fromiter() and np.frombuffer() for creating arrays from existing data. Mention one important consideration for each routine.

  16. Question 16 of 20

    Explain positive and negative indexing in a one-dimensional NumPy array. For a = np.array([10, 20, 30, 40, 50]), find a[1], a[-1], and a[-3].

  17. Question 17 of 20

    Explain NumPy slicing using the general form start:stop:step. Determine a[1:7:2] and a[::-1] for a = np.arange(8).

  18. Question 18 of 20

    Describe indexing and slicing in a two-dimensional NumPy array. For a = np.arange(12).reshape(3, 4), determine a[1, 2], a[:, 1], and a[0:2, 2:4].

  19. Question 19 of 20

    Explain the difference between a basic slice view and an independent copy in NumPy. Demonstrate how modifying a slice can affect the original array.

  20. Question 20 of 20

    Compare basic slicing, integer array indexing, and Boolean indexing in NumPy. Use examples and explain whether the result usually shares data with the source.

That's unit 6

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.