Big Data Analytics — Midterm 1
CIS 5450 – MIDTERM 1 | VERIFIED EXAM QUESTIONS AND
ANSWERS - LATEST VERSION | 2026/2027
BIG DATA ANALYTICS
MIDTERM
1. Which Python data structure is ordered, mutable, and allows
duplicate elements?
A. list
B. tuple
C. frozenset
D. set
ANSWER : A. list
Lists keep insertion order, can be changed in place and accept duplicates;
tuples are immutable and sets discard duplicates.
2. What is the result of [x**2 for x in range(4) if x % 2 == 0]?
A. [0, 1, 4, 9]
B. [0, 4]
C. [4, 16]
D. [1, 9]
ANSWER : B. [0, 4]
range(4) yields 0 to 3; only 0 and 2 are even, and their squares are 0 and
4.
Page 1 of 53
,Big Data Analytics — Midterm 1
3. Which of the following can be used as a key in a Python dictionary?
A. {'a': 1}
B. {1, 2}
C. ('a', 1)
D. ['a', 1]
ANSWER : C. ('a', 1)
Dictionary keys must be hashable; a tuple of immutable values is
hashable, while lists, dicts and sets are not.
4. What does sorted(words, key=lambda w: len(w)) return?
A. The original list sorted in place alphabetically
B. A new list ordered by length, longest first
C. A new list of the words ordered by length, shortest first
D. A list of the word lengths in ascending order
ANSWER : C. A new list of the words ordered by length, shortest first
sorted() returns a new list, and the key function makes length the sort
criterion in ascending order by default.
5. What does a Python function return if it has no return statement?
A. An empty string
B. It raises a RuntimeError
C. None
D. 0
ANSWER : C. None
Any function that finishes without an explicit return value implicitly
returns None.
6. Given a = [1, 2, 3]; b = a; b.append(4), what is the value of a?
A. [1, 2, 3]
B. [4]
C. An error is raised
D. [1, 2, 3, 4]
ANSWER : D. [1, 2, 3, 4]
Assignment copies the reference, not the list, so a and b point to the same
object.
Page 2 of 53
,Big Data Analytics — Midterm 1
7. What is the main advantage of a generator expression over a list
comprehension for large data?
A. It automatically runs in parallel
B. It produces items lazily and uses far less memory
C. It allows random access by index
D. It always runs in constant time
ANSWER : B. It produces items lazily and uses far less memory
Generators yield one value at a time on demand instead of building the
whole list in memory.
8. Which built-in function returns an iterator that applies a function to
every item of an iterable?
A. filter
B. enumerate
C. map
D. zip
ANSWER : C. map
map(f, iterable) applies f to each element lazily; filter keeps elements, zip
pairs them, enumerate adds counters.
9. What is the result of dict(zip(['a', 'b'], [1, 2]))?
A. {'a': 1, 'b': 2}
B. {1: 'a', 2: 'b'}
C. {'a': 'b', 1: 2}
D. [('a', 1), ('b', 2)]
ANSWER : A. {'a': 1, 'b': 2}
zip pairs elements positionally and dict() turns each pair into a key-value
entry.
10. What is the average-case time complexity of testing membership (x
in s) for a Python set?
A. O(n log n)
B. O(log n)
C. O(n)
D. O(1)
ANSWER : D. O(1)
Sets are hash tables, so lookups take constant time on average, unlike the
linear scan needed for lists.
Page 3 of 53
, Big Data Analytics — Midterm 1
SECTION 2: PANDAS SERIES AND DATAFRAMES
11. Which description best fits a pandas Series?
A. An unlabeled NumPy array with no index
B. A two-dimensional table with rows and columns
C. A dictionary whose values must all be lists
D. A one-dimensional labeled array with an associated index
ANSWER : D. A one-dimensional labeled array with an associated
index
A Series holds one column of values together with index labels used for
alignment.
12. What does df.shape return?
A. The total number of cells in the DataFrame
B. The memory footprint of the DataFrame
C. A list of column data types
D. A tuple of (number of rows, number of columns)
ANSWER : D. A tuple of (number of rows, number of columns)
shape gives the dimensions as (rows, columns).
13. When pd.read_csv() is called without index_col, what index does the
resulting DataFrame receive?
A. No index at all
B. A default RangeIndex starting at 0
C. A DatetimeIndex
D. The first column of the file
ANSWER : B. A default RangeIndex starting at 0
Without index_col, pandas assigns a sequential integer RangeIndex.
14. Which method displays the first five rows of a DataFrame by
default?
A. df.head()
B. df.top()
C. df.first()
D. df.peek()
ANSWER : A. df.head()
head() returns the first n rows, where n defaults to 5.
Page 4 of 53
CIS 5450 – MIDTERM 1 | VERIFIED EXAM QUESTIONS AND
ANSWERS - LATEST VERSION | 2026/2027
BIG DATA ANALYTICS
MIDTERM
1. Which Python data structure is ordered, mutable, and allows
duplicate elements?
A. list
B. tuple
C. frozenset
D. set
ANSWER : A. list
Lists keep insertion order, can be changed in place and accept duplicates;
tuples are immutable and sets discard duplicates.
2. What is the result of [x**2 for x in range(4) if x % 2 == 0]?
A. [0, 1, 4, 9]
B. [0, 4]
C. [4, 16]
D. [1, 9]
ANSWER : B. [0, 4]
range(4) yields 0 to 3; only 0 and 2 are even, and their squares are 0 and
4.
Page 1 of 53
,Big Data Analytics — Midterm 1
3. Which of the following can be used as a key in a Python dictionary?
A. {'a': 1}
B. {1, 2}
C. ('a', 1)
D. ['a', 1]
ANSWER : C. ('a', 1)
Dictionary keys must be hashable; a tuple of immutable values is
hashable, while lists, dicts and sets are not.
4. What does sorted(words, key=lambda w: len(w)) return?
A. The original list sorted in place alphabetically
B. A new list ordered by length, longest first
C. A new list of the words ordered by length, shortest first
D. A list of the word lengths in ascending order
ANSWER : C. A new list of the words ordered by length, shortest first
sorted() returns a new list, and the key function makes length the sort
criterion in ascending order by default.
5. What does a Python function return if it has no return statement?
A. An empty string
B. It raises a RuntimeError
C. None
D. 0
ANSWER : C. None
Any function that finishes without an explicit return value implicitly
returns None.
6. Given a = [1, 2, 3]; b = a; b.append(4), what is the value of a?
A. [1, 2, 3]
B. [4]
C. An error is raised
D. [1, 2, 3, 4]
ANSWER : D. [1, 2, 3, 4]
Assignment copies the reference, not the list, so a and b point to the same
object.
Page 2 of 53
,Big Data Analytics — Midterm 1
7. What is the main advantage of a generator expression over a list
comprehension for large data?
A. It automatically runs in parallel
B. It produces items lazily and uses far less memory
C. It allows random access by index
D. It always runs in constant time
ANSWER : B. It produces items lazily and uses far less memory
Generators yield one value at a time on demand instead of building the
whole list in memory.
8. Which built-in function returns an iterator that applies a function to
every item of an iterable?
A. filter
B. enumerate
C. map
D. zip
ANSWER : C. map
map(f, iterable) applies f to each element lazily; filter keeps elements, zip
pairs them, enumerate adds counters.
9. What is the result of dict(zip(['a', 'b'], [1, 2]))?
A. {'a': 1, 'b': 2}
B. {1: 'a', 2: 'b'}
C. {'a': 'b', 1: 2}
D. [('a', 1), ('b', 2)]
ANSWER : A. {'a': 1, 'b': 2}
zip pairs elements positionally and dict() turns each pair into a key-value
entry.
10. What is the average-case time complexity of testing membership (x
in s) for a Python set?
A. O(n log n)
B. O(log n)
C. O(n)
D. O(1)
ANSWER : D. O(1)
Sets are hash tables, so lookups take constant time on average, unlike the
linear scan needed for lists.
Page 3 of 53
, Big Data Analytics — Midterm 1
SECTION 2: PANDAS SERIES AND DATAFRAMES
11. Which description best fits a pandas Series?
A. An unlabeled NumPy array with no index
B. A two-dimensional table with rows and columns
C. A dictionary whose values must all be lists
D. A one-dimensional labeled array with an associated index
ANSWER : D. A one-dimensional labeled array with an associated
index
A Series holds one column of values together with index labels used for
alignment.
12. What does df.shape return?
A. The total number of cells in the DataFrame
B. The memory footprint of the DataFrame
C. A list of column data types
D. A tuple of (number of rows, number of columns)
ANSWER : D. A tuple of (number of rows, number of columns)
shape gives the dimensions as (rows, columns).
13. When pd.read_csv() is called without index_col, what index does the
resulting DataFrame receive?
A. No index at all
B. A default RangeIndex starting at 0
C. A DatetimeIndex
D. The first column of the file
ANSWER : B. A default RangeIndex starting at 0
Without index_col, pandas assigns a sequential integer RangeIndex.
14. Which method displays the first five rows of a DataFrame by
default?
A. df.head()
B. df.top()
C. df.first()
D. df.peek()
ANSWER : A. df.head()
head() returns the first n rows, where n defaults to 5.
Page 4 of 53