100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

S364 Final UPDATED Exam Questions and CORRECT Answers

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
12-05-2025
Written in
2024/2025

S364 Final UPDATED Exam Questions and CORRECT Answers Since NumPy arrays can only have one data type in an array the following code would cause a Run-time error (not work). import numpy as np arr_a = ([1, "2", 0]) - CORRECT ANSWER The following code creates a NumPy list of integers. import numpy as np arr_a = ([1, 2, 0.0]) - CORRECT ANSWER import numpy as np #Python Lists: a = [1, 3, 5, 7, 9] b = [2, 4, 6, 8, 10] c = a + b #NumPy Arrays: an = (a) bn = (b) ac = an + bn print(ac) - CORRECT ANSWER - False - False

Show more Read less
Institution
S364
Course
S364









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
S364
Course
S364

Document information

Uploaded on
May 12, 2025
Number of pages
8
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

S364 Final UPDATED Exam Questions and
CORRECT Answers
Since NumPy arrays can only have one data type in an array the following code would cause a
Run-time error (not work).


import numpy as np

arr_a = np.array([1, "2", 0]) - CORRECT ANSWER - False


The following code creates a NumPy list of integers.
import numpy as np

arr_a = np.array([1, 2, 0.0]) - CORRECT ANSWER - False


import numpy as np
#Python Lists:
a = [1, 3, 5, 7, 9]
b = [2, 4, 6, 8, 10]
c=a+b
#NumPy Arrays:
an = np.array(a)
bn = np.array(b)
ac = an + bn

print(ac) - CORRECT ANSWER - [1, 3, 5, 7, 9, 2, 4, 6, 8, 10]
[ 3 7 11 15 19]


If we have a 1-diminsional array we can convert it to a 2-dimensional array using what method?
- CORRECT ANSWER - np.reshape()

, To determine the dimensions of a NumPy array we can use what code? - CORRECT
ANSWER - arr.ndim


The following code would be considered what kind of NumPy array?
import numpy as np
arr = np.array([[1, 3, 5],
[2, 4, 6],

[5,6,7]]) - CORRECT ANSWER - 2-dimensional


The following code would cause an run-time error (would not work).


a = np.array([1, 3, 5])

b = np.array([6]) - CORRECT ANSWER - False


To fill a one-dimensional NumPy array of 10 elements with all zeros we can use - CORRECT
ANSWER - np.zeros(0,0)


To create a 2-dimensional array of random numbers we could use the following code -
CORRECT ANSWER - np.random.randint(0, 10, (3, 3))


To print out the first row of the following NumPy array I could use


import numpy as np
b = np.array([[5, 3, 1],

[2, 4, 6]]) - CORRECT ANSWER - More than one of these options would work:
print(b[0, :])
print(b[:])
print(b(0))
print(b[0])
R195,15
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached


Document also available in package deal

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MGRADES Stanford University
Follow You need to be logged in order to follow users or courses
Sold
1078
Member since
1 year
Number of followers
102
Documents
68972
Last sold
9 hours ago
MGRADES (Stanford Top Brains)

Welcome to MGRADES Exams, practices and Study materials Just think of me as the plug you will refer to your friends Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3,8

171 reviews

5
73
4
30
3
46
2
8
1
14

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions