
Numpy and Pandas Quiz
Authored by Singaravelan Giridharan
Other
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What does the following NumPy code output? import numpy as np arr = np.array([1, 2, 3, 4]) print(arr.shape)
Answer explanation
A 1D NumPy array has a shape of (n,) where n is the number of elements.
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the output of this NumPy operation? import numpy as np arr = np.array([10, 20, 30]) print(arr * 2)
Answer explanation
NumPy broadcasts 2 across the entire array and multiplies each element.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will the following code output? import numpy as np arr = np.array([[1, 2], [3, 4]]) print(arr.T)
Answer explanation
arr.T transposes the matrix, swapping rows and columns.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What does np.zeros((2,3)) create?
Answer explanation
np.zeros((2,3)) creates a 2-row, 3-column matrix filled with zeros.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
import numpy as np
arr = np.array(['A', 'B', 'C', 'D'])
print(arr.dtype)
What will be the output of the following code?
int32
float64
U1
Answer explanation
np.arange(start, stop, step) generates numbers starting from 3 up to 10 (exclusive), incrementing by 2.
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What does the following pandas code output? import pandas as pd data = {'A': [1, 2, 3], 'B': [4, 5, 6]} df = pd.DataFrame(data) print(df.shape)
Answer explanation
The DataFrame has 3 rows and 2 columns, so df.shape returns (3, 2).
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What will df.head(2) return? import pandas as pd df = pd.DataFrame({'A': [10, 20, 30], 'B': [40, 50, 60]}) print(df.head(2))
Answer explanation
df.head(n) returns the first n rows of the DataFrame.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
IT: Technical/Computer Terms Quiz #40
Quiz
•
11th Grade - University
10 questions
พยัญชนะ
Quiz
•
6th Grade - University
15 questions
TENSION 2021 A
Quiz
•
12th Grade - University
13 questions
Redbull Q
Quiz
•
9th Grade - Professio...
12 questions
Conditional Statements : Quiz - 4
Quiz
•
University
10 questions
Kuis Sosialisasi Fuel Balance RU V
Quiz
•
University
13 questions
Tut 2 - Menu
Quiz
•
University - Professi...
10 questions
UAS HUKUM DAN HAM
Quiz
•
University
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Other
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University