Company: Infoedge
Difficulty: medium
Which of the following would reverse a string S in Python? S[::-1] S[:-1] S[-1:] S[-1:-] Given a list of lists a = [[1, 2, 3], [1, 4, 5, 6], [2, 8]] in Python, which of the following flattens 'a' such that b = [1, 2, 3, 1, 4, 5, 6, 2, 8]? b = [a2 for a1 in a for a2 in a1] b = [a1 for a2 in a for a1 in a2] b = [a1 for a1 in a for a2 in a1] b = [a2 for a1 in a for a1 in a2] How can we change the shape of a numpy array in Python? By shape() By reshape() By ord() By change() What is the runtime complexity of Python's inbuilt .append() method where n is the length of the list? O(n) O(n+1) O(1) O(logn) Which keyword is used to define a function in Python? Function func def defination If df is a Pandas dataframe in Python, would df.apply be a valid command? (Note: df['a'].apply is a valid command where df['a'] is a series). Yes, it is valid. No, it is invalid. Only for numeric columns. Only for string columns. Which of the below functions is commonly used to write a csv file from a Pandas dat