BADM 211 Exam Questions with Correct Answers
Question 1:
Both "=" and "==" perform the same function in Python.
Answer:
False
Question 2:
What is the output of the following lines of code: word = "BADM" word = 211
print(word)
Answer:
211
Question 3:
Which of the following is not a valid variable type in Python?
Answer:
DoubleString
Question 4:
What will be the result of the following code? 2 * 3.0
Answer:
6.0
Question 5:
Which code will filter the dataframe df for rows where the column "col1" has values that are
NOT equal to 5?
Answer:
df[df["col1"]!= 5]
Question 6:
Which of the following pandas methods will report summary statistics of numeric columns?
describe()
Suppose we have a data frame df, which includes a column animal. I would like to count the
, number of times each animal appears in the column, e.g.
Elephant: 8, Zebra: 7, etc.
Which of the following commands can I use to do that?
Answer:
df["animal"].value_counts()
Question 7:
Assuming dataframe df is properly defined, what line of code would output the first 10 rows of
data?
Answer:
df.head(10)
Question 8:
Which option will help us select elements "a" and "b" in the list L = ["a", "b", "c"]? (Select all
that apply.)
Answer:
L[0:2] L[-3:-1]
Question 9:
Which of these will help us select two columns, c1 and c2, from the dataframe df? df[["c1",
"c2"]]
What will be the output of List1[-2] if List1 is defined as below? List1 = ['Hello', 3, 'BADM', 211,
'Professor', 3.14]
Answer:
'Professor'
Question 10:
A list can hold multiple types of data.
Answer:
True
Question 11:
What would the following code output? var = [1, 2, [3], [5], [4, 6, [7, 8]]] print(len(var))
Answer:
Question 1:
Both "=" and "==" perform the same function in Python.
Answer:
False
Question 2:
What is the output of the following lines of code: word = "BADM" word = 211
print(word)
Answer:
211
Question 3:
Which of the following is not a valid variable type in Python?
Answer:
DoubleString
Question 4:
What will be the result of the following code? 2 * 3.0
Answer:
6.0
Question 5:
Which code will filter the dataframe df for rows where the column "col1" has values that are
NOT equal to 5?
Answer:
df[df["col1"]!= 5]
Question 6:
Which of the following pandas methods will report summary statistics of numeric columns?
describe()
Suppose we have a data frame df, which includes a column animal. I would like to count the
, number of times each animal appears in the column, e.g.
Elephant: 8, Zebra: 7, etc.
Which of the following commands can I use to do that?
Answer:
df["animal"].value_counts()
Question 7:
Assuming dataframe df is properly defined, what line of code would output the first 10 rows of
data?
Answer:
df.head(10)
Question 8:
Which option will help us select elements "a" and "b" in the list L = ["a", "b", "c"]? (Select all
that apply.)
Answer:
L[0:2] L[-3:-1]
Question 9:
Which of these will help us select two columns, c1 and c2, from the dataframe df? df[["c1",
"c2"]]
What will be the output of List1[-2] if List1 is defined as below? List1 = ['Hello', 3, 'BADM', 211,
'Professor', 3.14]
Answer:
'Professor'
Question 10:
A list can hold multiple types of data.
Answer:
True
Question 11:
What would the following code output? var = [1, 2, [3], [5], [4, 6, [7, 8]]] print(len(var))
Answer: