IBM Applied AI to IBM AI Developer Professional Certificate β’ STUDY MODE
PRACTICE QUIZ
QUESTION 1 OF 85
What does API stand for?
A
Automatic Program Interaction
B
Application Programming Interaction
C
Application Process Interface
D
Application Programming InterfaceCorrect Answer
QUESTION 2 OF 85
Which data format is commonly found in the HTTP message for API requests?
A
JSONCorrect Answer
B
HTML
C
XML
D
YAML
QUESTION 3 OF 85
What is the primary purpose of an API?
PRACTICE QUIZ
A
To provide security to web applications.
B
To design user interfaces for mobile applications.
C
To connect and enable communication between software applications.Correct Answer
D
To handle server-side database operations.
QUESTION 4 OF 85
What is the function of "GET" in HTTP requests?
A
Sends data to create or update a resource
B
Carries the request to the client from the requestorCorrect Answer
C
Returns the response from the client to the requestor
D
Deletes a specific resource
QUESTION 5 OF 85
What does URL stand for?
A
Uniform Request Location
B
Uniform Resource LocatorCorrect Answer
C
Unilateral Resistance Locator
D
Uniform Resource Learning
QUESTION 6 OF 85
What does the file extension βcsvβ stand for?
A
Comma Separated ValuesCorrect Answer
B
Comma Separation Valuations
C
Common Separated Variables
D
Comma Serrated Values
QUESTION 7 OF 85
What is webscraping?
MODULE 5 GRADED QUIZ
A
The process to describe communication options
B
The process to display all data within a URL
C
The process to request and retrieve information from a client
D
The process to extract data from a particular websiteCorrect Answer
QUESTION 8 OF 85
What are the 3 parts to a response message?
A
HTTP headers, blank line, and bodyCorrect Answer
B
Encoding, body, and cache
C
Start or status line, header, and body
D
Bookmarks, history, and security
QUESTION 9 OF 85
What is the purpose of this line of code "table_row=table.find_all(name=βtrβ)" used in webscraping?
A
It will find all of the data within the table marked with a tag βpβ
B
It will find all of the data within the table marked with a tag βaβ
C
It will find all of the data within the table marked with a tag βh1β
D
It will find all of the data within the table marked with a tag βtrβCorrect Answer
QUESTION 10 OF 85
In what data structure do HTTP responses generally return?
A
JSONCorrect Answer
B
Lists
C
Nested Lists
D
Tuples
QUESTION 11 OF 85
The Python library we used to plot the chart in video/lab is
FINAL EXAM
A
MatPlotLibCorrect Answer
B
Plotly
C
PyCoinGecko
D
Pandas
QUESTION 12 OF 85
When slicing in Python what does the β0β in this statement [0:2] specify?
A
It specifies the step of the slicing
B
It specifies the position to start the sliceCorrect Answer
C
It specifies the position to end the slice
QUESTION 13 OF 85
If var = β01234567β what Python statement would print out only the odd elements?
A
print(var[2::2])
B
print(var[3::1])
C
print(var[1::2])Correct Answer
QUESTION 14 OF 85
Consider the string Name=βEMILYβ, what statement would return the index of 0?
A
Name.find("I")
B
Name.find("L")
C
Name.find("E")Correct Answer
QUESTION 15 OF 85
What is the type of the following: 1.0
A
int
B
str
C
floatCorrect Answer
QUESTION 16 OF 85
What will happen if you cast a float to an integer?
A
An error will occur
B
Nothing happens
C
It will remove decimal pointCorrect Answer
QUESTION 17 OF 85
When using the double slash β//β for integer division the result will be?
A
RoundedCorrect Answer
B
Not rounded
QUESTION 18 OF 85
In Python 3 what following code segment will produce a float?
A
2//3
B
1/2Correct Answer
QUESTION 19 OF 85
How many identical keys can a dictionary have?
A
0Correct Answer
B
3
C
100000000
QUESTION 20 OF 85
What will this code segment βA[0]β obtain from a list or tuple?
A
The third element of a list or tuple
B
The first element of a list or tupleCorrect Answer
C
The second element of a list or tuple
QUESTION 21 OF 85
What is the result of the following operation: '1:2,3:4'.split(':')?
A
['1', '2', '3', '4']
B
['1,2,3,4']
C
['1,2', '3,4']
D
['1', '2,3', '4']Correct Answer
QUESTION 22 OF 85
What is an important difference between lists and tuples?
A
Lists are mutable tuples are notCorrect Answer
B
Lists and tuples are the same
C
Tuples can only have integers
D
Lists can't contain a string
QUESTION 23 OF 85
What code segment is used to cast list βBβ to the set βbβ?
A
b.set()
B
b=set(B)Correct Answer
C
b=B.dict()
QUESTION 24 OF 85
If x=1 what will produce the below output?
Hi
Mike
print('Hi')
else:
print('Hello')
print('Mike')
print('Hello')
else:
print('Hi')
print('Mike') (CORRECT)
print('Hello')
else:
print('Hi')
print('Mike')
A
if(x!=1):
B
if(x!=1):
C
if(x==1):
QUESTION 25 OF 85
What is the process of forcing your program to output an error message when it encounters an issue?
A
Output errors
B
Force Out
C
Exception handlingCorrect Answer
D
Error messages
QUESTION 26 OF 85
What add function would return β2β ?
A
def add(x): return(x+x+x) add('1')
B
def add(x): return(x+x) add('1')
C
def add(x): return(x+x) add(1)Correct Answer
QUESTION 27 OF 85
What method organizes the elements in a given list in a specific descending or ascending order?
A
sort()Correct Answer
B
split()
C
replace()
D
join()
QUESTION 28 OF 85
What segment of code would output the following?
3
6
9
A
A=[1,2,3] for a in A: print(2*a)
B
A=['1','2','3'] for a in A: print(2*a)
C
A=[1,2,3] for a in A: print(3*a)Correct Answer
QUESTION 29 OF 85
What code segment would output the following?
1
3
4
A
for i in range(1,5): if (i!=1): print(i)
B
for i in range(1,5): if (i==2): print(i)
C
for i in range(1,5): if (i!=2): print(i)Correct Answer
QUESTION 30 OF 85
What is the method defined in the class Rectangle used to draw the rectangle?
class Rectangle(object):
def __init__(self,width=2,height =3,color='r'):
self.height=height
self.width=width
self.color=color
def drawRectangle(self):
import matplotlib.pyplot as plt
plt.gca().add_patch(plt.Rectangle((0, 0),self.width, self.height ,fc=self.color))
plt.axis('scaled')
plt.show()
A
drawRectangleCorrect Answer
B
class Rectangle
C
import matplotlib
QUESTION 31 OF 85
What is the result of the following lines of code?
a=np.array([0,1,0,1,0]) b=np.array([1,0,1,0,1]) a*b
A
array([0, 0, 0, 0, 0])Correct Answer
B
0
C
array([1, 1, 1, 1, 1])
QUESTION 32 OF 85
What is the result of the following lines of code?
a=np.array([1,1,1,1,1]) a+10
A
array([1,1,1,1,1])
B
array([10,10,10,10,10])
C
array([11, 11, 11, 11, 11])Correct Answer
QUESTION 33 OF 85
The following line of code selects the columns along with what headers from the dataframe df?
y=df[['Artist','Length','Genre']]
A
βArtistβ, βLengthβ and βGenreβCorrect Answer
B
This line of code does not select the headers
C
βArtistβ, βLengthβ and βyβ
QUESTION 34 OF 85
Consider the file object: File1.What would the following line of code output?
file1.readline(4)
A
It would output the entire text file
B
It would output the first 4 characters from the text fileCorrect Answer
C
It would output the first 4 lines from the text file
QUESTION 35 OF 85
What mode will write text at the end of the existing text in a file?
A
Append βaβCorrect Answer
B
Write βwβ
C
Read βrβ
QUESTION 36 OF 85
What is the extraction of data from a website?
A
Data mining
B
WebscrapingCorrect Answer
C
Web crawling
QUESTION 37 OF 85
When slicing in Python what does the β2β in this statement [0:2] specify?
A
It specifies the step of the slicing
B
It specifies the position to end the sliceCorrect Answer
C
It specifies the position to start the slice
QUESTION 38 OF 85
What is the result of the following code segment: int(3.99)
A
3.99
B
4
C
3Correct Answer
QUESTION 39 OF 85
What following code segment would produce an output of β0.5β?
A
1//2
B
1/2Correct Answer
QUESTION 40 OF 85
In Python 3 what does regular division always result in?
A
Int
B
FloatCorrect Answer
QUESTION 41 OF 85
A dictionary must have what type of keys?
A
Not changeable
B
Duplicate
C
UniqueCorrect Answer
QUESTION 42 OF 85
What is the syntax to obtain the first element of the tuple?
A=('a','b','c')
A
A[0]Correct Answer
B
A[1]
C
A[:]
QUESTION 43 OF 85
What line of code would produce this output: ['1','2','3','4']?
A
'1,2,3,4'.reverse(',')
B
'1,2,3,4'.split(',')Correct Answer
C
'1,2,3,4'.join(',')
D
'1,2,3,4'.split(':')
QUESTION 44 OF 85
What is a collection that is ordered, changeable and allows duplicate members?
A
ListCorrect Answer
B
Set
C
Dictionary
D
Tuple
QUESTION 45 OF 85
What happens with this segment of code: a=set(A) ?
A
It casts the list βAβ to the set βaβCorrect Answer
B
It casts the list βaβ to the set βAβ
C
It returns an error
QUESTION 46 OF 85
What value of x will produce the output?
Hi
Mike
x=
if(x!=1):
print('Hello')
else:
print('Hi')
print('Mike')
A
x=6
B
x="7"
C
x=1Correct Answer
QUESTION 47 OF 85
Given the function add shown below, what does the following return?
def add(x): return(x+x) add('1')
A
'11'Correct Answer
B
'2'
C
2
QUESTION 48 OF 85
What function returns a sorted list?
A
sort()
B
find()
C
lower()
D
sorted()Correct Answer
QUESTION 49 OF 85
What is the output of the following few lines of code?
A=['1','2','3'] for a in A: print(2*a)
4
6
22
33 (CORRECT)
A
error: cannot multiply a string by an integer
B
2
C
11
QUESTION 50 OF 85
What is the height of the rectangle in the class Rectangle?
class Rectangle(object):
def __init__(self,width=2,height =3,color='r'):
self.height=height
self.width=width
self.color=color
def drawRectangle(self):
import matplotlib.pyplot as plt
plt.gca().add_patch(plt.Rectangle((0, 0),self.width, self.height ,fc=self.color))
plt.axis('scaled')
plt.show()
A
0
B
3Correct Answer
C
2
QUESTION 51 OF 85
What is the result of the following lines of code?
a=np.array([0,1,0,1,0]) b=np.array([1,0,1,0,1]) a/b
A
array([0.1, 1.0, 0.1, 1.0, 0.1])
B
Division by zero errorCorrect Answer
C
array([1, 1, 1, 1, 1])
QUESTION 52 OF 85
What is the result of the following lines of code?
a=np.array([10,9,8,7,6]) a+1
A
array([11,10,9,8,7])Correct Answer
B
array([101,91,81,71,61])
C
array([9, 8, 7, 6, 5])
QUESTION 53 OF 85
How would you select the columns with the headers: Artist, Length and Genre from the dataframe df and assign them to the variable y ?
A
y=df[['Artist','Length','Genre']]Correct Answer
B
y=df[['Artist'],['Length'],['Genre']]
C
y=df['Artist','Length','Genre']
QUESTION 54 OF 85
In Python what statement would print out the first two elements βLiβ of βLizzβ?
A
print(name[0:2])Correct Answer
B
print(name[1:2])
C
print(name[2:0])
QUESTION 55 OF 85
If var = β01234567β what Python statement would print out only the even elements?
A
print(var[::2])Correct Answer
B
print(var[::1])
C
print(var[::3])
QUESTION 56 OF 85
Consider the string Name="ABCDE", what is the result of the following operation Name.find("B") ?
A
0
B
1Correct Answer
C
2
QUESTION 57 OF 85
In Python what can be either a positive or negative number but does not contain a decimal point?
A
intCorrect Answer
B
str
C
float
QUESTION 58 OF 85
What following code segment would return a 3?
A
float(3.99)
B
int(3.99)Correct Answer
C
str(3.99)
QUESTION 59 OF 85
What does the index of β1β correspond to in a list or tuple?
A
The first element
B
The second elementCorrect Answer
C
the third
QUESTION 60 OF 85
What is the result of the following operation: '1,2,3,4'.split(',') ?
A
'1','2','3','4'
B
('1','2','3','4')
C
'1234'
D
['1','2','3','4']Correct Answer
QUESTION 61 OF 85
How do you cast the list A to the set a?
A
a=set(A)Correct Answer
B
a=A.dict()
C
a.set()
QUESTION 62 OF 85
What value of x will produce the following output?
How are you?
x=
if(x!=1):
print('How are you?')
else:
print('Hi')
A
x=1
B
x=6Correct Answer
C
x="7"Correct Answer
QUESTION 63 OF 85
Why is the βfinallyβ statement used?
A
Only execute the remaining code if an error occurs
B
Execute the remaining code no matter the end resultCorrect Answer
C
Only execute the remaining code if one condition is false
D
Only execute the remaining code if no errors occur
QUESTION 64 OF 85
What code segment would output the following?
2
A
for i in range(1,5): if (i!=2): print(i)
B
for i in range(1,5): if (i!=1): print(i)
C
for i in range(1,5): if (i==2): print(i)Correct Answer
QUESTION 65 OF 85
What is the width of the rectangle in the class Rectangle?
class Rectangle(object):
def __init__(self,width=2,height =3,color='r'):
self.height=height
self.width=width
self.color=color
def drawRectangle(self):
import matplotlib.pyplot as plt
plt.gca().add_patch(plt.Rectangle((0, 0),self.width, self.height ,fc=self.color))
plt.axis('scaled')
plt.show()
A
3
B
2Correct Answer
C
0
QUESTION 66 OF 85
What line of code would produce the following: array([11, 11, 11, 11, 11])?
A
a=np.array([1,1,1,1,1]) a+10Correct Answer
B
a=np.array([1,2,1,1,1]) a+10
C
a=np.array([1,1,1,1,1]) 11-a
QUESTION 67 OF 85
What is the method readline() used for?
A
It reads 10 lines of a file at a time
B
It reads the entire file all at once
C
It helps to read one complete line from a given text fileCorrect Answer
QUESTION 68 OF 85
Which line of code is in the mode of append?
A
with open("Example.txt","w") as file1:
B
with open("Example.txt","r") as file1:
C
with open("Example.txt","a") as file1:Correct Answer
QUESTION 69 OF 85
What are the 3 parts to a URL?
A
Put, route, and get
B
Block, post, and route
C
Scheme, internet address, and routeCorrect Answer
D
Get, post, and scheme
QUESTION 70 OF 85
In Python, if you executed name = 'Lizz', what would be the output of print(name[0:2])?
A
Lizz
B
L
C
LiCorrect Answer
QUESTION 71 OF 85
Consider the string Name=βEMILYβ, what statement would return the index of 3?
A
Name.find("M")
B
Name.find("Y")
C
Name.find("L")Correct Answer
QUESTION 72 OF 85
What following code segment would produce an output of β0β?
A
1/2
B
1//2Correct Answer
QUESTION 73 OF 85
Lists are:
A
MutableCorrect Answer
B
Unordered
C
Not indexed
D
Not mutable
QUESTION 74 OF 85
What is a collection that is unordered, unindexed and does not allow duplicate members?
A
SetCorrect Answer
B
List
C
Tuple
QUESTION 75 OF 85
What is an error that occurs during the execution of code?
A
Finally
B
ExceptionCorrect Answer
C
Error messages
D
Exception handling
QUESTION 76 OF 85
What segment of code would output the following?
11
22
33
A
A=['1','2','3'] for a in A: print(2*a)Correct Answer
B
A=[1,2,3] for a in A: print(2*a)
C
A=['1','2','3'] for a in A: print(3*a)
QUESTION 77 OF 85
What is the result of the following lines of code?
a=np.array([0,1,0,1,0]) b=np.array([1,0,1,0,1]) a+b
A
array([0, 0, 0, 0, 0])
B
array([1, 1, 1, 1, 1])Correct Answer
C
0
QUESTION 78 OF 85
What mode over writes existing text in a file?
A
Write βwβCorrect Answer
B
Append βaβ
C
Read βrβ
QUESTION 79 OF 85
What is the correct way to sort list 'B' using a method? The result should not return a new list, just change the list 'B'.
A
sort(B)
B
B.sorted()
C
sorted(B)
D
B.sort()Correct Answer
QUESTION 80 OF 85
In Python what data type is used to represent text and not numbers?
A
strCorrect Answer
B
float
C
int
QUESTION 81 OF 85
In Python 3 what following code segment will produce an int?
A
2//3Correct Answer
B
1/2
QUESTION 82 OF 85
What will be the output if x=β7β?
if(x!=1):
print('Hi')
else:
print('Hello')
print('Mike')
Mike
Mike (CORRECT)
A
Hello
B
Mike
C
Hi
QUESTION 83 OF 85
What code segment would output the following?
2
3
4
A
for i in range(1,5): if (i!=2): print(i)
B
for i in range(1,5): if (i==2): print(i)
C
for i in range(1,5): if (i!=1): print(i)Correct Answer
QUESTION 84 OF 85
What is a two-dimensional data structure?
A
Pandas DataframeCorrect Answer
B
Numpy
C
Pandas Series
QUESTION 85 OF 85
What is scheme, internet address and route a part of?