Cognitive Class IBM Python For Data Science Exam Answers 2020 - Cognitiveclass - PY0101EN Python For Data Science Exam Answers - Everything Trending
Cognitive Class IBM Python For Data Science Exam Answers 2020 - Cognitiveclass - PY0101EN Python For Data Science Exam Answers - Everything Trending
Review Question 1
1 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
3+2*2
10
7
9
12
Review Question 2
Lizz
L
Liz
Li
Review Question 3
0246
1357
1234567
8903
Review Question 4
‘2’
‘3’
’12’
3
2 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Review Question 5
Given myvar = ‘hello’, how would you convert myvar into uppercase?
len(myvar)
myvar.find(‘hello’)
myvar.upper()
myvar.sum()
Question 1
A=(‘a’,’b’,’c’)
A[1]
A[0] correct
A[:]
Question 2
After applying the following method,L.append([‘a’,’b’]), the following list will only be
one element longer.
True
False
Question 3
1
0, you can only have one unique element in a set
100
depends on the number of elements in your set.
Question 4
3 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Dict={“A”:1,”B”:”2″,”C”:[3,3,3],”D”:(4,4,4),’E’:5,’F’:6}
4
3
[3,3,3]
(4, 4, 4) correct
error
Question 5
Question 1
x=1
if(x!=1):
print(‘Hello’)
else:
print(‘Hi’)
print(‘Mike’)
4 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Hi Mike
Mike
Hello Mike
The Mike
Question 2
A=[‘1′,’2′,’3’]
for a in A:
print(2*a)
246
‘2’ ‘4’ ‘6’
’11’ ’22’ ’33’
ABC
Question 3
Consider the function Delta, when will the function return a value of 1
def Delta(x):
if x==0:
y=1;
else:
y=0;
return(y)
5 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Duplicate of ‘Question 3’
Consider the function Delta, when will the function return a value of 1
def Delta(x):
if x==0:
y=1;
else:
y=0;
return(y)
Question 4
What is the correct way to sort the list ‘B’ using a method, the result should not return a
new list, just change the list ‘B’.
B.sort()
sort(B)
sorted(B)
B.sorted()
Question 5
1,2
;,:
a,b
6 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Question 1
FileContent=file1.readlines()
print(FileContent)
Question 2
Question 3
7 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
Question 4
What is the result of applying the following method df.head(), to the dataframe df
Multiple Choice
a=np.array([0,1,0,1,0])
b=np.array([1,0,1,0,1])
a*b
0
array([1, 1, 1, 1, 1])
array([0, 0, 0, 0, 0])
Multiple Choice
a=np.array([0,1])
b=np.array([1,0])
np.dot(a,b)
8 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
1
array([1,1])
0
array([0,0])
Multiple Choice
a=np.array([1,1,1,1,1])
a+10
array([10,10,10,10,10])
array([11, 11, 11, 11, 11])
array([1,1,1,1,1])
Multiple Choice
what is the correct code to perform matrix multiplication on the matrix A and B
np.dot(A,B)
A*B
AxB
1)
3
12
9
7
2)
9 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
int
bool
str
list
3)
3.2
3
4
‘3.2’
4)
Consider the string A=’1234567′, what is the result of the following operation: A[1::2]
‘1234567’
‘246’
‘1357’
error
5)
Consider the string Name=”Michael Jackson” , what is the result of the following
operation Name.find(‘el’)
5
4
5,6
-1
6)
The variables A=’1′ and B=’2′ ,what is the result of the operation A+B?
10 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
3
‘3’
’12’
7)
Consider the variable F=”You are wrong”, Convert the values in the variable F to
uppercase?
F.up()
F.upper
F.upper()
8)
Consider the tuple tuple1=(“A”,”B”,”C” ), what is the result of the following operation
tuple1[-1]?
“A”
“B”
“C”
9)
Consider the tuple A=((11,12),[21,22]), that contains a tuple and list. What is the result
of the following operation A[1]:
((11,12),[21,22])
(11,12)
(21,22)
[21,22]
10)
Consider the tuple A=((11,12),[21,22]), that contains a tuple and list. What is the result
of the following operation A[0][1]:
11 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
12
11
22
21
11
‘1’,’2′,’3′,’4′
(‘1′,’2′,’3′,’4’)
[‘1′,’2′,’3′,’4’]
‘1234’
12
A+B
A-B
A*B
A/B
13
a.set()
a=A.append()
a=A.dict()
a=set(A)
14
{‘A’,’B’}
{‘A’,’B’,’C’}
{‘AC’,’BC’}
error
12 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
15
{‘A’,’B’}
{‘A’,’B’,’C’}
{‘A’,’B’,’C’,’C’}
error
16
x=”Go”
if(x!=”Go”):
print(‘Stop’)
else:
print(‘Go ‘)
print(‘Mike’)
Go Mike
Mike
Stop Mike
The Mike
17
x=”Go”
if(x==”Go”):
print(‘Go ‘)
13 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
else:
print(‘Stop’)
print(‘Mike’)
Go Mike
Mike
Stop Mike
The Mike
18
for n in range(3):
print(n)
1
2
3
4
19
for n in range(3):
print(n+1)
012
123
321
210
20
14 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
A=[‘1′,’2′,’3’]
for a in A:
print(2*a)
246
‘2’ ‘4’ ‘6’
’11’ ’22’ ’33’
ABC
21
Consider the function add, what is the result of calling the following Add(‘1′,’1’) (look
closely at the return statement )
def Add(x,y):
z=y+x
return(y)
error
‘2’
’11’
‘1’
22
class Points(object):
def __init__(self,x,y):
self.x=x
self.y=y
def print_point(self):
15 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
print(‘x=’,self.x,’y=’,self.y)
__init__
self.x self.y
print_point
23
class Points(object):
def __init__(self,x,y):
self.x=x
self.y=y
def print_point(self):
print(‘x=’,self.x,’ y=’,self.y)
p1=Points(1,2)
p1.print_point()
x=1
y=2
x=1 y=2
24
class Points(object):
def __init__(self,x,y):
self.x=x
16 of 17 8/11/2021, 8:11 AM
Cognitive Class IBM Python for Data Science Exam Answers 2020| Cogn... https://priyadogra.com/cognitive-class-python-for-data-science-exam-an...
self.y=y
def print_point(self):
print(‘x=’,self.x,’ y=’,self.y)
p2=Points(1,2)
p2.x=2
p2.print_point()
x=1
y=2
x=1 y=2
x=2 y=2
25
read
write
append
17 of 17 8/11/2021, 8:11 AM