# พื้นฐาน NumPy (Data Science & ML) > Arrays, ndarray, การทำดัชนี, slicing, broadcasting, การดำเนินการแบบเวกเตอร์, พีชคณิตเชิงเส้น - 22 คำถามสัมภาษณ์ - Junior - [คำถามสัมภาษณ์: Data Science & ML](https://sharpskill.dev/th/technologies/data-science/interview-questions.md) ## 1. ndarray ใน NumPy คืออะไร? **คำตอบ** ndarray (N-dimensional array) คือโครงสร้างข้อมูลพื้นฐานของ NumPy เป็นอาร์เรย์หลายมิติที่เป็นเนื้อเดียวกัน หมายความว่าทุกองค์ประกอบต้องเป็นชนิดเดียวกัน ความเป็นเนื้อเดียวกันนี้ทำให้สามารถทำการดำเนินการแบบเวกเตอร์ได้อย่างรวดเร็ว เพราะข้อมูลถูกจัดเก็บอย่างต่อเนื่องในหน่วยความจำ ไม่เหมือนกับ Python lists ที่จัดเก็บการอ้างอิงไปยังออบเจ็กต์ที่กระจัดกระจาย ## 2. วิธีสร้างอาร์เรย์ NumPy ที่มีค่า [1, 2, 3, 4, 5]? **คำตอบ** ฟังก์ชัน np.array() เป็นวิธีมาตรฐานในการสร้าง ndarray จากซีเควนซ์ Python เช่น list หรือ tuple มันแปลงซีเควนซ์เป็นอาร์เรย์ NumPy ที่ถูกปรับให้เหมาะสม ฟังก์ชันอื่นๆ เช่น np.arange() สร้างซีเควนซ์แต่ด้วยไวยากรณ์ที่แตกต่าง (start, stop, step) และ np.zeros()/np.ones() สร้างอาร์เรย์ที่เติมด้วยค่าเฉพาะ ## 3. ใช้ฟังก์ชันใดในการสร้างอาร์เรย์ที่มี 10 องค์ประกอบเว้นระยะเท่ากันระหว่าง 0 และ 1? **คำตอบ** np.linspace(0, 1, 10) สร้างค่า 10 ค่าที่เว้นระยะเท่ากันระหว่าง 0 และ 1 รวมทั้งจุดปลายทั้งสอง เหมาะอย่างยิ่งเมื่อทราบจำนวนจุดที่ต้องการ np.arange() ใช้ขั้นคงที่และอาจไม่รวมจุดปลาย np.linspace() เป็นที่นิยมสำหรับช่วงที่ต้องการจำนวนจุดที่แม่นยำ โดยเฉพาะอย่างยิ่งสำหรับการพล็อตหรือการคำนวณการอินทิเกรตเชิงตัวเลข ## มีอีก 19 คำถาม - แอตทริบิวต์ใดที่ให้มิติ (shape) ของอาร์เรย์ NumPy? - วิธีสร้างเมทริกซ์ 3x3 ที่เติมด้วยศูนย์? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Data Science & ML อื่นๆ - [พื้นฐาน Python](https://sharpskill.dev/th/technologies/data-science/interview-questions/python-basics.md): 25 คำถาม, Junior - [การเขียนโปรแกรมเชิงวัตถุด้วย Python](https://sharpskill.dev/th/technologies/data-science/interview-questions/python-oop.md): 20 คำถาม, Junior - [โครงสร้างข้อมูล Python](https://sharpskill.dev/th/technologies/data-science/interview-questions/python-data-structures.md): 20 คำถาม, Junior - [พื้นฐาน Git](https://sharpskill.dev/th/technologies/data-science/interview-questions/git-fundamentals.md): 18 คำถาม, Junior - [พื้นฐาน SQL](https://sharpskill.dev/th/technologies/data-science/interview-questions/sql-basics.md): 20 คำถาม, Junior - [พื้นฐาน Pandas](https://sharpskill.dev/th/technologies/data-science/interview-questions/pandas-basics.md): 22 คำถาม, Junior - [Jupyter & Google Colab](https://sharpskill.dev/th/technologies/data-science/interview-questions/jupyter-colab.md): 16 คำถาม, Junior - [SQL Joins และคิวรีขั้นสูง](https://sharpskill.dev/th/technologies/data-science/interview-questions/sql-joins-advanced.md): 22 คำถาม, Mid-Level - [Pandas ขั้นสูง](https://sharpskill.dev/th/technologies/data-science/interview-questions/pandas-advanced.md): 24 คำถาม, Mid-Level - [การแสดงผลข้อมูลด้วย Matplotlib & Seaborn](https://sharpskill.dev/th/technologies/data-science/interview-questions/matplotlib-seaborn.md): 20 คำถาม, Mid-Level - [การแสดงผลแบบโต้ตอบด้วย Plotly](https://sharpskill.dev/th/technologies/data-science/interview-questions/plotly-interactive.md): 18 คำถาม, Mid-Level - [สถิติเชิงพรรณนา](https://sharpskill.dev/th/technologies/data-science/interview-questions/statistics-descriptive.md): 20 คำถาม, Mid-Level - [สถิติเชิงอนุมาน](https://sharpskill.dev/th/technologies/data-science/interview-questions/statistics-inferential.md): 24 คำถาม, Mid-Level - [Web Scraping](https://sharpskill.dev/th/technologies/data-science/interview-questions/web-scraping.md): 18 คำถาม, Mid-Level - [BigQuery & Cloud Data](https://sharpskill.dev/th/technologies/data-science/interview-questions/bigquery-cloud.md): 18 คำถาม, Mid-Level - [Feature Engineering](https://sharpskill.dev/th/technologies/data-science/interview-questions/feature-engineering.md): 22 คำถาม, Mid-Level - [ML แบบมีผู้สอน: การถดถอย](https://sharpskill.dev/th/technologies/data-science/interview-questions/ml-supervised-regression.md): 24 คำถาม, Mid-Level - [ML แบบมีผู้สอน: การจำแนกประเภท](https://sharpskill.dev/th/technologies/data-science/interview-questions/ml-supervised-classification.md): 24 คำถาม, Mid-Level - [Decision Trees และ Ensembles](https://sharpskill.dev/th/technologies/data-science/interview-questions/ml-trees-ensembles.md): 24 คำถาม, Mid-Level - [Unsupervised ML](https://sharpskill.dev/th/technologies/data-science/interview-questions/ml-unsupervised.md): 22 คำถาม, Mid-Level - [ML Pipelines และการตรวจสอบ](https://sharpskill.dev/th/technologies/data-science/interview-questions/ml-pipelines-validation.md): 22 คำถาม, Mid-Level - [Time Series และการพยากรณ์](https://sharpskill.dev/th/technologies/data-science/interview-questions/time-series-forecasting.md): 22 คำถาม, Mid-Level - [พื้นฐาน Deep Learning](https://sharpskill.dev/th/technologies/data-science/interview-questions/deep-learning-fundamentals.md): 24 คำถาม, Senior - [TensorFlow & Keras](https://sharpskill.dev/th/technologies/data-science/interview-questions/tensorflow-keras.md): 22 คำถาม, Senior - [CNN และการจำแนกภาพ](https://sharpskill.dev/th/technologies/data-science/interview-questions/cnn-image-classification.md): 24 คำถาม, Senior - [RNN และซีเควนซ์](https://sharpskill.dev/th/technologies/data-science/interview-questions/rnn-sequences.md): 22 คำถาม, Senior - [Transformers และ Attention](https://sharpskill.dev/th/technologies/data-science/interview-questions/transformers-attention.md): 24 คำถาม, Senior - [NLP และ Hugging Face](https://sharpskill.dev/th/technologies/data-science/interview-questions/nlp-huggingface.md): 24 คำถาม, Senior - [GenAI และ LangChain](https://sharpskill.dev/th/technologies/data-science/interview-questions/genai-langchain.md): 24 คำถาม, Senior - [MLOps และการ Deploy](https://sharpskill.dev/th/technologies/data-science/interview-questions/mlops-deployment.md): 24 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/data-science/interview-questions/numpy-fundamentals