Python For Data Science PART 3
Python For Data Science PART 3
Question 18:
What is the purpose of the 'split()' method for strings in Python?
A) Joins two strings together
B) Removes whitespace characters from the string
AM
C) Splits the string into a list of substrings based on a specified delimiter
D) Converts the string to lowercase
Question 19:
AY
SW
Which data structure in Python is used to store key-value pairs?
A) List
B) Tuple
C) Set
D) Dictionary
Y
Question 20:
@
A) To define a loop
B) To create a function
C) To handle exceptions and errors in code
D) To import external libraries
Page 1 MY SWAYAM
Python for Data Science IIT Kharagpur
Question 21:
What is the correct way to open a file in Python?
A) open(file_name, "r")
B) read(file_name, "open")
C) file.open(file_name)
D) file(file_name)
AM
Question 22:
What does the 'with' statement do when working with files in Python?
AY
A) It opens the file in write mode
B) It ensures proper acquisition and release of resources, like file handling,
during file operations
C) It converts the file to uppercase
SW
D) It reads the file content
Question 23:
What is the purpose of list comprehensions in Python?
M
A) To define a list
B) To iterate over a sequence and apply an operation to each element to
@
Page 2 MY SWAYAM
Python for Data Science IIT Kharagpur
Question 24:
Which statement is used to exit a loop prematurely in Python?
A) stop
B) exit
C) break
D) end
AM
Question 25:
What is the purpose of the 'map()' function in Python?
A) To create a dictionary
C) To sort a list
D) To concatenate strings
AY
B) To apply a function to all items in an input list and return an iterator
SW
Accepted Answer: B) To apply a function to all items in an input list and return
an iterator
Question 26:
Which keyword is used to define a function in Python that can accept a
Y
B) varargs
C) args
@
D) *args
Page 3 MY SWAYAM
Python for Data Science IIT Kharagpur
Question 27:
What does the 'lambda' keyword represent in Python?
A) A keyword to declare a variable
B) A keyword to declare a constant
C) A keyword to define an anonymous function (a function with no name)
D) A keyword to define a class
AM
Question 28:
What is the purpose of the 'filter()' function in Python?
A) To filter elements from a list based on a specified condition
AY
B) To filter out numbers from a string
C) To filter elements from a list based on their index
D) To filter characters from a string
SW
Question 29:
Y
Page 4 MY SWAYAM
Python for Data Science IIT Kharagpur
Question 30:
What is the purpose of the 'zip()' function in Python?
A) To compress files
B) To combine two or more lists element-wise into a list of tuples
C) To unzip files
D) To zip large data files
AM
Question 31:
What is the purpose of the 'enumerate()' function in Python?
A) To create a numbered list
AY
B) To iterate over a sequence and keep track of the index of the current item
C) To count the number of elements in a sequence
D) To remove duplicates from a list
SW
Accepted Answer: B) To iterate over a sequence and keep track of the index
of the current item
Question 32:
Y
Page 5 MY SWAYAM
Python for Data Science IIT Kharagpur
Subscribe for
PART 4
MY SWAYAM
AM
DESCRIPTION BOX OF THIS VIDEO.
HAPPY LEARNING
THANK YOU.
AY
SW
Y
M
@
Page 6 MY SWAYAM