NEW
Font size
WorksheetsArray in Python
Total questions: 45
Worksheet time: 24mins
__________ is a library used to create data structures and carry out scientific calculations.
Python
Numpy
Pycharm
Bar chart
How to use numpy ?
import numpy as np
import pandas as pd
import pyplot as plt
Name the function used to create an array?
np.aray()
np.array()
Np.array()
np.arange()
np.arange(2,8,1) ----> what output will be produced?
2,3,4,5,6,7,8
2,3,4,5,6,7,8,9
2,3,4,5,6,7
2,4,6,8
np.array{[4,7]}
[ 4 7 ]
[ 4 5 6 7 ]
[ 4 5 6 ]
[ 1 2 3 4 5 6 7 ]
names = np.array(["Reem" , "Salah" , "Haya" , "Maryam" , "Fatema"])
print(names[[2,3,4]])
Mark the right output from the below options
[ 'Haya' 'Maryam' 'Fatema' ]
[ 'Maryam' 'Haya' 'Fatema' ]
[ 'Reem' 'Salah' 'Fatema' ]
[ 'Reem' 'Salah' 'Haya' ]
names = np.array(["Reem" , "Salah" , "Haya" , "Maryam" , "Fatema"])
names[2] = "Omar"
print(names)
Mark the right output from the below options
[ "Reem" "Salah" "Haya" , "Maryam" "Fatema" ]
[ "Reem" "Salah" "Omar" "Maryam" "Fatema" ]
[ "Reem" "Haya" "Salah" "Maryan" "Fatema" ]
Which among the below options is a vector?
What output will the image above produce?
[ [ 65. 60. 70. 58.
1.70. 1.65. 1.72. 1.60. ]]
[ [ 1.70. 1.65. 1.72. 1.60
65. 60. 70. 58. ] ]
What does the word "appending" mean?
adding something extra
changing something
What would be the output of the following code ?
15 18 16 20 19
18 16 17 15 20
[33, 34, 33, 35, 39]
[ 15 18 16 20 19
18 16 17 15 20
33 34 33 35 39 ]
2**2 ----- What output will this produce?
2
4
8
0
Each location of an element in an array is called ______________
Size
Length
Index
Element
Two dimensional arrays are also known as ______________
Subscripts
Matrices
ndarray
Vectors
One dimensional arrays are also known as _____________
Vectors
ndarray
Matrices
Subscript
b=np.array([[1,2,3,4],[5,6,7,8],[10,11,12,13]])
Write the value of b[2,1].
3
6
10
11
We can do arithmetic operations in python list.
True
False
x=np.array([9,4,2,7])
y=x+5
[14 9 7 12]
[14,9 ,7, 12]
[13 8 6 12]
[13,8 ,6 ,12]
_______________ is used to change the dimension or shape of the array.(Select the code used for it.)
shape
reshape
reshape()
itemsize
What multiplication sentence does this array show?
4 X 8 = 32
4 X 8 = 31
5 X 8 = 32
4 X 8
How we can find the type of numpy array in python?
dtype
typei
type
itype
what is the use of the zeros() function in Numpy array in python ?
To make a Matrix with first row 0
To make a Matrix with all element 0
To make a Matrix with all diagonal element 0
None of the above
Which of the following is not valid to import the numpy module ?
import numpy as np
import numpy as n
import numpy as p
None of the above
Which of the following find the maximum number in the Numpy array?
max(array)
array.max()
array(max)
None of the above
x=np.array([10,20,30,40,50,60,70])
print(np.median(x))
Find the output
35
35.0
40
37.7
Numpy in the Python provides the
Function
Lambda function
Type casting
Array
What will be the output of the following code:
import numpy as np
a = np.array([[0, 1, 2], [3, 4, 5]])
b = a.sum(axis=1)
print (b)
3
12
[3 12]
[3 5 7]
What Python package for Linear Algebra ?
Matrix
Array
NumPy
Pynum
Which operator is used in python to import all modules from packages?
. operator
* operator
-> symbol
, operator
What is the extension of python library modules?
.mod
.lib
.code
.py
random.randrange(6)
0,1,2,3,4,5,6
1,2,3,4,5,6
0,1,2,3,4,5
1,2,3,4,5
random.randint(3,8)
4,5,6,7
3,4,5,6,7
3,4,5,6,7,8
0,1,2,3,4,5,6,7,8
random.uniform() requires two parameters
True
False
random.random() generates a floating point number between _____ and ______
1 and 2
1 and 0
0 and 1
0 and 10
Which of the following symbols means more than?
<
>
==
!=
Which of the following would allow the user to enter data?
elif
output
input
If you type 6//2 what result would you get in python.
3.0
4
3
0
If you type 10/5 what result would you get in python?
2
2.0
0
15
if you type print("4"+"9") what result would you get
49
13
error
0
What is a variable?
A named memory location
a value
a number
a letter
Which of the following would generate a random number?
number =random.randit
number=randon.randnt(0,100)
number=random.randint(0,100)
number=random(0,100)
Which module is used to import math functions like 'ceil' , 'sqr' etc. ?
math module
functions module
arithmatics module
turtle module
Which of the following data types cannot be edited, altered or called upon ?
Lists
Dictionaries
Tuples
Strings
Just like 'if-else' statments, the while loop also has a 'else' statment
True
False
False. But the 'for' loop has an else statment.
