Professional Documents
Culture Documents
P Wats New
P Wats New
for i in range(0,10,2.5):
print(i)
A. 0 2.5 5 7.5
B. 0 2 4 6 8
C. 0 2.5 5 7.5 10
D. Error.
17. Which of the following function gets a space-padded string with the original string
left-justified to a total of width columns?
A. join(seq)
B. len(string)
C. isupper()
D. ljust(width[,fillchar])
20. list1 = [11, 2, 23] and list2 = [2, 11, 23], list1 == list2 is______
A. True
B. False
C. Can't Say
D. None
21. Which of the following methods will the return the list of the all matches regarding
the given Regular Expression?
A. re.findall()
B. re.search()
C. re.subn()
D. None
24. Which of the following is the regular expression that validates the given input as a
number or not? (Number should be any real number)
A. r '[0-9]+(\.[0-9]+)?'
B. r '[0-9]+(\.[0-9])+?
C. r '[0-9]*(\.[0-9]+)?
D. None
27. Which of the following character is used to match any whitespace character?
A. \s
B. \S
c. \z
D. None
29. Which of the following expression 1s used to list all the student IDs of 'R14' batch in
the given file?
A. r '\b(R|r)14\d {4}\b'
B. r '(R|r)14\d{4}'
C. r '[R|r]14\d {1-3}'
D. r'^(R|r)14\d{4}$'
30. The character Dot (that is, '.') in the default mode, matches any character other
than________
A. newline
B. caret
C. percentage symbol
D. ampersand
31. Which of the method will be used to find the difference of days between two given
dates?
A. now()
B. strftime()
C. Strptime()
D. None
32. Which of the following will given current time of the system?
A. time.localtime()
B. datetime.today()
C. datetime.now()
D. All
33. Which of the following will print the second Saturday of a given month?
A. dt=datetime.strptime("%b %Y")
print((dt-timedelta(weeks=1, days=(dt.weekday()-
5)%7)).strftime("%b %d %Y"))
B. dt=datetime.strptime("%b %Y)
print((dt+timedelta(days=7+(5-dt.weekday())%7)).strftime("%b %d %Y"))
C. dt=datetime.strptime("%b %Y)
print((dt+timedelta(days=(5-dt.weekday())%7)).strftime("%b %d %Y"))
D. dt=datetime.strptime("%b %Y)
print((dt-timedelta(days=(dt.weekday()-5)%7)).strftime("%b %d %Y"))
A. 24-12-2016
B. Error
C. 2016-12-24
D. 2016-12-24
36. Which of the following converts the input string , say ip = 'Apr 2,2011 22.15" into
datetime object?
A. datetime.strptime(ip, '%b %d,%Y %I.%M)
37. Which of the following will print the date of last Friday?
A. dt=datetime.today()
print((dt - timedelta(days=(dt.weekday()-4)%7)).strftime("%b %d %Y"))
B. dt=datetime.today()
print((dt+ timedelta(days=(dt-weekday()-4)%7)).strftime("%b %d %Y"))
C. dt=datetime.today()
print((dt+ timedelta(days=(dt.weekday()+4)%7)).strftime("%b %d %Y"))
D. dt=datetime.today()
print((dt - timedelta(days=(dt.weekday()+4)%7)).strftime("%b %d %Y"))
38. Which of the statement will give you the day of week for the given date, 'd'?
A. d.strptime("%B")
B. d.weekday()
C. d.strftime("%b")
D. None
40.Which of the following can be used to get a day number in a week for given date, say
"d'
A. d.weekno()
B. d.dayno()
C. d.day()
D. None
A.8
B.1
C. 5
D.0
43. Which of the following counts the number of elements in Numpy array?
A. Size()
B. Array.ndim
C. Return()
D. Shape()
44. What is/are the advantage(s) of Numpy Arrays over classic python lists?
A. Insertion, Concatenation and deletion are faster
B. It has better support for mathematical operations
C. They consume less memory
D. All
45. Which of the following is the correct syntax for the 'reshape'function in Numpy array
python?
A. reshape(array,shape)
B. array .reshape(shape)
C. reshape(shape,array)
D. reshape(shape)
46. If you have a numpy array, in a variable 'rkv', how would you access the data item at
the 5th column, 2nd row?
A. rkv(1,5)
B. rkv[1,5]
C. rkv(2,4)
D. rkv[1,4]
51. Which of the following method may be used to handle the missing data?
A. fillna()
B. notnull()
C. All
D. isnull()
52. From the given assignment, what is the number of students that are included to
derive the cutoffs for the subject of 'Mathematics'?
A. 1107
B. 1096
C. 1098
D. 1097
53. What is the output of the following?
cities = {"London": 8615246, "Berlin": 3562166, "Madrid": 3165235, "Rome":
2874038,
"Paris": 2273305, "Vienna": 1805681, "Bucharest":1803425, "Hamburg":
1760433,
"Budapest": 1754000,"Warsaw": 1740119,"Barcelona":1602386, "Munich":
1493900, "Milan": 1350680}
my_cities = ["London", "Paris", "Zurich", "Berlin", "Stuttgart", "Hamburg"]
my_city_series = pd.Series(cities, index=my cities)
print(my_city_series)
A. London 8615246
Paris 2273305
Zurich 0
Bertin 3562166
Stuttgart 0
Hamburg 1760433
B. London 8615246
Paris 2273305 Berlin
3562166
Hamburg 1760433
C. London 8615246
Paris 227330S
Zurich NaN
Berlin 3562166
Stuttgart NaN
Hamburg 1760433
D. None
54. From the given assignment, which of the following subject has minimum average
Internal Marks(for 40)?
A. Mathematics
B. IT
C. Physics
D. Chemistry
55. Which of the following statements adds new column representing type 1/1 of player
to the dataframe given below?
my_fav =pd.DataFrame{ { 'Name' :
('Dada','Yuvi'','Sehwag','Hitman','Virat','Zaheer'),
'BattingAvg' : [42,38,41,48,59,12],
'Wickets' : [133,102,80,5,3,320] ))
def player_type(data):
if data['BattingAveg'')] > 30 and data['Wickets]>100:
return 'Allrounder'
elif data['BattingAvg') > 30 and data['Wickets]<100:
return 'Batsman'
else:
return 'Bowler
A. my_fav['PlayerType']=player_type(my_fav)
B. my_fav['PlayerType']=player_type.apply(my_fav)
C. my_fav['PlayerType']=my_fav.player_type()
D. my_fav['PlayerType']=my_fav.apply(player_type)
56. Which of the following method is used to combine a set of Series object (say
$1,S2,S3) to a dataframe?
A. pd.combine(S1,S2,S3)
B. pd.add(S1,S2,S3)
C. S1+S2+S3
D. None
57. Which of the following statement that modifies the given DataFrame by sorting with
reference to given column in descending order.
A. Df.sort_values(inplace=True)
C. Df.sort(ascending=False,inplace=True)
D. Df.sort_values(by= 'column_name')
A. None
B. cutoff['C']=max(60,min(50,marks.iloc[ceil(80*n/100)-1]))
C. cutoff['A']=min(80,min(70,marks.loc[ceil(25*n/100)-1)))
D. cutoff['EX']=min(90,max(80,marks.loc[ceil(5*n/100)-1)))
59. From the given assignment, which of the following subject has highest number of 'B'
grades?
A. Telugu
B. Mathematics
C. Chemistry
D. IT