Python for Data Science, AI & Development Final
Python for Data Science, AI & Development Final
Which of the following code snippets correctly adds a new entry to an existing dictionary my_dict with
a key 'name' and a value 'John Doe'?
Feedback: Correct! This is the proper way to add a new key-value pair to a dictionary.
Feedback: Incorrect. The add() method does not exist for dictionaries in Python.
Feedback: No, the append() method is used for lists, not dictionaries.
Feedback: Incorrect. The insert() method does not exist for dictionaries in Python.
Which method would you use to remove an entry from a dictionary in Python?
*A: pop()
Feedback: Correct! The pop() method removes the specified key and returns the corresponding value.
B: remove()
Feedback: Not quite. The remove() method is used with lists, not dictionaries.
C: discard()
Feedback: Incorrect. The discard() method is used with sets, not dictionaries.
D: delete()
Feedback: No, the delete() method does not exist for dictionaries in Python. Consider the correct
dictionary methods.
Question 3 - checkbox, shuffle, partial credit, easy difficulty
Which of the following are valid ways to retrieve values from a dictionary in Python?
Feedback: Correct! The get() method retrieves the value for a given key.
Feedback: Correct! Square brackets can be used to retrieve a value for a given key.
Feedback: Incorrect. The key() method does not exist for dictionaries in Python.
Feedback: No, the items() method returns a view object that displays a list of dictionary's key-value
tuple pairs, but it's not used to retrieve values directly.
Which of the following correctly describes a difference between lists and tuples in Python?
Feedback: Correct! Lists can be modified after creation, but tuples cannot.
Feedback: Incorrect. It is the other way around; lists are mutable, and tuples are immutable.
C: Lists can store only homogeneous data types, whereas tuples can store heterogeneous data types.
Feedback: Incorrect. Both lists and tuples can store heterogeneous data types.
Feedback: Incorrect. Tuples generally consume less memory than lists because they are immutable.
Which of the following operations will change the elements of a list in Python?
*A: Mutation
B: Indexing
Feedback: Incorrect. Indexing allows you to access elements but does not change them.
C: Slicing
Feedback: Incorrect. Slicing creates a new list and does not change the original list.
D: Concatenation
Feedback: Incorrect. Concatenation creates a new list from two lists without altering the original lists.
Feedback: Correct! Sets in Python are mutable and unordered collections of unique elements.
Feedback: Incorrect. Sets in Python are mutable and unordered collections of unique elements.
Feedback: Incorrect. Sets cannot contain duplicate elements; each element is unique.
*A: union()
Feedback: Correct! The union() method returns a set that is the union of two sets.
B: intersection()
Feedback: Incorrect. The intersection() method returns the intersection of two sets, not the union.
C: difference()
Feedback: Incorrect. The difference() method returns a set containing elements that are in one set but not
in the other.
D: symmetric_difference()
Feedback: Incorrect. The symmetric_difference() method returns a set containing elements that are in
either set but not in their intersection.
A: List
Feedback: Incorrect. Lists in Python are mutable, meaning their contents can be changed.
B: Dictionary
Feedback: Incorrect. Dictionaries in Python are mutable, meaning their contents can be changed.
*C: Tuple
Feedback: Correct! Tuples are immutable, meaning their contents cannot be changed after they are
created.
D: Set
Feedback: Incorrect. Sets in Python are mutable, meaning their contents can be changed.
A: List
B: Tuple
C: Dictionary
Feedback: Incorrect. Dictionaries can have duplicate values but unique keys.
*D: Set
What will be the result of the following operation on a tuple in Python? python my_tuple = (1, 2, 3)
result = my_tuple + (4, 5)
*A: (1, 2, 3, 4, 5)
Feedback: Correct! Tuples support concatenation using the + operator, resulting in a new tuple.
Feedback: Incorrect. The + operator concatenates tuples, it does not nest them.
C: [1, 2, 3, 4, 5]
Feedback: Correct! Tuples are immutable, so you cannot append elements to them.
Feedback: Incorrect. You can access elements in a tuple using their index.
Feedback: Incorrect. You can check if an element exists in a tuple using the 'in' keyword.
Which of the following are valid methods to add or update an entry in a dictionary?
*A: update()
Feedback: Correct! The update method can add or update dictionary entries.
B: append()
Feedback: Incorrect. The append method is used for lists, not dictionaries.
C: assign()
What will the following code output? python my_dict = {'x': 10, 'y': 20, 'z': 30}
print(list(my_dict.keys()))
Feedback: Incorrect. These are the values, not the keys, of the dictionary.
Feedback: Incorrect. This is the dictionary itself, not the list of keys.
D: ['keys']
Feedback: Incorrect. The method keys returns all the keys in the dictionary.
What is the output of the following code snippet? python my_dict = {'a': 1, 'b': 2, 'c': 3}
print(my_dict.get('b'))
*A: 2
Feedback: Correct! The get method retrieves the value associated with the key 'b'.
B: 1
C: b'
Feedback: Incorrect. The value 'b' is the key, not the value.
D: None
A: append()
C: insert()
D: update()
Feedback: update() is used for adding multiple elements from another set or iterable.
Select all the data structures that allow duplicate elements in Python.
*A: List
B: Set
C: Dictionary
*D: Tuple
A: List
Feedback: Lists are mutable, meaning they can be modified after their creation.
B: Dictionary
Feedback: Dictionaries are mutable and allow changes to their key-value pairs.
*C: Tuple
Feedback: Correct! Tuples are immutable, meaning once they are created, they cannot be changed.
D: Set
*A: clear()
Feedback: Correct! The clear() method removes all elements from a set.
B: delete()
C: remove_all()
D: discard_all()
Feedback: Correct! The & operator is used to find the intersection of two sets.
B: The + operator
Feedback: Incorrect. The + operator is used for concatenation, not for finding the intersection of sets.
C: The * operator
Feedback: Incorrect. The * operator is used for multiplication, not for finding the intersection of sets.
D: The - operator
Feedback: Incorrect. The - operator is used for subtraction, not for finding the intersection of sets.
A: List
Feedback: Incorrect. Lists are mutable, meaning their contents can be changed.
*B: Tuple
Feedback: Correct! Tuples are immutable, meaning once they are created, their contents cannot be
modified.
C: Dictionary
Feedback: Incorrect. Dictionaries are mutable, which means you can change their contents.
D: Set
Feedback: Incorrect. Sets are mutable, which means you can add or remove elements.
Which of the following methods can be used to add an element to the end of a list in Python?
*A: append()
Feedback: Correct! The append() method adds an element to the end of a list.
B: insert()
Feedback: Incorrect. The insert() method adds an element at a specified position within the list, not at
the end.
C: extend()
Feedback: Incorrect. The extend() method adds elements from an iterable to the end of the list, but it
doesn't directly add a single element like append().
D: add()
Which of the following set operations in Python can be used to determine if two sets have any elements
in common?
*A: intersection()
Feedback: Correct! The intersection() method can be used to determine if two sets have any elements in
common.
B: union()
Feedback: Incorrect. The union() method is used to combine all elements from both sets, not to
determine if they have common elements.
C: difference()
Feedback: Incorrect. The difference() method is used to find elements present in one set but not in the
other.
D: symmetric_difference()
Feedback: Incorrect. The symmetric_difference() method is used to find elements present in either of the
sets but not in both.
Which of the following statements correctly retrieves all keys from a dictionary named student_info?
*A: student_info.keys()
Feedback: Great job! This is the correct way to retrieve all keys from a dictionary.
B: student_info.get_keys()
C: student_info.all_keys()
D: keys(student_info)
Feedback: Sorry, this is incorrect. The keys method should be called on the dictionary object itself.
Which of the following are valid operations that can be performed on a set in Python?
Feedback: Correct! You can add an element to a set using the add() method.
Feedback: Correct! You can remove an element from a set using the remove() method.
Feedback: Incorrect. Sets do not support accessing elements by index because they are unordered.
Feedback: Correct! You can find the intersection of two sets using the intersection() method.
Feedback: Incorrect. Sets do not support sorting because they are unordered.
Feedback: Correct! Lists are heterogeneous and can store elements of different types.
Feedback: Incorrect. Lists are mutable, meaning you can change their content.
Which of the following operations can be performed on both lists and tuples in Python?
*A: Indexing
*B: Slicing
*C: Concatenation
D: Mutation
E: Appending
Which of the following methods can be used to modify an entry in a dictionary in Python?
*A: update()
Feedback: Correct! The update() method can be used to modify an entry in a dictionary.
B: modify()
*C: setitem()
Feedback: Correct! The setitem() method can be used to modify an entry in a dictionary.
D: change()
E: alter()
*A: 4.0
Default Feedback: Incorrect. Remember that the length of a tuple is the number of elements it contains.
If set A = {1, 2, 3} and set B = {2, 3, 4}, how many elements are in the union of set A and set B?
*A: 4.0
Feedback: Correct! The union of set A and set B is {1, 2, 3, 4}, which contains 4 elements.
Default Feedback: Incorrect. Remember to count only unique elements when finding the union of two
sets.
*A: 0.0
If you have a list with elements ' [1, 2, 3, 4] ' and you perform the operation 'list [1:3] = [5, 6] ', what
will be the length of the new list?
*A: 4.0
Feedback: Correct! The new list will have 4 elements after the slicing operation.
Default Feedback: Incorrect. Try performing the slicing operation manually to see the change in length.
If a dictionary has 15 entries and you use the clear() method, how many entries will the dictionary have
afterwards?
*A: 0.0
Feedback: Correct! The clear() method removes all entries from the dictionary.
Default Feedback: Incorrect. The clear() method removes all entries from the dictionary, leaving it
empty.
*A: 5.0
Default Feedback: Incorrect. Be sure to subtract the number of deleted keys from the original number of
keys.
What keyword is used to delete an entry from a dictionary by its key? Please answer in all lowercase.
*A: del
B: delete
C: remove
Default Feedback: Incorrect. Review the methods to delete dictionary entries in Python.
What data structure in Python is defined using curly braces and is unordered? Please answer in all
lowercase.
*A: set
Feedback: Correct! A set is defined using curly braces and is an unordered collection of unique
elements.
Default Feedback: Incorrect. Review the data structures in Python and their properties.
*A: superset
Feedback: Correct! A superset is a set that contains all elements of another set.
B: super set
C: super-set
D: super_set
Default Feedback: Incorrect. Please review the properties and terminologies related to sets in Python.
What is the term used to describe an immutable sequence in Python? Please answer in all lowercase.
*A: tuple
*B: tuples
Default Feedback: Incorrect. Please review the characteristics of immutable sequences in Python.
What method is used to add an element to a set in Python? Please answer in all lowercase.
*A: add
Feedback: Correct! The add() method is used to add an element to a set in Python.
Default Feedback: Incorrect. Please review the methods available for set operations in Python.
What data structure would you use in Python to ensure unique elements? Please answer in all lowercase.
*A: set
Default Feedback: Revisit the course material on sets and their properties.
What is the term used to describe a mutable sequence in Python? Please answer in all lowercase. Please
answer in all lowercase.
*A: list
*B: lists
What is the term used for a collection of key-value pairs in Python? Please answer in all lowercase.
*A: dictionary
*B: dict
Default Feedback: Incorrect. In Python, a collection of key-value pairs is known as a dictionary or dict.
Question 42 - text match, easy difficulty
What is the term used to describe a mutable sequence in Python? Please answer in all lowercase. Please
answer in all lowercase.
*A: list
*B: lists
Feedback: Correct! 'Lists' is also a correct answer as it refers to the plural form of list which is a mutable
sequence.
Default Feedback: Incorrect. Please review the characteristics of mutable sequences in Python.
Which of the following data structures in Python allows duplicate elements and maintains their insertion
order?
*A: List
Feedback: Correct! Lists in Python allow duplicate elements and maintain their insertion order.
B: Set
Feedback: Incorrect. Sets in Python do not allow duplicate elements and do not maintain insertion order.
C: Dictionary
Feedback: Incorrect. Dictionaries in Python do not allow duplicate keys and their insertion order is
maintained only in Python 3.7 and later.
D: Tuple
Feedback: Incorrect. Tuples in Python allow duplicate elements but do not maintain insertion order.
*A: add()
Feedback: Correct! The add() method is used to add an element to a set in Python.
B: append()
Feedback: Incorrect. The append() method is used with lists, not sets. Try reviewing the methods
specific to sets.
C: insert()
Feedback: Incorrect. The insert() method is used with lists, not sets. Try reviewing the methods specific
to sets.
D: update()
Feedback: Incorrect. The update() method is used to add multiple elements from another set or iterable,
but not a single element. Try reviewing the methods specific to sets.
Which method would you use to add an element to the end of a list in Python?
*A: append()
Feedback: Correct! The append() method adds an element to the end of a list.
B: insert()
C: extend()
Feedback: Incorrect. The extend() method adds all elements of an iterable to the end of the list.
D: add()
*A: del
Feedback: Correct! The del statement can be used to remove a specific entry from a dictionary.
B: remove()
Feedback: Incorrect. The remove() method does not exist for dictionaries. It is used for lists.
*C: pop()
Feedback: Correct! The pop() method can be used to remove a specific entry from a dictionary and
return its value.
D: clear()
Feedback: Incorrect. The clear() method removes all entries from a dictionary, not a specific entry.
What method would you use to retrieve all the keys from a dictionary in Python?
*A: keys()
Feedback: Correct! The keys() method is used to retrieve all the keys from a dictionary.
B: values()
Feedback: Incorrect. The values() method retrieves all the values, not keys, from a dictionary.
C: items()
Feedback: Incorrect. The items() method retrieves all key-value pairs from a dictionary, not just the
keys.
D: get_keys()
Feedback: Incorrect. There is no method called get_keys() in Python. The correct method is keys().
*A: List
B: Tuple
*C: Dictionary
*D: Set
E: String
*A: Intersection
Feedback: Correct! Intersection is a valid set operation used to find common elements between sets.
*B: Union
Feedback: Correct! Union is a valid set operation used to combine elements from multiple sets.
C: Concatenation
Feedback: Incorrect. Concatenation is an operation used with strings and lists, not sets.
Feedback: Correct! Subset checking is used to determine if one set is a subset of another.
E: Indexing
Feedback: Incorrect. Indexing is used with lists and strings, not sets. Sets are unordered collections.
Which of the following statements about tuples and lists in Python are true?
*A: Tuples are immutable, meaning they cannot be changed after creation.
C: Tuples can have elements added to them using the append() method.
Feedback: Incorrect. Tuples do not support the append() method because they are immutable.
Feedback: Incorrect. Lists use square brackets, while tuples use parentheses for their syntax.
What is the term used to describe a collection of key-value pairs in Python? Please answer in all
lowercase.
*A: dictionary
*B: dict
Default Feedback: Incorrect. Please review the section on Python's data structures, specifically the part
about dictionaries.
Question 52 - checkbox, shuffle, partial credit, medium
Feedback: Correct! Exception handling is useful for managing scenarios where a file might not be
present.
Feedback: Incorrect. Basic arithmetic operations typically do not require exception handling unless they
involve risky operations like division by zero.
Feedback: Correct! Exception handling is crucial for managing database connectivity issues.
Feedback: Incorrect. Iterating over a list of a known size does not usually require exception handling.
Which of the following keywords is used to handle exceptions in most programming languages?
*A: try-catch
B: if-else
Feedback: Incorrect. The if-else statement is used for conditional branching, not for handling exceptions.
C: switch-case
Feedback: Incorrect. The switch-case statement is used for selecting among multiple options, not for
handling exceptions.
D: for-loop
Feedback: Incorrect. The for-loop is used for iterating over a sequence, not for handling exceptions.
Question 54 - multiple choice, shuffle, easy difficulty
Feedback: Correct! Exception handling is primarily used to manage runtime errors and maintain the
normal flow of the application.
Feedback: Incorrect. Exception handling is not concerned with restarting the application.
Feedback: Incorrect. Logging user activities is not the main purpose of exception handling.
Feedback: Incorrect. While exception handling can contribute to better performance, it's not the primary
goal.
Which of the following statements about the while loop in Python are true?
*A: A while loop will continue to execute as long as its condition is true.
Feedback: Correct! A while loop will execute repeatedly as long as its condition evaluates to true.
*B: A while loop can potentially run forever if its condition never becomes false.
Feedback: Correct! If the condition of a while loop never evaluates to false, the loop will run
indefinitely.
C: A while loop is used only when the number of iterations is known beforehand.
Feedback: Incorrect. A while loop is typically used when the number of iterations is not known
beforehand.
D: The body of a while loop is executed at least once, no matter the condition.
Feedback: Incorrect. The body of a while loop is only executed if the condition is true initially.
*A: 1 2 3 4
B: 1 2 3 4 5
C: 0 1 2 3 4
D: 2 3 4 5
B: function my_function()
C: define my_function():
Feedback: Incorrect. This is not the correct syntax for defining a function in Python.
D: func my_function()
Feedback: Incorrect. This is not the correct syntax for defining a function in Python.
Which of the following statements about variable scope in Python are true?
Feedback: Correct! Variables defined inside a function are indeed local to that function.
C: The global keyword is used to create a new global variable inside a function.
Feedback: Incorrect. The global keyword is used to refer to a global variable inside a function, not to
create a new one.
Feedback: Incorrect. Variables defined inside a function cannot be accessed outside the function.
Which of the following are valid ways to create a list in Python? Select all that apply.
Feedback: Correct! The list() constructor can be used to create a list from an iterable.
Which of the following methods can be used to add an element to the end of a list in Python?
A: add()
Feedback: The add() method is not used for lists. It's used for sets.
*B: append()
Feedback: Correct! The append() method adds an element to the end of a list.
C: insert()
Feedback: The insert() method can add an element at a specific position, not necessarily at the end.
D: extend()
Feedback: The extend() method is used to add elements from an iterable to the end of a list, not a single
element.
A: list
Feedback: Lists are mutable in Python, meaning their elements can be changed.
*B: tuple
Feedback: Correct! Tuples are immutable, meaning their elements cannot be changed after creation.
C: dictionary
D: set
*A: if x > 5:
Feedback: Correct! Remember, the if statement is followed by a condition and ends with a colon.
B: if (x > 5)
Feedback: Incorrect. This syntax is used in other programming languages like C but not in Python.
C: if x > 5 then
Feedback: Incorrect. Python does not use the 'then' keyword in if statements.
D: if x > 5 end
*A: len()
Feedback: Correct! The len() function is used to return the length of an object.
B: push()
Feedback: Incorrect. push() is not a built-in function in Python; it is used in other programming
languages like JavaScript.
C: append()
Feedback: Incorrect. append() is a method of list objects in Python, not a built-in function.
D: size()
*A: init
Feedback: Correct! The init method is used to initialize the attributes of a class in Python.
B: start
Feedback: Incorrect. The start method is not a standard method for initializing attributes in Python
classes.
C: create
Feedback: Incorrect. The create method does not exist in standard Python classes.
D: new
Feedback: Incorrect. The new method is used to create a new instance but not for initializing attributes.
*A: class
B: def
Feedback: Incorrect. The def keyword is used to define a function, not a class.
C: init
D: self
Feedback: Incorrect. The self keyword is used within a class to refer to the instance, not to define the
class itself.
Feedback: Correct! Methods defined within the class can be used as class attributes.
Feedback: Correct! Variables defined within the class can be used as class attributes.
C: Global variables
Feedback: Incorrect. Functions defined outside the class are not class attributes.
*A: When you need specific error handling for a unique application condition.
Feedback: Correct! Custom exceptions are useful for handling specific application conditions.
Feedback: Incorrect. Generic exception handling does not require custom exceptions.
Feedback: Correct! Custom exceptions help when built-in ones are insufficient.
B: catch Exception e
Feedback: Incorrect. This is not the correct syntax in Python. Review the Python exception handling
syntax.
Feedback: Incorrect. This syntax is used in Java, not Python. Ensure you are using Python syntax.
D: except Exception as e:
Feedback: Correct! The loop runs 3 times with i values 0, 1, and 2. When i is 2, it prints 'Two'. For other
values, it prints 'Not Two'.
Feedback: Incorrect. The loop executes from i = 0 to 2 sequentially, and the condition is checked each
time.
Feedback: Incorrect. Remember, the loop starts from i = 0 and increments by 1 each time until i = 2.
D: Two\nTwo\nTwo
Feedback: Incorrect. Only when i equals 2, the print statement 'Two' executes. For other values, it prints
'Not Two'.
Which of the following functions correctly generates a list of numbers starting from 0 up to but not
including 10 in Python?
B: range(1, 10)
C: range(10)
Feedback: Incorrect. This function generates numbers from 0 to 9 but does not explicitly show the start
value.
D: range(0, 9)
Select all the following statements that correctly describe the behavior of the while loop in Python.
*A: A while loop will continue executing as long as its condition is True.
Feedback: Correct! A while loop checks the condition before each iteration.
*B: A while loop can potentially create an infinite loop if its condition always remains True.
Feedback: Correct! Infinite loops can occur if the condition never becomes False.
C: A while loop will always execute its block of code at least once.
Feedback: Incorrect. A while loop may not execute at all if the condition is False initially.
D: A while loop doesn't need an increment or decrement statement to avoid infinite loops.
Feedback: Incorrect. It's important to include statements that modify the condition within the loop to
eventually terminate the loop.
What happens when you try to access a local variable outside the function in which it is defined?
Feedback: Correct! Local variables are only accessible within the function they are defined in.
Feedback: Incorrect. Local variables are not converted to global variables automatically.
Feedback: Incorrect. Local variables are not accessible outside their defining function.
Feedback: Incorrect. Python does not prompt you to define the variable globally.
A:
*B:
C:
if x > 5: print('x is greater than 5') else: print('x is 5') elif x <
5: print('x is less than 5')
Feedback: Incorrect. The elif block must come before the else block.
D:
Feedback: Incorrect. The comparison operator == should be used instead of the assignment operator =.
A: x is greater than y
Feedback: Revisit how comparison operations work in Python. In this case, x is not greater than y.
C: x is equal to y
Feedback: The code is syntactically correct and will run without errors.
A: x is greater than y
C: x is equal to y
Feedback: Incorrect. The else block only executes when both if and elif conditions are false.
Feedback: Incorrect. The code is syntactically correct and will produce an output.
Which of the following statements are true about defining a function in Python?
Feedback: Incorrect. A function in Python does not need to have a return statement.
Feedback: Incorrect. Function names in Python typically start with a lowercase letter, but it is not
required.
*A: 5.0
Feedback: Correct! The loop will execute 5 times, as it starts at 1 and increments by 2 until it reaches
less than 10.
Default Feedback: Incorrect. Revisit the concept of range and step in Python loops.
If a = 5 and b = 10, what is the result of the comparison a > b in Python (use 0 for False and 1 for True)?
*A: 0.0
Default Feedback: Revisit how comparison operations work in Python and what Boolean values they
produce.
*A: 7.0
Feedback: Correct! The expression evaluates to 7 due to the order of operations (multiplication before
addition).
Default Feedback: Revisit the order of operations in Python to correctly evaluate the expression.
*A: 9.0
Feedback: Correct! The last number printed by the code is 9 because range(3, 10) generates numbers
from 3 to 9.
Default Feedback: Incorrect. Please review the lesson on the range function in Python.
Question 81 - numeric, easy difficulty
Consider a scenario where an exception occurs approximately 3 times out of every 100 operations. What
is the probability of an exception occurring in any given operation? (Express your answer as a decimal)
*A: 0.03
Feedback: Correct! The probability is calculated as the number of exceptions divided by the total
number of operations.
Default Feedback: Incorrect. Remember to calculate the probability as the ratio of exceptions to the total
number of operations.
In Python, what is the keyword used to define a function? Please answer in all lowercase.
*A: def
B: function
Feedback: Incorrect. function is not a keyword in Python. Functions are defined using def .
C: func
Feedback: Incorrect. func is not a recognized keyword in Python. Use def to define a function.
D: define
Feedback: Incorrect. define is not a keyword in Python. The correct keyword is def.
Default Feedback: Incorrect. Please review the section on defining functions in Python.
What keyword is used to define a function in Python? Please answer in all lowercase.
*A: def
Feedback: Correct! The keyword to define a function in Python is def.
Default Feedback: Incorrect. Please review how functions are defined in Python.
What built-in Python function can be used to obtain a list of data attributes and methods associated with
a class? Please answer in all lowercase.
*A: dir
Feedback: Correct! The dir function can be used to obtain a list of data attributes and methods associated
with a class.
*B: __dir__
Feedback: Correct! The dir method can also be used to obtain a list of data attributes and methods
associated with a class.
Default Feedback: Incorrect. Review the Python built-in functions and methods to find out which one
provides a list of data attributes and methods associated with a class.
What is the keyword used in Python to start a loop that iterates over a sequence of elements? Please
answer in all lowercase.
*A: for
Feedback: Correct! The for keyword is used to start a loop that iterates over a sequence of elements.
What keyword is used to define a block of code that will always execute, regardless of whether an
exception was handled or not? Please answer in all lowercase.
*A: finally
Feedback: Correct! The finally block always executes, whether an exception is handled or not.
Default Feedback: Incorrect. Please review the lesson on exception handling blocks.
What is the keyword used to define a function in Python? Please answer in all lowercase.
*A: def
Default Feedback: The keyword used to define a function in Python is a reserved word that starts with
'd'.
What function is used to obtain a list of data attributes and methods associated with a class in Python?
Please answer in all lowercase.
*A: dir
Feedback: Correct! The dir function is used to obtain a list of data attributes and methods associated
with a class in Python.
Default Feedback: Incorrect. Please refer to the lesson on how to obtain a list of data attributes and
methods associated with a class in Python.
What keyword is used in Python to refer to a global variable inside a function? Please answer in all
lowercase.
*A: global
Feedback: Correct! The global keyword is used to refer to a global variable inside a function.
Default Feedback: Incorrect. Please refer to the lesson on variable scope and the global keyword for
more information.
Question 90 - numeric, medium
If a variable x is defined as a global variable with a value of 10, what will be the value of x after calling
the following function?\n\n python\n x = 10\n def change_x():\n global x\n x = 5\n change_x()\n
*A: 5.0
Default Feedback: Incorrect. Review the use of the global keyword in the function.
Which of the following methods is used to add an element to the end of a list in Python?
*A: append()
Feedback: Correct! The append() method is used to add an element to the end of a list in Python.
B: insert()
Feedback: Not quite. The insert() method is used to add an element at a specific position in the list, not
at the end.
C: add()
Feedback: Incorrect. The add() method does not exist for lists in Python. You might be thinking of the
append() method.
D: extend()
Feedback: Wrong choice. The extend() method is used to add multiple elements from another iterable to
the end of the list, but not a single element.
B: function my_method(self):
Feedback: Incorrect. In Python, functions within classes should be defined using the def keyword.
C: method my_method(self):
Feedback: Incorrect. The method keyword is not used to define methods in Python classes.
D: define my_method(self):
Feedback: Incorrect. The define keyword is not used in Python for any purpose.
*A: 45935
Feedback: Correct! Inside the function, x is a local variable, but outside the function, x remains 5.
B: 45787
Feedback: Incorrect. Remember that the x inside the function is a local variable and does not affect the
global x.
C: 45940
Feedback: Incorrect. The local variable x inside the function does not change the global x.
D: 45782
Feedback: Incorrect. The function foo() prints the local variable x, which is 10.
Which of the following statements about comparison operations in Python are true?
Feedback: Incorrect. The != operator checks for value inequality, not identity.
D: The > operator checks if the left operand is less than the right operand.
Feedback: Incorrect. The > operator checks if the left operand is greater than the right operand.
A: x is greater than y
C: x is equal to y
Feedback: Close, but not quite. Compare the values of x and y again.
D: No output
Feedback: No, there will be output. Make sure to review the branching statements.
*A: To manage runtime errors and maintain the normal flow of the application
Feedback: Correct! Exception handling is used to manage runtime errors and ensure the application can
continue its normal flow without crashing.
Feedback: Not quite. While performance is important, exception handling is primarily for managing
errors, not optimizing performance.
Feedback: Incorrect. Exception handling primarily deals with runtime errors and not directly with
security measures.
Feedback: That's not correct. Although good coding practices can improve maintenance and readability,
the main goal of exception handling is to manage errors at runtime.
Which of the following correctly demonstrates the use of the global keyword within a function in
Python?
*A:
Feedback: Correct! This is the proper use of the global keyword to define a global variable within a
function.
B:
Feedback: Incorrect. The global keyword must be used inside the function before the variable is
assigned.
C:
Feedback: Incorrect. The global keyword must be used inside the function, not outside of it.
D:
def my_function(): x = global 10
Feedback: Incorrect. This syntax is incorrect for using the global keyword.
Which of the following is the correct syntax for a for loop in Python that iterates over a range of
numbers from 0 to 4?
Feedback: Correct! Remember that the range function in Python generates numbers from 0 up to, but not
including, the specified end value.
Feedback: Incorrect. This syntax is typical of C-style languages, not Python. Review Python's for loop
syntax.
C: for i to 5:
Feedback: Incorrect. This is not a valid Python syntax. Check how to use the range function with for
loops in Python.
D: for i in 0..5:
Feedback: Incorrect. This range notation is not valid in Python. Make sure to review how the range
function works in Python.
Which of the following statements about variable scope in Python are correct?
Feedback: Correct! Variables defined inside a function are indeed local to that function.
*B: Variables defined outside a function are global and can be accessed anywhere in the code.
Feedback: Correct! Variables defined outside a function are global and can be accessed throughout the
code.
C: The global keyword allows the use of local variables inside a function.
Feedback: Incorrect. The global keyword allows the use of global variables inside a function, not local
variables.
*D: Variables defined with the global keyword inside a function are treated as global variables.
Feedback: Correct! The global keyword makes the variable global within the function.
E: Variables defined with the local keyword are local to the block they are defined in.
Feedback: Incorrect. Python does not have a local keyword; variables are local by default when defined
inside a function.
Select all the valid ways to use a while loop to print numbers from 1 to 5 in Python.
Feedback: Correct! This is a standard way of using a while loop to print numbers from 1 to 5 in Python.
Feedback: Incorrect. This syntax is a mix of Python and C-style syntax and will not work in Python.
Feedback: Incorrect. The variable i is not initialized in this code snippet, which will result in an error.
Feedback: Correct! The write method is used to write a string to a text file.
B: append
Feedback: Incorrect. The append method is not used for writing strings to a text file. Revisit the file
handling methods in Python.
C: insert
Feedback: Incorrect. The insert method is not used for writing strings to a text file. Make sure to review
Python's file handling functions.
D: add
Feedback: Incorrect. The add method is not used to write strings to a text file. Consider reviewing the
common file handling methods in Python.
*A: read_csv
Feedback: Correct! The read_csv function is used to read CSV files into DataFrame objects in Pandas.
B: readFile
Feedback: Incorrect. readFile is not a valid Pandas function for reading CSV files. Consider revisiting
the Pandas documentation.
C: import_csv
Feedback: Incorrect. import_csv is not a valid Pandas function. Make sure to review the common
Pandas functions for file operations.
D: load_csv
Feedback: Incorrect. load_csv is not a Pandas function. Try reviewing the Pandas file handling
functions.
A: import pandas
Feedback: This option is incorrect. Remember to use the correct alias when importing pandas.
Feedback: Correct! This is the standard way to import pandas with an alias for easier usage.
C: import pd as pandas
Feedback: This option is incorrect. The alias should be 'pd', not the library name.
D: import pandas pd
Feedback: This option is incorrect. Syntax is not correct for importing pandas with an alias.
Which of the following modes allows you to write to a file in Python without deleting its existing
content?
*A: a
Feedback: Correct! The 'a' mode appends data to the end of the file without deleting its existing content.
B: w
Feedback: Incorrect. The 'w' mode truncates the file to zero length or creates a new file for writing.
C: x
Feedback: Incorrect. The 'x' mode creates a new file and opens it for writing, but fails if the file already
exists.
D: r
Feedback: Incorrect. The 'r' mode opens the file for reading only.
*A: read()
Feedback: Correct! The read() method reads the entire content of a file.
B: readline()
Feedback: Incorrect. The readline() method reads one line from the file.
C: readlines()
Feedback: Incorrect. The readlines() method reads all the lines in a file and returns them as a list.
D: readall()
Feedback: Incorrect. There is no readall() method in Python for reading file content.
Which Numpy function is used to create evenly spaced numbers over a specified interval?
*A: linspace
Feedback: Correct! The linspace function is used to create evenly spaced numbers over a specified
interval.
B: arrange
Feedback: Incorrect. The arrange function is not used for generating evenly spaced numbers over a
specified interval.
C: split
Feedback: Incorrect. The split function does not create evenly spaced numbers.
D: range
Feedback: Incorrect. The range function is not specifically for creating evenly spaced numbers over an
interval.
A: Matrix multiplication
B: Scalar multiplication
C: Element-wise product
Feedback: Correct! Matrix inversion is not considered a basic operation on 2D Numpy arrays.
To import the pandas library in Python, which of the following statements is correct?
Feedback: Correct! import pandas as pd is the standard way to import the pandas library.
B: import pandas
Feedback: Incorrect. While import pandas works, it is conventional to use import pandas as pd to
simplify references to the library.
Feedback: Incorrect. The correct statement is import pandas as pd. import pandas library is not valid.
Feedback: Incorrect. The correct statement is import pandas as pd. import pd from pandas is not valid.
*A: read_csv
Feedback: Correct! The read_csv function is used to load a CSV file into a DataFrame.
B: load_csv
Feedback: Incorrect. There is no load_csv function in pandas. The correct function is read_csv.
C: import_csv
Feedback: Incorrect. The correct function is read_csv. import_csv is not a valid pandas function.
D: csv_read
Feedback: Incorrect. csv_read is not a valid pandas function. The correct function is read_csv.
Which of the following methods can be used to filter rows in a pandas DataFrame based on a condition?
Select all that apply.
*A: query()
Feedback: Correct! The query() method is one way to filter rows in a DataFrame based on a condition.
B: filter_rows()
Feedback: Incorrect. There is no filter_rows() method in pandas. Consider revisiting the pandas
documentation to find the correct method.
*C: loc []
Feedback: Correct! The loc [] indexer can be used to filter rows based on a condition.
D: select_rows()
Feedback: Incorrect. There is no select_rows() method in pandas. The correct methods include query()
and loc [] .
Feedback: Correct! This command creates a 2D array with shape (2, 3).
B: numpy.array( [1, 2, 3, 4, 5, 6] )
Feedback: Incorrect. This command creates a 2D array with shape (3, 2).
Which of the following functions in Numpy can be used to generate evenly spaced numbers over a
specified interval?
*A: linspace
Feedback: Correct! The linspace function generates evenly spaced numbers over a specified interval.
B: arange
Feedback: Incorrect. The arange function generates numbers in a given range but it may not be evenly
spaced depending on the step size.
C: logspace
Feedback: Incorrect. The logspace function generates numbers spaced evenly on a log scale.
D: geomspace
Feedback: Incorrect. The geomspace function generates numbers spaced evenly on a geometric
progression.
*A: np.std()
Feedback: Correct! np.std() is used to compute the standard deviation of an array in NumPy.
B: np.var()
Feedback: Incorrect. np.var() is used to compute the variance, not the standard deviation.
C: np.mean()
Feedback: Incorrect. np.mean() is used to compute the mean, not the standard deviation.
D: np.median()
Feedback: Incorrect. np.median() is used to compute the median, not the standard deviation.
*A: close()
B: terminate()
C: end()
D: finish()
Feedback: Correct! The read() method reads the entire content of a file.
B: readline()
Feedback: Not quite. The readline() method reads one line from the file at a time.
C: readlines()
Feedback: Incorrect. The readlines() method returns a list of lines from the file.
D: file()
Feedback: No, file() is not a valid method for reading file content in Python.
How would you use the linspace function from NumPy to generate 10 evenly spaced numbers between 0
and 1?
Feedback: Correct! The linspace function generates numbers evenly spaced over a specified interval.
B: numpy.linspace(0, 1, 9)
C: numpy.arange(0, 1, 10)
Feedback: Incorrect. The arange function generates values based on a step size, not a specified number
of values.
D: numpy.linspace(0, 10, 1)
What are some functions provided by pandas to work with Excel files? Select all that apply.
*A: pd.read_excel()
Feedback: Correct! pd.read_excel() is used to read data from an Excel file into a DataFrame.
*B: pd.to_excel()
Feedback: Correct! pd.to_excel() is used to write data from a DataFrame to an Excel file.
C: pd.open_excel()
Feedback: Incorrect. pd.open_excel() is not a valid pandas function to work with Excel files.
D: pd.load_excel()
Feedback: Incorrect. pd.load_excel() is not a valid pandas function to work with Excel files.
Which pandas function is used to load data from a CSV file into a DataFrame?
*A: pd.read_csv()
Feedback: Correct! The pd.read_csv() function is used to read data from a CSV file into a DataFrame.
B: pd.read_table()
Feedback: Incorrect. pd.read_table() is used to read general delimited files, not specifically CSV files.
C: pd.load_csv()
Feedback: Incorrect. pd.load_csv() is not a valid pandas function for reading CSV files into a
DataFrame.
D: pd.load_table()
Feedback: Incorrect. pd.load_table() is not a valid pandas function for reading CSV files into a
DataFrame.
Which of the following methods is used to read the entire content of a text file in Python?
*A: read()
Feedback: Correct! The read() method reads the entire content of the file as a string.
B: readline()
Feedback: Not quite. The readline() method reads one line from the file at a time, not the entire content.
C: readlines()
Feedback: Incorrect. The readlines() method reads all lines in a file and returns them as a list of strings,
but it does not read the entire file content as a single string.
D: file()
Feedback: No, the file() function is not used to read the content of a file. It is used to create a new file
object.
*A: concat()
Feedback: Correct! The concat() function is used to concatenate two DataFrames along a particular axis.
B: merge()
Feedback: Not quite. The merge() function is used to combine DataFrames based on keys or columns.
C: join()
D: combine()
Feedback: No, the combine() function is used for element-wise operations with DataFrames.
Which of the following are methods to read data from a CSV file using pandas?
*A: pd.read_csv()
Feedback: Correct! pd.read_csv() is the primary method for reading CSV files into a DataFrame.
B: pd.load_csv()
Feedback: Incorrect. pd.load_csv() is not a valid method in pandas for reading CSV files.
*C: pd.read_table()
Feedback: Correct! pd.read_table() can also be used to read CSV files if you specify the delimiter.
D: pd.load_table()
E: pd.read_excel()
Feedback: Incorrect. pd.read_excel() is used for reading Excel files, not CSV files.
Which of the following are methods to read data from a file in Python?
*A: read()
*B: readline()
Feedback: Correct! readline() is a method to read a single line from a file in Python.
C: write()
Feedback: Incorrect. write() is a method to write data to a file, not read from it.
*D: readlines()
Feedback: Correct! readlines() is a method to read all lines from a file in Python.
E: append()
Feedback: Incorrect. append() is not a method to read data from a file. It is used to add elements to a list.
Question 123 - numeric, easy difficulty
You have a DataFrame with a column named 'age'. What is the range of unique ages if the minimum age
is 21 and the maximum age is 65?
*A: 44.0
Default Feedback: Incorrect. Ensure you calculate the range correctly, considering both the minimum
and maximum values.
You have a NumPy array \[ a = np.array([[1, 2], [3, 4]]) \]. What is the sum of all elements in the array?
*A: 10.0
Feedback: Correct! The sum of all elements in the array is indeed 10.
Default Feedback: That's not correct. Remember to sum all the elements in the array.
If you have a NumPy array a = np.array( [1, 2, 3, 4, 5] ), what is the mean of the array?
*A: 3.0
Default Feedback: Incorrect. Please review the methods to calculate the mean of a NumPy array.
If you open a file in write mode and write data to it, what will be the size of the file if you write 50 bytes
of data to it?
*A: 50.0
Feedback: Correct! Writing 50 bytes of data to a file will result in a file size of 50 bytes.
Default Feedback: Incorrect. The size of the file will be equivalent to the amount of data written to it.
If a file contains 100 lines and you use the readline() method once, how many lines will be left to read?
*A: 99.0
Feedback: Correct! Using readline() once will read one line, leaving 99 lines.
Default Feedback: Incorrect. Remember that the readline() method reads one line at a time.
If you have a NumPy array \[ a = np.array([1, 2, 3, 4, 5, 6]) \], what is the sum of the array?
*A: 21.0
Default Feedback: Incorrect. Please check your calculation and try again.
If you use the linspace function to create 5 evenly spaced numbers between 0 and 10, what will be the
second number in the resulting array?
*A: 2.5
Default Feedback: Incorrect. Please revisit the concept of using linspace to generate evenly spaced
numbers.
*A: unique
Feedback: Correct! The unique method is used to find unique elements in a column of a DataFrame.
*B: unique()
Feedback: Correct! The unique method is used to find unique elements in a column of a DataFrame.
C: pd.unique
D: pd.unique()
Default Feedback: Incorrect. Remember to use the method that specifically finds unique elements in a
DataFrame column.
Which pandas method would you use to find unique elements in a column of a DataFrame? Please
answer in all lowercase.
*A: unique
Feedback: Correct! The unique() method is used to find unique elements in a DataFrame column.
*B: unique()
Feedback: Correct! The unique() method is used to find unique elements in a DataFrame column.
Default Feedback: Incorrect. Please review the pandas documentation on finding unique elements in a
DataFrame column.
What method is used to remove duplicate rows from a DataFrame in Pandas? Please answer in all
lowercase.
*A: drop_duplicates
Feedback: Correct! The drop_duplicates method is used to remove duplicate rows from a DataFrame.
*B: dropduplicates
Feedback: Correct! The dropduplicates method is used to remove duplicate rows from a DataFrame.
Default Feedback: Incorrect. Please review the methods available in Pandas for DataFrame
manipulation.
What is the Numpy function used to create a 2D array? Please answer in all lowercase.
*A: array
Default Feedback: Incorrect. Please review the Numpy functions for creating arrays.
What function in NumPy is used to create an array? Please answer in all lowercase.
*A: array
Default Feedback: Incorrect. Please review the NumPy functions for creating arrays.
What function in Numpy would you use to create a 2D array? Please answer in all lowercase.
*A: array
*B: numpy.array
Feedback: Correct! The numpy.array function is used to create arrays in Numpy.
Default Feedback: Incorrect. Review Numpy functions used for creating arrays.
What function in Python is used to write data to a file? Please answer in all lowercase.
*A: write
*B: writelines
Feedback: Correct! The writelines() function can also be used to write a list of lines to a file.
Default Feedback: Incorrect. Review how to use the write() function to write data to a file.
If you use linspace to generate 10 numbers between 0 and 1, what is the step size?
*A: 0.1111111111
Feedback: Correct! The step size is approximately 0.1111 when dividing the interval [0, 1] into 10
evenly spaced points.
Default Feedback: Incorrect. Remember to divide the interval by the number of steps minus one.
After filtering data in a DataFrame based on a condition, you find that the resulting DataFrame has 42
rows. How many rows did the original DataFrame likely have if 30 rows met the filtering condition?
*A: 72.0
Feedback: Correct! If 30 rows met the filtering condition, adding the 42 rows that did not meet the
condition gives the original DataFrame's total rows.
Default Feedback: Incorrect. Consider the number of rows that met the condition and the total number of
rows after filtering.
Which of the following methods can be used to read a CSV file into a Pandas DataFrame?
*A: pd.read_csv()
Feedback: Correct! The pd.read_csv() method is used to read a CSV file into a Pandas DataFrame.
B: pd.load_csv()
Feedback: Incorrect. The pd.load_csv() method does not exist in Pandas for reading CSV files.
C: pd.import_csv()
D: pd.open_csv()
Feedback: Incorrect. The pd.open_csv() method does not exist in Pandas for reading CSV files.
Which method is used to read the content of a file in Python as a list of lines?
*A: readlines()
Feedback: Correct! The readlines() method is used to read the content of a file as a list of lines.
B: read()
Feedback: Incorrect. The read() method reads the entire content of the file as a single string.
C: readline()
Feedback: Incorrect. The readline() method reads only one line from the file.
D: lines()
Feedback: Incorrect. There is no lines() method in Python for reading file content.
Question 141 - multiple choice, shuffle, easy difficulty
Which of the following functions is used to generate evenly spaced numbers over a specified interval in
Numpy?
*A: linspace
Feedback: Correct! The linspace function in Numpy is used to generate evenly spaced numbers over a
specified interval.
B: arange
Feedback: Incorrect. The arange function generates values within a given interval with a specified step
size, not necessarily evenly spaced.
C: logspace
Feedback: Incorrect. The logspace function generates numbers spaced evenly on a log scale.
D: geomspace
Feedback: Incorrect. The geomspace function generates numbers spaced evenly on a geometric
progression.
Which function from the pandas library is used to load a CSV file into a DataFrame?
*A: read_csv
Feedback: Correct! The read_csv function is used to load a CSV file into a DataFrame.
B: load_csv
Feedback: Incorrect. The load_csv function does not exist in the pandas library. Try looking into the
documentation again.
C: import_csv
Feedback: Incorrect. The import_csv function does not exist in the pandas library. Try looking into the
documentation again.
D: get_csv
Feedback: Incorrect. The get_csv function does not exist in the pandas library. Try looking into the
documentation again.
*A: Indexing
Feedback: Correct! Indexing allows you to access individual elements within the array.
B: Matrix multiplication
*C: Slicing
E: Eigenvalue decomposition
Which of the following methods can be used to filter data in a pandas DataFrame based on a condition?
*A: loc
Feedback: Correct! The loc method can be used to filter data in a pandas DataFrame based on a
condition.
B: iloc
Feedback: Incorrect. The iloc method is used for integer-location based indexing, not for filtering based
on a condition.
*C: query
Feedback: Correct! The query method can be used to filter data in a pandas DataFrame based on a
condition.
*D: where
Feedback: Correct! The where method can be used to filter data in a pandas DataFrame based on a
condition.
E: filter_by
Feedback: Incorrect. The filter_by method does not exist in the pandas library.
What function is used to find unique elements in a column of a DataFrame? Please answer in all
lowercase.
*A: unique
Feedback: Correct! The unique function is used to find unique elements in a column of a DataFrame.
Default Feedback: Incorrect. Review the pandas documentation to find the correct function for this task.
What is the mode used to open a file for writing in Python? Please answer in all lowercase.
*A: w
B: write
Feedback: Incorrect. The correct mode for opening a file for writing is w.
C: a
Feedback: Incorrect. The a mode is used for appending to a file, not writing.
Default Feedback: Incorrect. Please review the modes available for the open function in Python.
Question 147 - multiple choice, shuffle, easy difficulty
Which of the following methods can be used to convert a string to uppercase in Python?
*A: upper()
Feedback: Correct! upper() is the method used to convert a string to uppercase in Python.
B: capitalize()
Feedback: Incorrect. capitalize() converts the first character to uppercase and the rest to lowercase.
C: title()
Feedback: Incorrect. title() converts the first character of each word to uppercase.
D: swapcase()
Feedback: Incorrect. swapcase() converts uppercase characters to lowercase and vice versa.
Given the string s = 'python programming', which of the following will return the index of the first
occurrence of 'o'?
*A: s.find('o')
Feedback: Correct! s.find('o') returns the index of the first occurrence of 'o'.
B: s.index('o')
Feedback: Incorrect. Although s.index('o') also returns the index, it is not the first occurrence in this
context.
C: s.search('o')
D: s.locate('o')
Feedback: Correct! This course covers the module on Data Science with Python.
Feedback: Incorrect. This course does not cover Web Development with JavaScript.
Feedback: Incorrect. This course does not cover Machine Learning with R.
Feedback: Incorrect. This course does not cover Mobile App Development with Swift.
Which of the following is a fundamental reason for learning Python in the field of Data Science and AI?
*A: Python has a simple syntax, making it easy to learn and use.
Feedback: Correct! Python's simple syntax is one of the key reasons it is popular in Data Science and
AI.
Feedback: Incorrect. While Python is widely used, it is not the only programming language employed in
Data Science.
Feedback: Incorrect. Python is a general-purpose programming language, although it has many libraries
for statistical analysis.
Select all the valid ways to increment the value of variable x in Python by 1.
*A: x += 1
Feedback: Correct! This is the shorthand operator for incrementing the value of x by 1.
*B: x = x + 1
C: x++
Feedback: Incorrect. The x++ syntax is not valid in Python; it is used in languages like C++ and Java.
D: x =+ 1
Feedback: Incorrect. This is not a valid syntax for incrementing a variable in Python.
*A: x = 5
Feedback: Correct! In Python, you can declare a variable using the equals sign =.
B: int x = 5
Feedback: Incorrect. This is the syntax used in languages like Java or C++, but not in Python.
C: declare x = 5
D: let x = 5
A: 3 + 4 * 2
B: (3 + 4) * 2
C: 3 ** 2 / 2
*D: 3 // (2 + )
Feedback: Correct! Pressing Esc and then D twice will delete the cell.
Feedback: Incorrect. The 'del' command is used within a cell to delete variables, not the cell itself.
Which of the following best describes the role of Jupyter in data science?
Feedback: This is not correct. While Jupyter can be used in web development, its primary role in data
science is different.
Feedback: Correct! Jupyter is widely used for interactive computing and data visualization in data
science.
Feedback: Not quite. While Jupyter provides an environment for coding in Python, it is not classified as
an IDE.
*A: 10
B: 10.5
C: 10'
D: true
Which of the following operations would you use to retrieve the third character from a string s in
Python?
A: s [3]
*B: s [2]
Feedback: Correct! Python uses zero-based indexing, so the third character is at index 2.
C: s [1]
D: s.charAt(3)
A: integer
Feedback: Integers are used to store whole numbers, but not Boolean values.
B: float
Feedback: Floats are used to store decimal numbers, not Boolean values.
*C: boolean
Feedback: Correct! Boolean data type can hold the value True or False.
D: string
Feedback: Strings are used to store sequences of characters, not Boolean values.
A: List
Feedback: A list in Python is mutable, which means its contents can be changed.
B: Dictionary
Feedback: A dictionary in Python is mutable, meaning you can change its contents.
C: Set
Feedback: A set in Python is mutable; you can add or remove elements from it.
*D: Tuple
Feedback: Correct! A tuple is immutable, meaning its contents cannot be altered after creation.
Feedback: Incorrect. This is not the correct syntax for declaring a variable in Python. Remember that
Python is dynamically typed.
*B: num = 5
Feedback: Correct! In Python, you can directly assign a value to a variable without specifying its type.
C: declare num = 5
D: var num = 5
Feedback: Incorrect. Python does not use the var keyword for variable declaration.
Feedback: Correct! Python's extensive libraries and active community support make it an excellent
choice for data science.
Feedback: Incorrect. Python is known for its strong data visualization capabilities through libraries like
Matplotlib and Seaborn.
C: Complex syntax
Feedback: Incorrect. Python is praised for its simple and readable syntax.
Feedback: Incorrect. Python integrates well with various tools and libraries, particularly in data science.
Which of the following operations can be used to extract a substring from a given string in Python?
A: Indexing
B: Concatenation
Feedback: Concatenation is used to join two strings together, not to extract a substring.
*C: Slicing
Feedback: Correct! Slicing is used to extract a substring from a given string in Python.
D: Formatting
Feedback: Formatting is used to format strings according to specific rules, not to extract a substring.
Select all the correct methods to find substrings within a string in Python.
*A: find()
Feedback: Correct! find() returns the lowest index of the substring if it is found in the string.
*B: index()
Feedback: Correct! index() is similar to find() but raises an exception if the substring is not found.
C: search()
Feedback: Incorrect. Python does not have a search() method for strings.
D: contains()
Feedback: Incorrect. Python does not have a contains() method for strings.
E: match()
Feedback: Incorrect. match() is not a string method for finding substrings in Python.
*B: Lists
*C: Branching
E: Blockchain
Feedback: Incorrect. Blockchain is not a primary concept in Python programming for these fields.
F: Quantum computing
Feedback: Incorrect. Quantum computing is not directly related to Python programming in the context
of this course.
Select all the data types that are considered mutable in Python.
*A: List
B: String
*C: Dictionary
E: Float
Feedback: No, concat() is not a built-in method for strings in Python. It's used in other languages like
Java.
Feedback: Correct! The join() method can be used to concatenate strings in Python.
Which of the following are common control flow structures used in Python programming?
*A: Loops
Feedback: Correct! Loops are a key control flow structure used to repeat actions until a condition is met.
*B: Branching
Feedback: Correct! Branching, such as using if-else statements, allows for decision-making in code.
C: Functions
Feedback: Incorrect. Functions are used for code modularity and reuse, but they are not control flow
structures.
Feedback: Correct! Exception handling is used to manage errors and exceptions in code flow.
E: Variables
Feedback: Incorrect. Variables store data values but do not control the flow of a program.
F: File Handling
Feedback: Incorrect. File handling deals with input and output operations on files and is not considered a
control flow structure.
Feedback: Correct! Data scientists are among the primary users of Python due to its powerful libraries
and tools for data analysis.
Feedback: Correct! Web developers use Python for its frameworks like Django and Flask.
C: Graphic designers
Feedback: Incorrect. While graphic designers might use other tools, Python is not commonly used in
graphic design.
Feedback: Correct! Machine learning engineers rely on Python for libraries like TensorFlow and Scikit-
learn.
E: Database administrators
Feedback: Incorrect. Although Python can be used for database management, it is not the primary tool
for database administrators.
Select all the data types that can be typecast to a string in Python:
*A: Integer
*B: Float
*C: Boolean
D: List
E: Dictionary
*A: 11.0
Default Feedback: Remember to count all characters in the string, including spaces.
Feedback: Correct! The // operator in Python is used for floor division, which returns the largest whole
number less than or equal to the division.
If you have a string s = 'hello', what is the index of 'e' in the string?
*A: 1.0
Default Feedback: Incorrect. Remember that string indices in Python start from 0.
If you have a float value of 10.75 and you typecast it to an integer, what will be the result?
*A: 10.0
Default Feedback: Incorrect. Please review how typecasting from float to integer works in Python.
What is the Python data type for floating-point numbers? Please answer in all lowercase.
*A: float
Default Feedback: Review the common data types in Python and try again.
*A: notebooks
*B: interactivity
*C: integration
Default Feedback: Incorrect. Please review the key features of Jupyter for interactive computing.
What is the result of typecasting the boolean value True to an integer in Python? Please answer in all
lowercase.
*A: 1
Feedback: Correct! In Python, the boolean value True is typecast to the integer 1.
Default Feedback: Incorrect. Review the typecasting rules for booleans in Python.
What is the primary interface used to run, insert, and delete cells in a Jupyter notebook? Please answer
in all lowercase.
*A: notebook
Feedback: Correct! The primary interface for these actions in Jupyter is the notebook.
*B: jupyter
Feedback: Correct! Jupyter is often used as a term to refer to the notebook interface.
Default Feedback: Incorrect. Review the course materials on Jupyter notebooks to understand the
primary interface used for these actions.
Name the Python data structure that is an unordered collection of unique elements. Please answer in all
lowercase.
*A: set
Default Feedback: Incorrect. Review the Python data structures to find the right answer.
In Python, what symbol is used for exponentiation (raising a number to the power of another number)?
Please answer in all lowercase.
*A: **
Default Feedback: Incorrect. Remember, the symbol for exponentiation in Python is not the same as in
some other programming languages.
What is the term for a named location used to store data in Python? Please answer in all lowercase.
*A: variable
*B: variables
What is the term used for a data type in Python that is used to store multiple items in a single variable
and is defined using curly brackets? Please answer in all lowercase.
*A: set
Feedback: Correct! A set is defined using curly brackets and can store multiple items in a single
variable.
*B: sets
Feedback: Correct! A set is defined using curly brackets and can store multiple items in a single
variable.
Default Feedback: Incorrect. Review the data types in Python that use curly brackets.
What will be the output of the following Python code? python x = 'Hello' y = 'World' z = x + ' ' + y
print(z)
A: HelloWorld
Feedback: Remember that adding strings with a space in between concatenates them with the space
included.
C: Hello_World
Feedback: Underscores are not automatically added; they would need to be included explicitly in the
code.
D: Error
Feedback: No error will occur; string concatenation with spaces works as expected in Python.
Question 184 - multiple choice, shuffle, easy difficulty
*A: 3.14
B: 42
C: 3.14'
D: true
Feedback: Correct! Typecasting can indeed convert a float to an integer, but it will remove the decimal
part.
Feedback: Correct! Typecasting can convert an integer to a string using the str() function.
Feedback: Incorrect. A string with letters cannot be converted to a float. Only strings that are valid
numbers can be typecast to a float.
Feedback: Incorrect. Typecasting is not performed automatically; it has to be done explicitly using
functions like int(), float(), str(), etc.
Question 186 - multiple choice, shuffle, easy difficulty
*A: variable = 10
B: int variable = 10
Feedback: Incorrect. In Python, you do not need to specify the data type when declaring a variable.
C: 10 = variable
Feedback: Incorrect. You cannot assign a value to a variable this way in Python.
D: var variable = 10
Feedback: Incorrect. Python does not use the var keyword for variable declaration.
Which of the following is a key feature of Jupyter that makes it advantageous for interactive computing?
Feedback: That's correct! Jupyter's support for multiple programming languages is one of its key
features, making it versatile for various applications in data science and beyond.
Feedback: Not quite. Although version control is important, Jupyter itself does not offer built-in version
control. Think about the features that enhance interactive computing.
Which of the following is a valid reason for learning Python for data science and AI?
*A: Python has powerful libraries for data manipulation and analysis.
Feedback: Correct! Python's extensive libraries like Pandas, NumPy, and SciPy make it a powerful tool
for data science and AI.
Feedback: Incorrect. While Python is popular in data science, it is not the only language used. R and
SQL are also widely used.
Feedback: Incorrect. Python is not the newest programming language; it has been around since the late
1980s.
Feedback: Incorrect. Python does support object-oriented programming, which is beneficial for data
science and AI projects.
*A: x + y
*B: x ** y
*C: x // y
E: x %% y
Which of the following are considered foundational skills in Python programming for Data Science,
Data Engineering, AI, and Application Development?
Feedback: Incorrect. While important, implementing machine learning algorithms is a more advanced
skill.
Feedback: Correct! Exception handling is a crucial skill for robust Python programming.
Feedback: Correct! Functions are essential for writing reusable and modular code in Python.
Feedback: Incorrect. Mastering specific libraries is important but not considered a foundational skill.
Feedback: Correct! Using loops is a basic skill that every Python programmer should know.
What Python string method is used to convert all characters in a string to uppercase? Please answer in all
lowercase.
*A: upper
Feedback: Correct! The upper method converts all characters in a string to uppercase.
B: uppercase
Feedback: Not quite. The method you are looking for is upper.
C: toupper
Default Feedback: Remember to review the string methods related to changing case in Python.
Feedback: Correct! The find_all method returns a list of all matching tags.
Feedback: Incorrect. The find method returns the first matching tag, not find_all.
D: A dictionary of attributes
Feedback: Incorrect. The find_all method returns a list of tags, not a dictionary.
Which of the following is a common file format used for data interchange?
*A: CSV
Feedback: Correct! CSV is a common file format used for data interchange.
B: TXT
Feedback: Incorrect. TXT is a text file format but not specifically used for data interchange.
C: PDF
Feedback: Incorrect. PDF is a document format, not typically used for data interchange.
D: DOCX
*A: Kubernetes
C: Ansible
Feedback: Incorrect. Ansible is a configuration management tool, not specifically for container
orchestration.
D: Terraform
Feedback: Incorrect. Terraform is an infrastructure as code tool, not specifically for container
orchestration.
*A: Java
Feedback: Correct! Java has been the primary language for Android app development for many years.
B: Python
Feedback: Incorrect. While Python is versatile, it is not primarily used for Android app development.
C: Swift
Feedback: Incorrect. Swift is used for iOS app development, not Android.
D: C++
Feedback: Incorrect. C++ can be used in Android development but is not the primary language.
*A: Git
Feedback: Correct! Git is a widely used version control system that helps track changes in code during
software development.
B: Docker
C: Kubernetes
Feedback: Incorrect. Kubernetes is a container orchestration tool, not a version control system.
D: Jenkins
Feedback: Incorrect. Jenkins is a continuous integration and continuous delivery tool, not a version
control system.
Which of the following are common file formats that can be used in Python for data handling?
*A: CSV
Feedback: Correct! CSV (Comma-Separated Values) is a common file format used for data handling in
Python.
*B: JSON
Feedback: Correct! JSON (JavaScript Object Notation) is another common file format used for data
handling in Python.
C: MP3
Feedback: Incorrect. MP3 is an audio file format and is not commonly used for data handling in Python.
*D: XML
Feedback: Correct! XML (eXtensible Markup Language) is used for data handling in Python.
A: GET
Feedback: Incorrect. The GET method is used to retrieve data from a server.
B: POST
Feedback: Incorrect. The POST method is used to create new resources on a server.
*C: PUT
Feedback: Correct! The PUT method is used to update an existing resource in a REST API.
D: DELETE
Feedback: Incorrect. The DELETE method is used to delete a resource from a server.
A: Requests
Feedback: Incorrect. While Requests is a popular library for making HTTP requests, it is not primarily
used for web scraping.
*B: BeautifulSoup
Feedback: Correct! BeautifulSoup is widely used for parsing HTML and XML documents, making it a
popular choice for web scraping.
C: Matplotlib
Feedback: Incorrect. Matplotlib is used for creating static, animated, and interactive visualizations in
Python.
D: Pandas
Feedback: Incorrect. Pandas is primarily used for data manipulation and analysis, not for web scraping.
Feedback: Correct! IBM offers a professional certificate in AI Engineering which covers various aspects
of AI application development.
Feedback: Incorrect. Although Google Cloud offers a professional certificate, it is related to data
engineering, not AI application development.
Feedback: Incorrect. Microsoft Azure offers a professional certificate in Data Science, not specifically in
AI application development.
Feedback: Incorrect. AWS Certified Solutions Architect is focused on cloud architecture, not AI
application development.
Which Python project opportunity is best suited for someone interested in data engineering?
*A: Building ETL pipelines
Feedback: Correct! Building ETL (Extract, Transform, Load) pipelines is a common project in data
engineering.
Feedback: Incorrect. Creating machine learning models is more aligned with data science and AI
application development.
Feedback: Incorrect. Developing web scraping tools is not specifically related to data engineering.
Feedback: Incorrect. Designing interactive dashboards is more related to data visualization, which is a
part of data science.
Which HTTP method is typically used to create a new resource in a REST API?
*A: POST
Feedback: Correct! The POST method is used to create a new resource in a REST API.
B: GET
Feedback: Incorrect. The GET method is used to retrieve information, not to create a new resource.
C: PUT
Feedback: Incorrect. The PUT method is used to update an existing resource, not to create a new one.
D: DELETE
Feedback: Incorrect. The DELETE method is used to remove a resource, not to create a new one.
Feedback: Correct! An API's primary purpose is to facilitate communication between different software
systems.
Feedback: Incorrect. While APIs can sometimes be used for GUI-related tasks, their primary purpose is
to facilitate communication between different software systems.
Feedback: Incorrect. Managing databases and data storage solutions is not the primary purpose of an
API.
Feedback: Incorrect. Enhancing security features is not the primary purpose of an API.
*A: They use HTTP methods like GET, POST, PUT, DELETE
Feedback: Correct! REST APIs utilize standard HTTP methods for communication.
Feedback: Incorrect. REST APIs can use various data formats, including JSON and XML, but do not
rely solely on XML.
Feedback: Correct! REST APIs are designed to be stateless, meaning each request from a client to server
must contain all the information needed to understand and process the request.
Feedback: Incorrect. REST APIs are stateless and do not require clients to maintain session state.
Feedback: Incorrect. Web traffic analysis is not the same as web scraping.
Feedback: Incorrect. Web scraping does not involve creating website content.
Feedback: Correct! Docker is mainly used to create isolated environments known as containers for
applications.
Feedback: Not quite. Managing databases efficiently is not the primary purpose of Docker.
Feedback: Correct! An API allows different software applications to communicate with each other.
Feedback: Incorrect. Designing the user interface is typically done by a UI/UX designer.
Feedback: Incorrect. APIs may interact with databases, but their primary purpose is to enable
communication between software applications.
*A: A type of API that uses HTTP requests to access and use data
Feedback: Not quite. This certificate focuses on data analytics, not specifically on AI application
development.
Feedback: Incorrect. This certificate is more oriented towards data engineering using AWS services.
Feedback: Close, but not exactly. This certificate covers AI fundamentals but is not as specialized in
application development as the IBM AI Engineering Professional Certificate.
*A: json
Feedback: Correct! The json module in Python is used to handle JSON data.
B: xml
Feedback: Incorrect. The xml module is used for handling XML data, not JSON.
C: csv
Feedback: Incorrect. The csv module is used for handling CSV file formats, not JSON.
D: yaml
Feedback: Incorrect. Python does not have a built-in yaml module for handling YAML data.
*A: GET
Feedback: Correct! GET is a standard HTTP method used to request data from a specified resource.
*B: POST
Feedback: Correct! POST is a standard HTTP method used to send data to a server to create/update a
resource.
C: FETCH
Feedback: Incorrect. FETCH is not an HTTP method, but a JavaScript function for making HTTP
requests.
*D: PUT
Feedback: Correct! PUT is a standard HTTP method used to update a current resource with new data.
E: UPLOAD
Feedback: Incorrect. UPLOAD is not an HTTP method, but a term used for sending files to a server.
Which of the following Python libraries are commonly used in data science?
*A: Pandas
Feedback: Correct! Pandas is a widely-used library for data manipulation and analysis in Python.
*B: Numpy
*C: Matplotlib
D: Requests
Feedback: Incorrect. Requests is used for making HTTP requests in Python and is not specifically
related to data science.
E: BeautifulSoup
Feedback: Incorrect. BeautifulSoup is used for web scraping in Python and is not specifically related to
data science.
B: Monolithic codebase
*E: Scalability
*A: Jenkins
*B: Travis CI
Feedback: Correct! Travis CI is another tool commonly used for continuous integration.
C: Photoshop
E: Excel
*A: Statelessness
Feedback: Correct! REST APIs are stateless, meaning each request is independent.
B: Stateful communication
Feedback: Correct! REST APIs use HTTP methods like GET, POST, PUT, and DELETE.
Feedback: Incorrect. REST APIs are language-agnostic and can be used with any programming
language.
Which of the following are Python libraries commonly used in data science projects?
*A: NumPy
Feedback: Correct! NumPy is widely used for numerical computations in data science projects.
B: Requests
Feedback: Incorrect. Requests is used for making HTTP requests, not specifically for data science.
*C: Pandas
Feedback: Correct! Pandas is essential for data manipulation and analysis in data science.
D: BeautifulSoup
Feedback: Incorrect. BeautifulSoup is used for web scraping, which may be used in data science but is
not a core library for it.
*E: Matplotlib
Feedback: Correct! Matplotlib is commonly used for data visualization in data science projects.
Which of the following are valid HTTP methods used in REST APIs?
*A: GET
Feedback: Correct! GET is one of the standard HTTP methods used to request data from a specified
resource.
*B: POST
C: FETCH
*D: DELETE
E: SEND
*F: CONNECT
*A: 200.0
Feedback: Correct! 200 is the status code for a successful HTTP GET request.
What is the minimum number of core Python libraries you should be familiar with to work efficiently in
data science and AI application development?
*A: 3.0
Feedback: Correct! Being familiar with at least three core libraries like NumPy, Pandas, and Matplotlib
can significantly boost your efficiency.
Default Feedback: Incorrect. Think about the essential libraries commonly used in data science and AI
projects, such as NumPy, Pandas, and Matplotlib.
*A: 2000.0
Feedback: Correct! The term REST was first introduced in the year 2000 by Roy Fielding in his doctoral
dissertation.
Default Feedback: Incorrect. The term REST was introduced around the turn of the millennium.
How many professional certificates are mentioned in this lesson related to data science, data
engineering, and AI application development?
*A: 3.0
Feedback: Correct! The lesson mentions three professional certificates related to these fields.
Default Feedback: Incorrect. Make sure to review the lesson content to find the number of professional
certificates mentioned.
*A: 80.0
Feedback: Correct! Port 80 is the common port number used for HTTP connections.
Default Feedback: Incorrect. Please review the material on HTTP connections and their port numbers.
What is the status code returned by a REST API to indicate that the resource was not found?
*A: 404.0
Feedback: Correct! The status code 404 indicates that the resource was not found.
Default Feedback: Incorrect. Please review the status codes used in REST APIs.
What status code does an HTTP POST request return upon successfully creating a resource?
*A: 201.0
Feedback: Correct! The status code 201 indicates that a resource was successfully created.
Default Feedback: Incorrect. Please review the status codes for HTTP POST requests.
*A: 80.0
Default Feedback: Incorrect. Please review the default port numbers for various protocols.
Name the Python library commonly used for web scraping that provides functionalities to navigate and
search the parse tree. Please answer in all lowercase.
*A: beautifulsoup
*B: bs4
Default Feedback: Incorrect. Review the lesson on web scraping libraries in Python.
What is the name of the build automation tool primarily used for Java projects? Please answer in all
lowercase.
*A: maven
Feedback: Correct! Maven is the build automation tool primarily used for Java projects.
*B: gradle
Feedback: Correct! Gradle is another build automation tool that can be used for Java projects.
Default Feedback: Incorrect. Consider revisiting the materials on build automation tools for Java
projects.
*A: def
Default Feedback: Incorrect. Remember to review the Python cheat sheet to understand the syntax for
defining functions.
Name one of the Python libraries used to make HTTP requests and handle responses. Please answer in
all lowercase. Please answer in all lowercase.
*A: requests
Feedback: Correct! The 'requests' library is commonly used for this purpose.
*B: http.client
Feedback: Correct! The 'http.client' library can also be used for making HTTP requests.
Default Feedback: Incorrect. Please review the Python libraries used for making HTTP requests.
What type of architecture does a REST API follow? Please answer in all lowercase.
*A: client-server
*B: clientserver
Feedback: Correct! You might have omitted the hyphen, but the answer is understood.
Default Feedback: Incorrect. Remember that REST APIs follow an architecture that separates the client
and server roles.
*A: rest
Feedback: Correct! REST stands for Representational State Transfer and describes a set of constraints
for creating web services.
Default Feedback: Incorrect. Try again! Recall the set of constraints used for creating web services.
What is the term used to describe the process of extracting data from websites? Please answer in all
lowercase.
*A: scraping
Feedback: Correct! The process of extracting data from websites is known as scraping.
*B: webscraping
Feedback: Correct! The process of extracting data from websites is known as webscraping.
*A: Statelessness
Feedback: Correct! REST APIs are stateless, meaning each request from the client contains all the
information needed to process the request.
B: Stateful sessions
*C: Scalability
Feedback: Correct! One of the key features of REST APIs is their scalability.
D: Tight coupling between client and server
Feedback: Incorrect. REST APIs promote loose coupling between client and server.
A: Pandas
Feedback: Pandas is used for data manipulation and analysis, not specifically for web scraping.
B: NumPy
*C: BeautifulSoup
Feedback: Correct! BeautifulSoup is a Python library commonly used for web scraping.
D: Matplotlib
Feedback: Matplotlib is used for plotting and visualization, not for web scraping.
Feedback: Incorrect. This certificate focuses on IT support skills, not AI application development.
Feedback: Incorrect. While this certificate focuses on data science, it does not specifically address AI
application development.
Which of the following tools is primarily used for version control in software development?
*A: Git
Feedback: Correct! Git is widely used for version control in software development.
B: JIRA
Feedback: Incorrect. JIRA is a project management tool, not primarily for version control.
C: Docker
D: Kubernetes
Feedback: Incorrect. Kubernetes is used for container orchestration, not version control.
*A: The process of extracting information from websites using automated scripts or programs
Feedback: Correct! Web scraping is indeed the process of extracting information from websites using
automated scripts or programs.
Feedback: Incorrect. Manually copying and pasting data is not considered web scraping.
Feedback: Incorrect. Storing large amounts of data in a structured format is not web scraping.
*A: An API is a set of rules that allows different software entities to communicate with each other.
Feedback: Correct! An API defines the methods and data formats that applications can use to
communicate with each other.
Feedback: Incorrect. An API is not a programming language; it's a set of rules for communication
between software entities.
Feedback: Incorrect. An API is not a database; it allows functions and applications to interact with each
other.
Feedback: Incorrect. An API is not an operating system; it's a set of rules for software interaction.
Which of the following Python libraries are commonly used in data science, data engineering, and AI
application development?
*A: NumPy
Feedback: Correct! NumPy is widely used for numerical computing in data science and AI.
*B: Pandas
*C: Matplotlib
Feedback: Correct! Matplotlib is commonly used for data visualization in data science.
D: BeautifulSoup
Feedback: Incorrect. BeautifulSoup is used for web scraping, not specifically for data science or AI.
E: Requests
Feedback: Incorrect. Requests is used for making HTTP requests, which is not specific to data science or
AI.
Select all the tools that are commonly used for continuous integration and continuous deployment
(CI/CD).
*A: Jenkins
*B: Travis CI
C: Photoshop
Feedback: Incorrect. Photoshop is an image editing tool, not used for CI/CD.
*D: CircleCI
E: Slack
*F: Ansible
Feedback: Correct! Ansible can be used for deployment automation in CI/CD pipelines.
Feedback: Correct! The status code 200 OK indicates that the HTTP request has succeeded.
Feedback: Incorrect. The status code 404 Not Found indicates that the requested resource could not be
found.
Feedback: Incorrect. The status code 500 Internal Server Error indicates a server error.
Feedback: Correct! The status code 201 Created indicates that the request has been fulfilled and resulted
in a new resource being created.
E: 403 Forbidden
Feedback: Incorrect. The status code 403 Forbidden indicates that the server understood the request, but
refuses to authorize it.
Which of the following statements are true about REST APIs and their use in communication over the
internet?
*A: REST APIs use standard HTTP methods like GET, POST, PUT, and DELETE.
Feedback: Correct! REST APIs use standard HTTP methods for communication.
B: REST APIs are language-specific and can only be used with certain programming languages.
Feedback: Incorrect. REST APIs are language-agnostic and can be used with any programming
language that supports HTTP.
*C: REST APIs communicate over the internet using JSON or XML for data exchange.
Feedback: Correct! REST APIs commonly use JSON or XML for data exchange.
Feedback: Incorrect. REST APIs are stateless and do not require a persistent connection.
*E: REST APIs are a type of API that facilitate interaction between distributed systems.
Feedback: Correct! REST APIs facilitate interaction between distributed systems over the internet.