0% found this document useful (0 votes)
8 views112 pages

Python for Data Science, AI & Development Final

The document contains a series of multiple-choice and checkbox questions focused on Python data structures, including dictionaries, lists, tuples, and sets. Each question tests knowledge on how to manipulate these structures, their properties, and the methods associated with them. Correct and incorrect feedback is provided for each answer choice to enhance understanding of the concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views112 pages

Python for Data Science, AI & Development Final

The document contains a series of multiple-choice and checkbox questions focused on Python data structures, including dictionaries, lists, tuples, and sets. Each question tests knowledge on how to manipulate these structures, their properties, and the methods associated with them. Correct and incorrect feedback is provided for each answer choice to enhance understanding of the concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 112

Question 1 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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'?

*A: my_dict ['name'] = 'John Doe'

Feedback: Correct! This is the proper way to add a new key-value pair to a dictionary.

B: my_dict.add('name', 'John Doe')

Feedback: Incorrect. The add() method does not exist for dictionaries in Python.

C: my_dict.append({'name': 'John Doe'})

Feedback: No, the append() method is used for lists, not dictionaries.

D: my_dict.insert('name', 'John Doe')

Feedback: Incorrect. The insert() method does not exist for dictionaries in Python.

Question 2 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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

Question category: Module: Python Data Structures

Which of the following are valid ways to retrieve values from a dictionary in Python?

*A: Using the get() method

Feedback: Correct! The get() method retrieves the value for a given key.

*B: Using square brackets []

Feedback: Correct! Square brackets can be used to retrieve a value for a given key.

C: Using the key() method

Feedback: Incorrect. The key() method does not exist for dictionaries in Python.

D: Using the items() method

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.

Question 4 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following correctly describes a difference between lists and tuples in Python?

*A: Lists are mutable, whereas tuples are immutable.

Feedback: Correct! Lists can be modified after creation, but tuples cannot.

B: Lists are immutable, whereas tuples are mutable.

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.

D: Lists consume less memory than tuples.

Feedback: Incorrect. Tuples generally consume less memory than lists because they are immutable.

Question 5 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Data Structures

Which of the following operations will change the elements of a list in Python?

*A: Mutation

Feedback: Correct! Mutation operations can alter the elements of a list.

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.

Question 6 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following statements is true about sets in Python?

*A: Sets are mutable and unordered collections of unique elements.

Feedback: Correct! Sets in Python are mutable and unordered collections of unique elements.

B: Sets are immutable and ordered collections of unique elements.

Feedback: Incorrect. Sets in Python are mutable and unordered collections of unique elements.

C: Sets can contain duplicate elements.

Feedback: Incorrect. Sets cannot contain duplicate elements; each element is unique.

D: Sets store elements in a specific sequence.

Feedback: Incorrect. Sets in Python do not store elements in a specific sequence.

Question 7 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures


Which method would you use to find the union of two sets in Python?

*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.

Question 8 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following data structures in Python is immutable?

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.

Question 9 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures


Which data structure should be used when you need a collection of unique elements in Python?

A: List

Feedback: Incorrect. Lists can contain duplicate elements.

B: Tuple

Feedback: Incorrect. Tuples can contain duplicate elements.

C: Dictionary

Feedback: Incorrect. Dictionaries can have duplicate values but unique keys.

*D: Set

Feedback: Correct! Sets are collections of unique elements in Python.

Question 10 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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.

B: (1, 2, 3, (4, 5))

Feedback: Incorrect. The + operator concatenates tuples, it does not nest them.

C: [1, 2, 3, 4, 5]

Feedback: Incorrect. The result is a tuple, not a list.

D: Error: unsupported operand type(s) for +: 'tuple' and 'tuple'

Feedback: Incorrect. The + operator is supported for tuple concatenation.

Question 11 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following operations is NOT allowed on a Python tuple?


*A: Appending an element

Feedback: Correct! Tuples are immutable, so you cannot append elements to them.

B: Accessing an element by index

Feedback: Incorrect. You can access elements in a tuple using their index.

C: Concatenating with another tuple

Feedback: Incorrect. You can concatenate tuples using the + operator.

D: Checking for an element's existence

Feedback: Incorrect. You can check if an element exists in a tuple using the 'in' keyword.

Question 12 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

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()

Feedback: Incorrect. There is no assign method for dictionaries.

*D: my_dict [key] = value

Feedback: Correct! Direct assignment can add or update dictionary entries.

Question 13 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

What will the following code output? python my_dict = {'x': 10, 'y': 20, 'z': 30}
print(list(my_dict.keys()))

*A: ['x', 'y', 'z']


Feedback: Correct! The keys method returns a list of all keys in the dictionary.

B: [10, 20, 30]

Feedback: Incorrect. These are the values, not the keys, of the dictionary.

C: ['x': 10, 'y': 20, 'z': 30]

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.

Question 14 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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

Feedback: Incorrect. The value 1 is associated with the key 'a'.

C: b'

Feedback: Incorrect. The value 'b' is the key, not the value.

D: None

Feedback: Incorrect. The key 'b' does exist in the dictionary.

Question 15 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which operation can be used to add an element to a set in Python?

A: append()

Feedback: append() is used for lists, not sets.


*B: add()

Feedback: Correct! add() is used to add an element to a set.

C: insert()

Feedback: insert() is used for lists, not sets.

D: update()

Feedback: update() is used for adding multiple elements from another set or iterable.

Question 16 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Select all the data structures that allow duplicate elements in Python.

*A: List

Feedback: Correct! Lists allow duplicate elements.

B: Set

Feedback: Sets do not allow duplicate elements.

C: Dictionary

Feedback: Dictionaries do not allow duplicate keys.

*D: Tuple

Feedback: Correct! Tuples allow duplicate elements.

Question 17 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following data structures in Python is immutable?

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

Feedback: Sets are mutable, allowing modification of their elements.

Question 18 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which method is used to remove all elements from a set in Python?

*A: clear()

Feedback: Correct! The clear() method removes all elements from a set.

B: delete()

Feedback: Incorrect. There is no delete() method for sets in Python.

C: remove_all()

Feedback: Incorrect. There is no remove_all() method for sets in Python.

D: discard_all()

Feedback: Incorrect. There is no discard_all() method for sets in Python.

Question 19 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which operator is used to find the intersection of two sets in Python?

*A: The & operator

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.

Question 20 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

Which of the following data structures is immutable in Python?

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.

Question 21 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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()

Feedback: Incorrect. There is no add() method for lists in Python.

Question 22 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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.

Question 23 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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()

Feedback: Not quite. get_keys() is not a valid method for dictionaries.

C: student_info.all_keys()

Feedback: Incorrect. all_keys() is not a valid method for dictionaries.

D: keys(student_info)

Feedback: Sorry, this is incorrect. The keys method should be called on the dictionary object itself.

Question 24 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Which of the following are valid operations that can be performed on a set in Python?

*A: Adding an element to the set

Feedback: Correct! You can add an element to a set using the add() method.

*B: Removing an element from the set

Feedback: Correct! You can remove an element from a set using the remove() method.

C: Accessing an element by index

Feedback: Incorrect. Sets do not support accessing elements by index because they are unordered.

*D: Finding the intersection of two sets

Feedback: Correct! You can find the intersection of two sets using the intersection() method.

E: Sorting the elements of the set

Feedback: Incorrect. Sets do not support sorting because they are unordered.

Question 25 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Which of the following are characteristics of Python lists?

*A: Lists are mutable


Feedback: Correct! Lists can be changed after their creation.

*B: Lists can contain elements of different types

Feedback: Correct! Lists are heterogeneous and can store elements of different types.

C: Lists are immutable

Feedback: Incorrect. Lists are mutable, meaning you can change their content.

D: Lists are indexed starting from 1

Feedback: Incorrect. Lists in Python are indexed starting from 0.

*E: Lists can be concatenated using the + operator

Feedback: Correct! Lists support concatenation using the + operator.

Question 26 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Which of the following operations can be performed on both lists and tuples in Python?

*A: Indexing

Feedback: Correct! Indexing can be performed on both lists and tuples.

*B: Slicing

Feedback: Correct! Slicing can be performed on both lists and tuples.

*C: Concatenation

Feedback: Correct! Concatenation can be performed on both lists and tuples.

D: Mutation

Feedback: Incorrect. Mutation can only be performed on lists, not tuples.

E: Appending

Feedback: Incorrect. Appending is an operation specific to lists, not tuples.

Question 27 - checkbox, shuffle, partial credit, easy difficulty


Question category: Module: Python Data Structures

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()

Feedback: Incorrect. There is no modify() method for dictionaries in Python.

*C: setitem()

Feedback: Correct! The setitem() method can be used to modify an entry in a dictionary.

D: change()

Feedback: Incorrect. There is no change() method for dictionaries in Python.

E: alter()

Feedback: Incorrect. alter() is not a valid method for dictionaries in Python.

Question 28 - numeric, easy difficulty

Question category: Module: Python Data Structures

What is the length of the tuple (1, 2, 3, 4)?

*A: 4.0

Feedback: Correct! The tuple contains 4 elements.

Default Feedback: Incorrect. Remember that the length of a tuple is the number of elements it contains.

Question 29 - numeric, easy difficulty

Question category: Module: Python Data Structures

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.

Question 30 - numeric, easy difficulty

Question category: Module: Python Data Structures

How many key-value pairs does an empty dictionary contain in Python?

*A: 0.0

Feedback: Correct! An empty dictionary contains zero key-value pairs.

Default Feedback: Review how dictionaries store key-value pairs.

Question 31 - numeric, easy difficulty

Question category: Module: Python Data Structures

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.

Question 32 - numeric, easy difficulty

Question category: Module: Python Data Structures

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.

Question 33 - numeric, easy difficulty

Question category: Module: Python Data Structures


If a dictionary contains 8 keys and you delete 3 keys, how many keys are left in the dictionary?

*A: 5.0

Feedback: Correct! Subtracting 3 from 8 leaves 5 keys in the dictionary.

Default Feedback: Incorrect. Be sure to subtract the number of deleted keys from the original number of
keys.

Question 34 - text match, easy difficulty

Question category: Module: Python Data Structures

What keyword is used to delete an entry from a dictionary by its key? Please answer in all lowercase.

*A: del

Feedback: Correct! The del keyword is used to delete dictionary entries.

B: delete

Feedback: Incorrect. The correct keyword is del.

C: remove

Feedback: Incorrect. The correct keyword is del.

Default Feedback: Incorrect. Review the methods to delete dictionary entries in Python.

Question 35 - text match, easy difficulty

Question category: Module: Python Data Structures

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.

Question 36 - text match, easy difficulty

Question category: Module: Python Data Structures


What is the term used to describe a set that contains all elements of another set? Please answer in all
lowercase.

*A: superset

Feedback: Correct! A superset is a set that contains all elements of another set.

B: super set

Feedback: Incorrect. The correct term is 'superset' without a space.

C: super-set

Feedback: Incorrect. The correct term is 'superset' without a hyphen.

D: super_set

Feedback: Incorrect. The correct term is 'superset' without an underscore.

Default Feedback: Incorrect. Please review the properties and terminologies related to sets in Python.

Question 37 - text match, easy difficulty

Question category: Module: Python Data Structures

What is the term used to describe an immutable sequence in Python? Please answer in all lowercase.

*A: tuple

Feedback: Correct! A tuple is an immutable sequence in Python.

*B: tuples

Feedback: Correct! A tuple is an immutable sequence in Python.

Default Feedback: Incorrect. Please review the characteristics of immutable sequences in Python.

Question 38 - text match, easy difficulty

Question category: Module: Python Data Structures

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.

Question 39 - text match, easy difficulty

Question category: Module: Python Data Structures

What data structure would you use in Python to ensure unique elements? Please answer in all lowercase.

*A: set

Feedback: Correct! A set is used to ensure unique elements.

Default Feedback: Revisit the course material on sets and their properties.

Question 40 - text match, easy difficulty

Question category: Module: Python Data Structures

What is the term used to describe a mutable sequence in Python? Please answer in all lowercase. Please
answer in all lowercase.

*A: list

Feedback: Correct! A list is a mutable sequence in Python.

*B: lists

Feedback: Correct! Lists are mutable sequences in Python.

Default Feedback: Incorrect. The correct term is 'list' or 'lists'.

Question 41 - text match, easy difficulty

Question category: Module: Python Data Structures

What is the term used for a collection of key-value pairs in Python? Please answer in all lowercase.

*A: dictionary

Feedback: Correct! A collection of key-value pairs in Python is called a dictionary.

*B: dict

Feedback: Correct! Dict is the shorthand for dictionary in Python.

Default Feedback: Incorrect. In Python, a collection of key-value pairs is known as a dictionary or dict.
Question 42 - text match, easy difficulty

Question category: Module: Python Data Structures

What is the term used to describe a mutable sequence in Python? Please answer in all lowercase. Please
answer in all lowercase.

*A: list

Feedback: Correct! A list is a mutable sequence in Python.

*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.

Question 43 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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.

Question 44 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures


Which of the following methods can be used to add an element to a set in Python?

*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.

Question 45 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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()

Feedback: Incorrect. The insert() method adds an element at a specified position.

C: extend()

Feedback: Incorrect. The extend() method adds all elements of an iterable to the end of the list.

D: add()

Feedback: Incorrect. There is no add() method for lists in Python.

Question 46 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures


Which of the following methods can be used to delete an entry from a dictionary in Python?

*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.

Question 47 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Data Structures

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().

Question 48 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures


Select the data structures in Python that are mutable.

*A: List

Feedback: Correct! Lists in Python are mutable.

B: Tuple

Feedback: Incorrect. Tuples in Python are immutable.

*C: Dictionary

Feedback: Correct! Dictionaries in Python are mutable.

*D: Set

Feedback: Correct! Sets in Python are mutable.

E: String

Feedback: Incorrect. Strings in Python are immutable.

Question 49 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Which of the following are valid set operations in Python?

*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.

*D: Subset checking

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.

Question 50 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Data Structures

Which of the following statements about tuples and lists in Python are true?

*A: Tuples are immutable, meaning they cannot be changed after creation.

Feedback: Correct! Tuples cannot be changed once created.

*B: Lists are mutable, meaning their elements can be changed.

Feedback: Correct! Lists can be modified 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.

*D: Lists can store elements of different data types.

Feedback: Correct! Lists can store elements of various data types.

E: Lists and tuples both use parentheses for their syntax.

Feedback: Incorrect. Lists use square brackets, while tuples use parentheses for their syntax.

Question 51 - text match, easy difficulty

Question category: Module: Python Data Structures

What is the term used to describe a collection of key-value pairs in Python? Please answer in all
lowercase.

*A: dictionary

Feedback: Correct! A collection of key-value pairs in Python is called a dictionary.

*B: dict

Feedback: Correct! A collection of key-value pairs in Python is also known as a 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

Question category: Module: Python Programming Fundamentals

Select the scenarios where you would use exception handling.

*A: When attempting to open a file that may not exist

Feedback: Correct! Exception handling is useful for managing scenarios where a file might not be
present.

B: When performing arithmetic operations like addition or subtraction

Feedback: Incorrect. Basic arithmetic operations typically do not require exception handling unless they
involve risky operations like division by zero.

*C: When connecting to a database that may be offline

Feedback: Correct! Exception handling is crucial for managing database connectivity issues.

D: When iterating over a list of known size

Feedback: Incorrect. Iterating over a list of a known size does not usually require exception handling.

Question 53 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following keywords is used to handle exceptions in most programming languages?

*A: try-catch

Feedback: Correct! The try-catch block is commonly used to handle exceptions.

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

Question category: Module: Python Programming Fundamentals

What is the main purpose of exception handling in application development?

*A: To handle errors and maintain normal program flow

Feedback: Correct! Exception handling is primarily used to manage runtime errors and maintain the
normal flow of the application.

B: To restart the application automatically

Feedback: Incorrect. Exception handling is not concerned with restarting the application.

C: To log all user activities

Feedback: Incorrect. Logging user activities is not the main purpose of exception handling.

D: To improve application performance

Feedback: Incorrect. While exception handling can contribute to better performance, it's not the primary
goal.

Question 55 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 56 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What will be the output of the following Python code?

for i in range(1, 5): print(i)

*A: 1 2 3 4

Feedback: Correct! The range(1, 5) function generates numbers from 1 to 4.

B: 1 2 3 4 5

Feedback: Incorrect. The range(1, 5) function generates numbers from 1 to 4, not 1 to 5.

C: 0 1 2 3 4

Feedback: Incorrect. The range(1, 5) function starts from 1, not 0.

D: 2 3 4 5

Feedback: Incorrect. The range(1, 5) function generates numbers from 1 to 4, not 2 to 5.

Question 57 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following is the correct way to define a function in Python?

*A: def my_function():

Feedback: Correct! This is the syntax for defining a function in Python.

B: function my_function()

Feedback: Incorrect. This is the syntax for defining a function in JavaScript.

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.

Question 58 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following statements about variable scope in Python are true?

*A: Variables defined inside a function are local to that function.

Feedback: Correct! Variables defined inside a function are indeed local to that function.

*B: Variables defined outside a function are global.

Feedback: Correct! Variables defined outside a function are global.

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.

D: Variables defined inside a function can be accessed outside the function.

Feedback: Incorrect. Variables defined inside a function cannot be accessed outside the function.

Question 59 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following are valid ways to create a list in Python? Select all that apply.

*A: Using square brackets, e.g., my_list = [1, 2, 3]

Feedback: Correct! Square brackets are a valid way to create a list.

*B: Using the list() constructor, e.g., my_list = list((1, 2, 3))

Feedback: Correct! The list() constructor can be used to create a list from an iterable.

C: Using curly braces, e.g., my_list = {1, 2, 3}

Feedback: Curly braces are used to create sets, not lists.

D: Using angle brackets, e.g., my_list = <1, 2, 3>

Feedback: Angle brackets are not used to create lists in Python.


Question 60 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 61 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

In Python, which of the following data types is immutable?

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

Feedback: Dictionaries are mutable; their key-value pairs can be changed.

D: set

Feedback: Sets are mutable; their elements can be changed.

Question 62 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Programming Fundamentals

Which of the following is the correct syntax for an if statement in Python?

*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

Feedback: Incorrect. There is no 'end' keyword in Python if statements.

Question 63 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following is a built-in function in Python?

*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()

Feedback: Incorrect. size() is not a built-in function in Python.

Question 64 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals


Which method is used to initialize the attributes of a class in Python?

*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.

Question 65 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What keyword is used to define a class in Python?

*A: class

Feedback: Correct! The class keyword is used to define a class in Python.

B: def

Feedback: Incorrect. The def keyword is used to define a function, not a class.

C: init

Feedback: Incorrect. init is not a keyword used to define a class in Python.

D: self

Feedback: Incorrect. The self keyword is used within a class to refer to the instance, not to define the
class itself.

Question 66 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals


Which of the following can be used as class attributes in Python?

*A: Methods defined within the class

Feedback: Correct! Methods defined within the class can be used as class attributes.

*B: Variables defined within the class

Feedback: Correct! Variables defined within the class can be used as class attributes.

C: Global variables

Feedback: Incorrect. Global variables are not considered class attributes.

D: Functions defined outside the class

Feedback: Incorrect. Functions defined outside the class are not class attributes.

Question 67 - checkbox, shuffle, partial credit, medium

Question category: Module: Python Programming Fundamentals

Select the scenarios where using a custom exception would be appropriate.

*A: When you need specific error handling for a unique application condition.

Feedback: Correct! Custom exceptions are useful for handling specific application conditions.

B: When you want to handle all exceptions in a generic manner.

Feedback: Incorrect. Generic exception handling does not require custom exceptions.

*C: When built-in exceptions do not adequately describe the issue.

Feedback: Correct! Custom exceptions help when built-in ones are insufficient.

D: When you want to avoid using try-except blocks.

Feedback: Incorrect. Custom exceptions still require try-except blocks to be handled.

Question 68 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following is the correct syntax to catch an exception in Python?


*A: try: ... except Exception as e:

Feedback: Correct! This is the correct syntax to catch an exception in Python.

B: catch Exception e

Feedback: Incorrect. This is not the correct syntax in Python. Review the Python exception handling
syntax.

C: try { ... } catch (Exception e)

Feedback: Incorrect. This syntax is used in Java, not Python. Ensure you are using Python syntax.

D: except Exception as e:

Feedback: Incorrect. This syntax is incomplete without the try block.

Question 69 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What will be the output of the following Python code?

for i in range(3): if i == 2: print('Two') else: print('Not Two')

*A: Not Two\nNot Two\nTwo

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'.

B: Not Two\nTwo\nNot Two

Feedback: Incorrect. The loop executes from i = 0 to 2 sequentially, and the condition is checked each
time.

C: Two\nNot Two\nNot Two

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'.

Question 70 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Programming Fundamentals

Which of the following functions correctly generates a list of numbers starting from 0 up to but not
including 10 in Python?

*A: range(0, 10)

Feedback: Correct! This function generates numbers from 0 to 9.

B: range(1, 10)

Feedback: Incorrect. This function generates numbers from 1 to 9.

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)

Feedback: Incorrect. This function generates numbers from 0 to 8.

Question 71 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 72 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Programming Fundamentals

What happens when you try to access a local variable outside the function in which it is defined?

*A: An error is raised

Feedback: Correct! Local variables are only accessible within the function they are defined in.

B: The variable is automatically converted to a global variable

Feedback: Incorrect. Local variables are not converted to global variables automatically.

C: The variable is accessible, but its value is None

Feedback: Incorrect. Local variables are not accessible outside their defining function.

D: Python prompts you to define the variable globally

Feedback: Incorrect. Python does not prompt you to define the variable globally.

Question 73 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which statement correctly uses an elif statement in Python?

A:

if x > 5: print('x is greater than 5') else if x == 5: print('x is


5') else: print('x is less than 5')

Feedback: Incorrect. The correct keyword is elif, not else if.

*B:

if x > 5: print('x is greater than 5') elif x == 5: print('x is 5')


else: print('x is less than 5')

Feedback: Correct! This is the proper syntax for using elif.

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:

if x > 5: print('x is greater than 5') elif x = 5: print('x is 5')


else: print('x is less than 5')

Feedback: Incorrect. The comparison operator == should be used instead of the assignment operator =.

Question 74 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

In Python, what will be the output of the following code?

x = 10 y = 20 if x > y: print('x is greater than y') elif x < y:


print('x is less than y') else: print('x is equal to y')

A: x is greater than y

Feedback: Revisit how comparison operations work in Python. In this case, x is not greater than y.

*B: x is less than y

Feedback: Correct! x is less than y, so the elif block is executed.

C: x is equal to y

Feedback: Remember, x is not equal to y. The else block won't be executed.

D: The code will produce an error

Feedback: The code is syntactically correct and will run without errors.

Question 75 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What will be the output of the following Python code?

x = 5 y = 10 if x > y: print("x is greater than y") elif x < y:


print("x is less than y") else: print("x is equal to y")

A: x is greater than y

Feedback: Not quite. Remember to evaluate the condition in the if statement.

*B: x is less than y


Feedback: Correct! Since x is less than y, the block under the elif statement will execute.

C: x is equal to y

Feedback: Incorrect. The else block only executes when both if and elif conditions are false.

D: No output due to an error

Feedback: Incorrect. The code is syntactically correct and will produce an output.

Question 76 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following statements are true about defining a function in Python?

A: A function must have a return statement

Feedback: Incorrect. A function in Python does not need to have a return statement.

*B: Functions can have default parameter values

Feedback: Correct! Functions in Python can have default parameter values.

*C: A function can be defined inside another function

Feedback: Correct! Nested function definitions are allowed in Python.

D: Function names must start with an uppercase letter

Feedback: Incorrect. Function names in Python typically start with a lowercase letter, but it is not
required.

E: Lambda functions can have multiple expressions

Feedback: Incorrect. Lambda functions can only have a single expression.

Question 77 - numeric, easy difficulty

Question category: Module: Python Programming Fundamentals

How many times will the following loop execute?

for i in range(1, 10, 2): print(i)

*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.

Question 78 - numeric, easy difficulty

Question category: Module: Python Programming Fundamentals

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

Feedback: Correct! The comparison a > b evaluates to False, which corresponds to 0.

Default Feedback: Revisit how comparison operations work in Python and what Boolean values they
produce.

Question 79 - numeric, easy difficulty

Question category: Module: Python Programming Fundamentals

What is the output of the following Python expression: 3 + 2 * 2?

*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.

Question 80 - numeric, easy difficulty

Question category: Module: Python Programming Fundamentals

What will be the last number printed by this Python code?

for i in range(3, 10): print(i)

*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

Question category: Module: Python Programming Fundamentals

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.

Question 82 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

In Python, what is the keyword used to define a function? Please answer in all lowercase.

*A: def

Feedback: Correct! In Python, def is used to define a function.

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.

Question 83 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 84 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 85 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Default Feedback: Incorrect. Please review the lesson on loops in Python.

Question 86 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 87 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

What is the keyword used to define a function in Python? Please answer in all lowercase.

*A: def

Feedback: Correct! The def keyword is used to define a function in Python.

Default Feedback: The keyword used to define a function in Python is a reserved word that starts with
'd'.

Question 88 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 89 - text match, easy difficulty

Question category: Module: Python Programming Fundamentals

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

Question category: Module: Python Programming Fundamentals

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

Feedback: Correct! The global variable x is modified to 5 inside the function.

Default Feedback: Incorrect. Review the use of the global keyword in the function.

Question 91 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

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.

Question 92 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following is a correct way to define a class method in Python?

*A: def my_method(self):


Feedback: Correct! This is the proper way to define a method within a class in Python.

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.

Question 93 - multiple choice, shuffle, medium

Question category: Module: Python Programming Fundamentals

What will be the output of the following Python code?

x = 5 def foo(): x = 10 print(x) foo() print(x)

*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.

Question 94 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following statements about comparison operations in Python are true?

*A: Comparison operations return Boolean values.


Feedback: Correct! Comparison operations do return Boolean values, either True or False.

*B: The == operator checks for value equality.

Feedback: Correct! The == operator checks if two values are equal.

C: The != operator checks for identity.

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.

Question 95 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What will be the output of the following Python code?

x = 10 y = 20 if x > y: print("x is greater than y") elif x < y:


print("x is less than y") else: print("x is equal to y")

A: x is greater than y

Feedback: Revisit the comparison operations. Consider the values of x and y.

*B: x is less than y

Feedback: Correct! Since x is 10 and y is 20, x is indeed less 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.

Question 96 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

What is the primary purpose of using exception handling in programming?

*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.

B: To optimize the performance of the application

Feedback: Not quite. While performance is important, exception handling is primarily for managing
errors, not optimizing performance.

C: To enhance the security of the software

Feedback: Incorrect. Exception handling primarily deals with runtime errors and not directly with
security measures.

D: To simplify the code maintenance and readability

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.

Question 97 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following correctly demonstrates the use of the global keyword within a function in
Python?

*A:

def my_function(): global x x = 10

Feedback: Correct! This is the proper use of the global keyword to define a global variable within a
function.

B:

def my_function(): x = 10 global x

Feedback: Incorrect. The global keyword must be used inside the function before the variable is
assigned.

C:

global x def my_function(): x = 10

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.

Question 98 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Programming Fundamentals

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?

*A: for i in range(5):

Feedback: Correct! Remember that the range function in Python generates numbers from 0 up to, but not
including, the specified end value.

B: for (i=0; i<5; i++)

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.

Question 99 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Programming Fundamentals

Which of the following statements about variable scope in Python are correct?

*A: Variables defined inside a function are local to that function.

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.

Question 100 - checkbox, shuffle, partial credit, medium

Question category: Module: Python Programming Fundamentals

Select all the valid ways to use a while loop to print numbers from 1 to 5 in Python.

*A: i = 1 while i <= 5: print(i) i += 1

Feedback: Correct! This is a standard way of using a while loop to print numbers from 1 to 5 in Python.

*B: i = 1 while i < 6: print(i) i = i + 1

Feedback: Correct! This also works as it prints numbers from 1 to 5.

C: i = 1 while (i <= 5) print i i++

Feedback: Incorrect. This syntax is a mix of Python and C-style syntax and will not work in Python.

*D: i = 0 while i < 5: i += 1 print(i)

Feedback: Correct! This prints numbers from 1 to 5 by incrementing i before printing.

E: while i <= 5: print(i) i += 1

Feedback: Incorrect. The variable i is not initialized in this code snippet, which will result in an error.

Question 101 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

Which method is used to write a string to a text file in Python?


*A: write

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.

Question 102 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

What function in Pandas is used to read a CSV file?

*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.

Question 103 - multiple choice, shuffle, easy difficulty


Question category: Module: Working with Data in Python

What is the correct way to import the pandas library in Python?

A: import pandas

Feedback: This option is incorrect. Remember to use the correct alias when importing pandas.

*B: import pandas as pd

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.

Question 104 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 105 - multiple choice, shuffle, easy difficulty


Question category: Module: Working with Data in Python

Which method is used to read the entire content of a file in Python?

*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.

Question 106 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 107 - multiple choice, shuffle, easy difficulty


Question category: Module: Working with Data in Python

Which operation is not considered a basic operation on 2D Numpy arrays?

A: Matrix multiplication

Feedback: Incorrect. Matrix multiplication is a basic operation on 2D Numpy arrays.

B: Scalar multiplication

Feedback: Incorrect. Scalar multiplication is a basic operation on 2D Numpy arrays.

C: Element-wise product

Feedback: Incorrect. Element-wise product is a basic operation on 2D Numpy arrays.

*D: Matrix inversion

Feedback: Correct! Matrix inversion is not considered a basic operation on 2D Numpy arrays.

Question 108 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

To import the pandas library in Python, which of the following statements is correct?

*A: import pandas as pd

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.

C: import pandas library

Feedback: Incorrect. The correct statement is import pandas as pd. import pandas library is not valid.

D: import pd from pandas

Feedback: Incorrect. The correct statement is import pandas as pd. import pd from pandas is not valid.

Question 109 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python


In Python, 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. 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.

Question 110 - checkbox, shuffle, partial credit, medium

Question category: Module: Working with Data in Python

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 [] .

Question 111 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python


Which of the following commands will create a 2D Numpy array with shape (2, 3)?

*A: numpy.array([ [1, 2, 3] , [4, 5, 6] ])

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 1D array, not a 2D array.

C: numpy.array([ [1, 2] , [3, 4] , [5, 6] ])

Feedback: Incorrect. This command creates a 2D array with shape (3, 2).

D: numpy.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]])

Feedback: Incorrect. This command creates a 3D array, not a 2D array.

Question 112 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 113 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python


In NumPy, which function is used to compute the standard deviation of an array?

*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.

Question 114 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

Which method is used to close a file in Python?

*A: close()

Feedback: Correct! The close() method is used to close a file.

B: terminate()

Feedback: Incorrect. The terminate() method is not used to close a file.

C: end()

Feedback: Incorrect. The end() method is not used to close a file.

D: finish()

Feedback: Incorrect. The finish() method is not used to close a file.

Question 115 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

Which method is used to read the entire content of a file in Python?


*A: read()

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.

Question 116 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

How would you use the linspace function from NumPy to generate 10 evenly spaced numbers between 0
and 1?

*A: numpy.linspace(0, 1, 10)

Feedback: Correct! The linspace function generates numbers evenly spaced over a specified interval.

B: numpy.linspace(0, 1, 9)

Feedback: Incorrect. This would generate 9 instead of 10 numbers.

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)

Feedback: Incorrect. This would only generate a single value.

Question 117 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 118 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 119 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 120 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

Which of the following functions is used to concatenate two DataFrames in Pandas?

*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()

Feedback: Incorrect. The join() function is used to join DataFrames on indices.

D: combine()

Feedback: No, the combine() function is used for element-wise operations with DataFrames.

Question 121 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Working with Data in Python

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()

Feedback: Incorrect. pd.load_table() is not a valid method in pandas.

E: pd.read_excel()

Feedback: Incorrect. pd.read_excel() is used for reading Excel files, not CSV files.

Question 122 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Working with Data in Python

Which of the following are methods to read data from a file in Python?

*A: read()

Feedback: Correct! read() is a method to read data from a file in Python.

*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

Question category: Module: Working with Data in Python

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

Feedback: Correct! The range of unique ages is 44, calculated as 65 - 21 + 1.

Default Feedback: Incorrect. Ensure you calculate the range correctly, considering both the minimum
and maximum values.

Question 124 - numeric, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 125 - numeric, easy difficulty

Question category: Module: Working with Data in Python

If you have a NumPy array a = np.array( [1, 2, 3, 4, 5] ), what is the mean of the array?

*A: 3.0

Feedback: Correct! The mean of the array [1, 2, 3, 4, 5] is 3.

Default Feedback: Incorrect. Please review the methods to calculate the mean of a NumPy array.

Question 126 - numeric, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 127 - numeric, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 128 - numeric, easy difficulty

Question category: Module: Working with Data in Python

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

Feedback: Correct! The sum of the array elements is 21.

Default Feedback: Incorrect. Please check your calculation and try again.

Question 129 - numeric, easy difficulty

Question category: Module: Working with Data in Python

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

Feedback: Correct! The second number in the resulting array is 2.5.

Default Feedback: Incorrect. Please revisit the concept of using linspace to generate evenly spaced
numbers.

Question 130 - text match, easy difficulty

Question category: Module: Working with Data in Python


What is the method used to find unique elements in a column of a DataFrame using pandas? Please
answer in all lowercase.

*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

Feedback: Incorrect. The correct method is unique, not pd.unique.

D: pd.unique()

Feedback: Incorrect. The correct method is unique, not pd.unique().

Default Feedback: Incorrect. Remember to use the method that specifically finds unique elements in a
DataFrame column.

Question 131 - text match, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 132 - text match, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 133 - text match, easy difficulty

Question category: Module: Working with Data in Python

What is the Numpy function used to create a 2D array? Please answer in all lowercase.

*A: array

Feedback: Correct! The array function is used to create a 2D array in Numpy.

Default Feedback: Incorrect. Please review the Numpy functions for creating arrays.

Question 134 - text match, easy difficulty

Question category: Module: Working with Data in Python

What function in NumPy is used to create an array? Please answer in all lowercase.

*A: array

Feedback: Great! The function array is used to create an array in NumPy.

Default Feedback: Incorrect. Please review the NumPy functions for creating arrays.

Question 135 - text match, easy difficulty

Question category: Module: Working with Data in Python

What function in Numpy would you use to create a 2D array? Please answer in all lowercase.

*A: array

Feedback: Correct! The array function is used to create arrays in Numpy.

*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.

Question 136 - text match, easy difficulty

Question category: Module: Working with Data in Python

What function in Python is used to write data to a file? Please answer in all lowercase.

*A: write

Feedback: Correct! The write() function is used to write data to a file.

*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.

Question 137 - numeric, medium

Question category: Module: Working with Data in Python

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.

Question 138 - numeric, medium

Question category: Module: Working with Data in Python

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.

Question 139 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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()

Feedback: Incorrect. The pd.import_csv() method is not a valid method in Pandas.

D: pd.open_csv()

Feedback: Incorrect. The pd.open_csv() method does not exist in Pandas for reading CSV files.

Question 140 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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

Question category: Module: Working with Data in Python

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.

Question 142 - multiple choice, shuffle, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 143 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Working with Data in Python

Which of the following operations can be performed on a 1D Numpy array?

*A: Indexing

Feedback: Correct! Indexing allows you to access individual elements within the array.

B: Matrix multiplication

Feedback: Incorrect. Matrix multiplication is typically performed on 2D arrays, not 1D arrays.

*C: Slicing

Feedback: Correct! Slicing allows you to access a subset of the array.

*D: Element-wise multiplication

Feedback: Correct! Element-wise multiplication is supported for 1D arrays in Numpy.

E: Eigenvalue decomposition

Feedback: Incorrect. Eigenvalue decomposition is applied to square matrices, not 1D arrays.

Question 144 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 145 - text match, easy difficulty

Question category: Module: Working with Data in Python

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.

Question 146 - text match, easy difficulty

Question category: Module: Working with Data in Python

What is the mode used to open a file for writing in Python? Please answer in all lowercase.

*A: w

Feedback: Correct! The w mode is used to open a file for writing.

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

Question category: Module: Python Basics

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.

Question 148 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

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')

Feedback: Incorrect. There is no search method for strings in Python.

D: s.locate('o')

Feedback: Incorrect. There is no locate method for strings in Python.


Question 149 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following modules is covered in this course?

*A: Data Science with Python

Feedback: Correct! This course covers the module on Data Science with Python.

B: Web Development with JavaScript

Feedback: Incorrect. This course does not cover Web Development with JavaScript.

C: Machine Learning with R

Feedback: Incorrect. This course does not cover Machine Learning with R.

D: Mobile App Development with Swift

Feedback: Incorrect. This course does not cover Mobile App Development with Swift.

Question 150 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

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.

B: Python is the only programming language used in Data Science.

Feedback: Incorrect. While Python is widely used, it is not the only programming language employed in
Data Science.

C: Python is specifically designed for statistical analysis.

Feedback: Incorrect. Python is a general-purpose programming language, although it has many libraries
for statistical analysis.

D: Python is faster than all other programming languages.


Feedback: Incorrect. Python is not necessarily the fastest programming language, but its versatility and
ease of use make it popular in Data Science and AI.

Question 151 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

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

Feedback: Correct! This is the standard way to increment the value of x by 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.

Question 152 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following is a valid way to declare 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

Feedback: Incorrect. This is not a valid way to declare a variable in Python.

D: let x = 5

Feedback: Incorrect. This syntax is used in JavaScript, not Python.


Question 153 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following is NOT a valid Python expression?

A: 3 + 4 * 2

Feedback: Incorrect. This is a valid Python expression.

B: (3 + 4) * 2

Feedback: Incorrect. This is a valid Python expression.

C: 3 ** 2 / 2

Feedback: Incorrect. This is a valid Python expression.

*D: 3 // (2 + )

Feedback: Correct! This expression has a syntax error.

Question 154 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

How can you delete a cell in a Jupyter notebook?

*A: Press Esc and then D twice

Feedback: Correct! Pressing Esc and then D twice will delete the cell.

B: Press Shift and Enter

Feedback: Incorrect. Pressing Shift and Enter runs the cell.

C: Click on the 'Delete' button in the toolbar

Feedback: Incorrect. There is no 'Delete' button in the Jupyter toolbar.

D: Use the 'del' command

Feedback: Incorrect. The 'del' command is used within a cell to delete variables, not the cell itself.

Question 155 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Basics

Which of the following best describes the role of Jupyter in data science?

A: A tool for creating web applications

Feedback: This is not correct. While Jupyter can be used in web development, its primary role in data
science is different.

*B: A platform for interactive computing and data visualization

Feedback: Correct! Jupyter is widely used for interactive computing and data visualization in data
science.

C: A database management system

Feedback: Incorrect. Jupyter is not a database management system.

D: An integrated development environment (IDE) for Python

Feedback: Not quite. While Jupyter provides an environment for coding in Python, it is not classified as
an IDE.

Question 156 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following is an integer in Python?

*A: 10

Feedback: Correct! 10 is an integer in Python.

B: 10.5

Feedback: Incorrect. 10.5 is a float, not an integer.

C: 10'

Feedback: Incorrect. '10' is a string, not an integer.

D: true

Feedback: Incorrect. True is a Boolean, not an integer.

Question 157 - multiple choice, shuffle, easy difficulty


Question category: Module: Python Basics

Which of the following best describes a Boolean in Python?

*A: A data type that can be either True or False

Feedback: Correct! A Boolean in Python can only be either True or False.

B: A data type that can only be a number

Feedback: Incorrect. Booleans are not restricted to numbers.

C: A data type that can be a combination of characters

Feedback: Incorrect. Booleans are not a combination of characters.

D: A data type that can be any numeric value

Feedback: Incorrect. Booleans are not any numeric value.

Question 158 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following operations would you use to retrieve the third character from a string s in
Python?

A: s [3]

Feedback: Remember, Python uses zero-based indexing.

*B: s [2]

Feedback: Correct! Python uses zero-based indexing, so the third character is at index 2.

C: s [1]

Feedback: That's the second character. Python uses zero-based indexing.

D: s.charAt(3)

Feedback: This method is used in JavaScript, not Python.

Question 159 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics


Which of the following data types in Python can hold the value True?

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.

Question 160 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following data structures in Python is immutable?

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.

Question 161 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following is a valid way to declare a variable in Python?


A: int num = 5

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

Feedback: Incorrect. This is not a valid syntax in Python.

D: var num = 5

Feedback: Incorrect. Python does not use the var keyword for variable declaration.

Question 162 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

What is one of the primary benefits of using Python in data science?

*A: Extensive libraries and community support

Feedback: Correct! Python's extensive libraries and active community support make it an excellent
choice for data science.

B: Limited data visualization capabilities

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.

D: Lack of integration with other tools

Feedback: Incorrect. Python integrates well with various tools and libraries, particularly in data science.

Question 163 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following operations can be used to extract a substring from a given string in Python?
A: Indexing

Feedback: Indexing is used to access a single character in a string, not a substring.

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.

Question 164 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

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.

Question 165 - checkbox, shuffle, partial credit, medium

Question category: Module: Python Basics


Which of the following are important concepts in Python programming for Data Science, Data
Engineering, AI, and Application Development? Select all that apply.

*A: Data types

Feedback: Correct! Data types are fundamental in Python programming.

*B: Lists

Feedback: Correct! Lists are essential in Python programming.

*C: Branching

Feedback: Correct! Branching is a key concept in Python programming.

*D: Exception handling

Feedback: Correct! Exception handling is an important concept in Python programming.

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.

Question 166 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Select all the data types that are considered mutable in Python.

*A: List

Feedback: Correct! Lists are mutable in Python.

B: String

Feedback: Incorrect. Strings are immutable in Python.

*C: Dictionary

Feedback: Correct! Dictionaries are mutable in Python.


D: Tuple

Feedback: Incorrect. Tuples are immutable in Python.

E: Float

Feedback: Incorrect. Floats are immutable in Python.

Question 167 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Which of the following are valid ways to concatenate strings in Python?

*A: Using the + operator

Feedback: Correct! The + operator can be used to concatenate strings in Python.

B: Using the concat() method

Feedback: No, concat() is not a built-in method for strings in Python. It's used in other languages like
Java.

*C: Using the join() method

Feedback: Correct! The join() method can be used to concatenate strings in Python.

D: Using the append() method

Feedback: No, append() is used for lists, not strings.

E: Using the extend() method

Feedback: No, extend() is used for lists, not strings.

Question 168 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

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.

*D: Exception Handling

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.

Question 169 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Which of the following are users of Python?

*A: Data scientists

Feedback: Correct! Data scientists are among the primary users of Python due to its powerful libraries
and tools for data analysis.

*B: Web developers

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.

*D: Machine learning engineers

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.

Question 170 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Select all the data types that can be typecast to a string in Python:

*A: Integer

Feedback: Correct! Integers can be typecast to strings in Python.

*B: Float

Feedback: Correct! Floats can be typecast to strings in Python.

*C: Boolean

Feedback: Correct! Booleans can be typecast to strings in Python.

D: List

Feedback: Incorrect. Lists cannot be directly typecast to strings in Python.

E: Dictionary

Feedback: Incorrect. Dictionaries cannot be directly typecast to strings in Python.

Question 171 - numeric, easy difficulty

Question category: Module: Python Basics

If you have a string s = 'Hello World', what is the result of len(s)?

*A: 11.0

Feedback: Correct! The length of the string 'Hello World' is 11 characters.

Default Feedback: Remember to count all characters in the string, including spaces.

Question 172 - numeric, easy difficulty

Question category: Module: Python Basics

What will be the result of the expression 7 // 2 in Python?


*A: 3.0

Feedback: Correct! The // operator in Python is used for floor division, which returns the largest whole
number less than or equal to the division.

Default Feedback: Incorrect. Review the concept of floor division in Python.

Question 173 - numeric, easy difficulty

Question category: Module: Python Basics

If you have a string s = 'hello', what is the index of 'e' in the string?

*A: 1.0

Feedback: Correct! The index of 'e' in the string 'hello' is 1.

Default Feedback: Incorrect. Remember that string indices in Python start from 0.

Question 174 - numeric, easy difficulty

Question category: Module: Python Basics

If you have a float value of 10.75 and you typecast it to an integer, what will be the result?

*A: 10.0

Feedback: Correct! Typecasting 10.75 to an integer results in 10.

Default Feedback: Incorrect. Please review how typecasting from float to integer works in Python.

Question 175 - text match, easy difficulty

Question category: Module: Python Basics

What is the Python data type for floating-point numbers? Please answer in all lowercase.

*A: float

Feedback: Correct! Floats are used to represent real numbers in Python.

Default Feedback: Review the common data types in Python and try again.

Question 176 - text match, easy difficulty

Question category: Module: Python Basics


Name one of the key features of Jupyter that makes it advantageous for interactive computing. Please
answer in all lowercase.

*A: notebooks

Feedback: Correct! Jupyter notebooks are a key feature.

*B: interactivity

Feedback: Correct! Interactivity is a key feature of Jupyter.

*C: integration

Feedback: Correct! Integration with various libraries is a key feature.

Default Feedback: Incorrect. Please review the key features of Jupyter for interactive computing.

Question 177 - text match, easy difficulty

Question category: Module: Python Basics

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.

Question 178 - text match, easy difficulty

Question category: Module: Python Basics

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.

*C: jupyter notebook


Feedback: Correct! The term 'Jupyter notebook' specifically describes the interface used.

Default Feedback: Incorrect. Review the course materials on Jupyter notebooks to understand the
primary interface used for these actions.

Question 179 - text match, easy difficulty

Question category: Module: Python Basics

Name the Python data structure that is an unordered collection of unique elements. Please answer in all
lowercase.

*A: set

Feedback: Correct! A set is an unordered collection of unique elements in Python.

Default Feedback: Incorrect. Review the Python data structures to find the right answer.

Question 180 - text match, easy difficulty

Question category: Module: Python Basics

In Python, what symbol is used for exponentiation (raising a number to the power of another number)?
Please answer in all lowercase.

*A: **

Feedback: Correct! The ** operator is used for exponentiation in Python.

Default Feedback: Incorrect. Remember, the symbol for exponentiation in Python is not the same as in
some other programming languages.

Question 181 - text match, easy difficulty

Question category: Module: Python Basics

What is the term for a named location used to store data in Python? Please answer in all lowercase.

*A: variable

Feedback: Correct! A variable is a named location used to store data in Python.

*B: variables

Feedback: Correct! A variable is a named location used to store data in Python.


Default Feedback: Incorrect. Please review the concepts of variables in Python.

Question 182 - text match, easy difficulty

Question category: Module: Python Basics

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.

Question 183 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

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.

*B: Hello World

Feedback: Correct! The strings are concatenated with a space in between.

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

Question category: Module: Python Basics

In Python, which of the following is a float?

*A: 3.14

Feedback: Correct! 3.14 is a float because it is a number with a decimal point.

B: 42

Feedback: Incorrect. 42 is an integer, not a float.

C: 3.14'

Feedback: Incorrect. '3.14' is a string, not a float.

D: true

Feedback: Incorrect. True is a Boolean, not a float.

Question 185 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Which of the following statements about typecasting in Python are true?

*A: Typecasting can convert a float to an integer.

Feedback: Correct! Typecasting can indeed convert a float to an integer, but it will remove the decimal
part.

*B: Typecasting can convert an integer to a string.

Feedback: Correct! Typecasting can convert an integer to a string using the str() function.

C: Typecasting can convert a string with letters to a float.

Feedback: Incorrect. A string with letters cannot be converted to a float. Only strings that are valid
numbers can be typecast to a float.

D: Typecasting is performed automatically by Python.

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

Question category: Module: Python Basics

Which of the following is a valid way to declare a variable in Python?

*A: variable = 10

Feedback: Correct! variable = 10 is the correct way to declare a variable in Python.

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.

Question 187 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

Which of the following is a key feature of Jupyter that makes it advantageous for interactive computing?

*A: Supports multiple programming languages

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.

B: Provides a desktop IDE for Python development

Feedback: Incorrect. While Jupyter is an interactive computing environment, it is not specifically a


desktop IDE for Python development. Consider what makes Jupyter unique for interactive computing.

C: Offers built-in version control

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.

D: Includes a package manager


Feedback: Incorrect. Jupyter does not include a package manager. Reflect on the features that make
Jupyter beneficial for interactive computing.

Question 188 - multiple choice, shuffle, easy difficulty

Question category: Module: Python Basics

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.

B: Python is the only programming language used in data science.

Feedback: Incorrect. While Python is popular in data science, it is not the only language used. R and
SQL are also widely used.

C: Python is the newest programming language.

Feedback: Incorrect. Python is not the newest programming language; it has been around since the late
1980s.

D: Python does not support object-oriented programming.

Feedback: Incorrect. Python does support object-oriented programming, which is beneficial for data
science and AI projects.

Question 189 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Which of the following expressions are valid in Python?

*A: x + y

Feedback: Correct! x + y is a valid Python expression for addition.

*B: x ** y

Feedback: Correct! x ** y is a valid Python expression for exponentiation.

*C: x // y

Feedback: Correct! x // y is a valid Python expression for floor division.


D: x y

Feedback: Incorrect. x y is not a valid expression in Python.

E: x %% y

Feedback: Incorrect. %% is not a valid operator in Python.

Question 190 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: Python Basics

Which of the following are considered foundational skills in Python programming for Data Science,
Data Engineering, AI, and Application Development?

*A: Understanding data types

Feedback: Correct! Understanding different data types is fundamental to Python programming.

B: Implementing machine learning algorithms

Feedback: Incorrect. While important, implementing machine learning algorithms is a more advanced
skill.

*C: Handling exceptions

Feedback: Correct! Exception handling is a crucial skill for robust Python programming.

*D: Creating and using functions

Feedback: Correct! Functions are essential for writing reusable and modular code in Python.

E: Mastering specific Python libraries

Feedback: Incorrect. Mastering specific libraries is important but not considered a foundational skill.

*F: Using loops for iteration

Feedback: Correct! Using loops is a basic skill that every Python programmer should know.

Question 191 - text match, easy difficulty

Question category: Module: Python Basics

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

Feedback: Incorrect. The method used in Python is upper.

Default Feedback: Remember to review the string methods related to changing case in Python.

Question 192 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

What does the find_all method in BeautifulSoup return?

*A: A list of all matching tags

Feedback: Correct! The find_all method returns a list of all matching tags.

B: The first matching tag

Feedback: Incorrect. The find method returns the first matching tag, not find_all.

C: A string of the HTML content

Feedback: Incorrect. The find_all method returns a list, not a string.

D: A dictionary of attributes

Feedback: Incorrect. The find_all method returns a list of tags, not a dictionary.

Question 193 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Incorrect. DOCX is a document format used for word processing.

Question 194 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Select the technologies that are used for container orchestration.

*A: Kubernetes

Feedback: Correct! Kubernetes is a popular container orchestration platform.

*B: Docker Swarm

Feedback: Correct! Docker Swarm is another container orchestration tool.

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.

Question 195 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which language is primarily used for Android app development?

*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.

Question 196 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which tool is commonly used for version control in software development?

*A: Git

Feedback: Correct! Git is a widely used version control system that helps track changes in code during
software development.

B: Docker

Feedback: Incorrect. Docker is used for containerization, not version control.

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.

Question 197 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 198 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which HTTP method is used to update a resource in a REST API?

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.

Question 199 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which Python library is commonly used for web scraping?

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.

Question 200 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following is a professional certificate related to AI application development?

*A: IBM AI Engineering

Feedback: Correct! IBM offers a professional certificate in AI Engineering which covers various aspects
of AI application development.

B: Google Cloud Data Engineering

Feedback: Incorrect. Although Google Cloud offers a professional certificate, it is related to data
engineering, not AI application development.

C: Microsoft Azure Data Science

Feedback: Incorrect. Microsoft Azure offers a professional certificate in Data Science, not specifically in
AI application development.

D: AWS Certified Solutions Architect

Feedback: Incorrect. AWS Certified Solutions Architect is focused on cloud architecture, not AI
application development.

Question 201 - multiple choice, shuffle, medium

Question category: Module: APIs and Data Collection

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.

B: Creating machine learning models

Feedback: Incorrect. Creating machine learning models is more aligned with data science and AI
application development.

C: Developing web scraping tools

Feedback: Incorrect. Developing web scraping tools is not specifically related to data engineering.

D: Designing interactive dashboards

Feedback: Incorrect. Designing interactive dashboards is more related to data visualization, which is a
part of data science.

Question 202 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 203 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

What is an API's primary purpose in software development?


*A: To facilitate communication between different software systems

Feedback: Correct! An API's primary purpose is to facilitate communication between different software
systems.

B: To improve the graphical user interface of an application

Feedback: Incorrect. While APIs can sometimes be used for GUI-related tasks, their primary purpose is
to facilitate communication between different software systems.

C: To manage databases and data storage solutions

Feedback: Incorrect. Managing databases and data storage solutions is not the primary purpose of an
API.

D: To enhance the security features of an application

Feedback: Incorrect. Enhancing security features is not the primary purpose of an API.

Question 204 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following are true about REST APIs?

*A: They use HTTP methods like GET, POST, PUT, DELETE

Feedback: Correct! REST APIs utilize standard HTTP methods for communication.

B: They rely on XML for data formatting

Feedback: Incorrect. REST APIs can use various data formats, including JSON and XML, but do not
rely solely on XML.

*C: They are designed to be stateless

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.

D: They require clients to maintain session state

Feedback: Incorrect. REST APIs are stateless and do not require clients to maintain session state.

Question 205 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection


Which of the following best defines web scraping?

*A: The process of extracting information from a website

Feedback: Correct! Web scraping involves extracting information from websites.

B: The process of cleaning website data

Feedback: Incorrect. Data cleaning is different from web scraping.

C: The process of analyzing web traffic

Feedback: Incorrect. Web traffic analysis is not the same as web scraping.

D: The process of creating website content

Feedback: Incorrect. Web scraping does not involve creating website content.

Question 206 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

What is the primary purpose of using Docker in application development?

*A: To create isolated environments for applications

Feedback: Correct! Docker is mainly used to create isolated environments known as containers for
applications.

B: To manage databases efficiently

Feedback: Not quite. Managing databases efficiently is not the primary purpose of Docker.

C: To design user interfaces

Feedback: Incorrect. Docker is not used for designing user interfaces.

D: To handle HTTP requests

Feedback: No, Docker is not used for handling HTTP requests.

Question 207 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

What is the primary purpose of an API in software development?


*A: To enable communication between different software applications

Feedback: Correct! An API allows different software applications to communicate with each other.

B: To compile code into machine language

Feedback: Incorrect. This is the job of a compiler, not an API.

C: To design the user interface of an application

Feedback: Incorrect. Designing the user interface is typically done by a UI/UX designer.

D: To manage the database of an application

Feedback: Incorrect. APIs may interact with databases, but their primary purpose is to enable
communication between software applications.

Question 208 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following best explains a REST API?

*A: A type of API that uses HTTP requests to access and use data

Feedback: Correct! REST APIs use HTTP requests for communication.

B: A library used to design graphical user interfaces

Feedback: Incorrect. This describes a GUI library, not a REST API.

C: A protocol for encrypting data over the internet

Feedback: Incorrect. This describes SSL/TLS protocols, not REST APIs.

D: A database management system

Feedback: Incorrect. A REST API is not a database management system.

Question 209 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which professional certificate focuses on AI application development?

*A: IBM AI Engineering Professional Certificate


Feedback: Great job! This certificate covers various aspects of AI application development, including
machine learning and deep learning.

B: Google Data Analytics Professional Certificate

Feedback: Not quite. This certificate focuses on data analytics, not specifically on AI application
development.

C: AWS Data Engineering Professional Certificate

Feedback: Incorrect. This certificate is more oriented towards data engineering using AWS services.

D: Microsoft Azure AI Fundamentals

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.

Question 210 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which module in Python can be used to handle JSON data in APIs?

*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.

Question 211 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following methods are part of the HTTP protocol?

*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.

Question 212 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Correct! Numpy is a fundamental package for numerical computations in Python.

*C: Matplotlib

Feedback: Correct! Matplotlib is a popular library for creating visualizations in Python.

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.

Question 213 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following are features of microservices architecture?

*A: Decentralized data management

Feedback: Correct! Decentralized data management is a key feature of microservices architecture.

B: Monolithic codebase

Feedback: Incorrect. A monolithic codebase is not a feature of microservices architecture.

*C: Independent deployment

Feedback: Yes! Independent deployment is an important feature of microservices architecture.

D: Tight coupling between services

Feedback: No, microservices architecture emphasizes loose coupling between services.

*E: Scalability

Feedback: Correct! Scalability is one of the significant benefits of microservices architecture.

Question 214 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following tools are used for continuous integration?

*A: Jenkins

Feedback: Correct! Jenkins is a popular tool used for continuous integration.

*B: Travis CI

Feedback: Correct! Travis CI is another tool commonly used for continuous integration.

C: Photoshop

Feedback: Incorrect. Photoshop is not used for continuous integration.


*D: CircleCI

Feedback: Yes! CircleCI is used for continuous integration.

E: Excel

Feedback: No, Excel is not used for continuous integration.

Question 215 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Select the characteristics of REST APIs.

*A: Statelessness

Feedback: Correct! REST APIs are stateless, meaning each request is independent.

B: Stateful communication

Feedback: Incorrect. REST APIs are stateless, not stateful.

*C: Client-server architecture

Feedback: Correct! REST APIs follow a client-server architecture.

*D: Use of HTTP methods

Feedback: Correct! REST APIs use HTTP methods like GET, POST, PUT, and DELETE.

E: Dependence on a single programming language

Feedback: Incorrect. REST APIs are language-agnostic and can be used with any programming
language.

Question 216 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 217 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Correct! POST is used to send data to a server to create/update a resource.

C: FETCH

Feedback: Incorrect. FETCH is not a standard HTTP method.

*D: DELETE

Feedback: Correct! DELETE is used to delete a specified resource.

E: SEND

Feedback: Incorrect. SEND is not a standard HTTP method.

*F: CONNECT

Feedback: Correct! CONNECT is used to establish a tunnel to the server.


Question 218 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

What is the status code for a successful HTTP GET request?

*A: 200.0

Feedback: Correct! 200 is the status code for a successful HTTP GET request.

Default Feedback: Incorrect. Review the lesson on HTTP status codes.

Question 219 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 220 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

In what year was the term REST first introduced?

*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.

Question 221 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 222 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

What is the common port number used for HTTP connections?

*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.

Question 223 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 224 - numeric, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 225 - numeric, easy difficulty

Question category: Module: APIs and Data Collection


What is the default port number for HTTP?

*A: 80.0

Feedback: Correct! The default port number for HTTP is 80.

Default Feedback: Incorrect. Please review the default port numbers for various protocols.

Question 226 - text match, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Correct! BeautifulSoup is widely used for web scraping.

*B: bs4

Feedback: Correct! bs4 is the package name for BeautifulSoup.

Default Feedback: Incorrect. Review the lesson on web scraping libraries in Python.

Question 227 - text match, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 228 - text match, easy difficulty

Question category: Module: APIs and Data Collection


What is the keyword used in Python to define a function? Please answer in all lowercase.

*A: def

Feedback: Correct! The def keyword is used to define a function in Python.

Default Feedback: Incorrect. Remember to review the Python cheat sheet to understand the syntax for
defining functions.

Question 229 - text match, easy difficulty

Question category: Module: APIs and Data Collection

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.

Question 230 - text match, easy difficulty

Question category: Module: APIs and Data Collection

What type of architecture does a REST API follow? Please answer in all lowercase.

*A: client-server

Feedback: Correct! REST APIs follow a client-server architecture.

*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.

Question 231 - text match, easy difficulty

Question category: Module: APIs and Data Collection


What acronym is used to describe an API that follows a set of constraints for communicating over the
internet? Please answer in all lowercase.

*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.

Question 232 - text match, easy difficulty

Question category: Module: APIs and Data Collection

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.

Default Feedback: Incorrect. Please review the material on web scraping.

Question 233 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following are features of REST APIs?

*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

Feedback: Incorrect. REST APIs are designed to be stateless, not stateful.

*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.

Question 234 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which Python library is commonly used for web scraping?

A: Pandas

Feedback: Pandas is used for data manipulation and analysis, not specifically for web scraping.

B: NumPy

Feedback: NumPy is used for numerical computing, not web scraping.

*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.

Question 235 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which professional certificate focuses on the development and deployment of AI applications?

*A: IBM AI Engineering Professional Certificate

Feedback: Correct! This certificate is designed to provide skills in AI application development.

B: Google IT Support Professional Certificate

Feedback: Incorrect. This certificate focuses on IT support skills, not AI application development.

C: SAS Data Science Professional Certificate

Feedback: Incorrect. While this certificate focuses on data science, it does not specifically address AI
application development.

D: Coursera Project Management Professional Certificate


Feedback: Incorrect. This certificate is geared towards project management and does not cover AI
application development.

Question 236 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Incorrect. Docker is used for containerization, not version control.

D: Kubernetes

Feedback: Incorrect. Kubernetes is used for container orchestration, not version control.

Question 237 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following best defines web scraping?

*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.

B: The method of manually copying and pasting data from websites

Feedback: Incorrect. Manually copying and pasting data is not considered web scraping.

C: A technique for storing large amounts of data in a structured format

Feedback: Incorrect. Storing large amounts of data in a structured format is not web scraping.

D: A process used for designing the layout of a website


Feedback: Incorrect. Web scraping is not related to designing the layout of a website.

Question 238 - multiple choice, shuffle, easy difficulty

Question category: Module: APIs and Data Collection

What is an API and its purpose in software development?

*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.

B: An API is a programming language used to build software applications.

Feedback: Incorrect. An API is not a programming language; it's a set of rules for communication
between software entities.

C: An API is a type of database used to store application data.

Feedback: Incorrect. An API is not a database; it allows functions and applications to interact with each
other.

D: An API is a kind of operating system.

Feedback: Incorrect. An API is not an operating system; it's a set of rules for software interaction.

Question 239 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

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

Feedback: Correct! Pandas is essential for data manipulation and analysis.

*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.

Question 240 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Select all the tools that are commonly used for continuous integration and continuous deployment
(CI/CD).

*A: Jenkins

Feedback: Correct! Jenkins is widely used in CI/CD pipelines.

*B: Travis CI

Feedback: Correct! Travis CI is a popular CI/CD tool.

C: Photoshop

Feedback: Incorrect. Photoshop is an image editing tool, not used for CI/CD.

*D: CircleCI

Feedback: Correct! CircleCI is another tool used for CI/CD.

E: Slack

Feedback: Incorrect. Slack is a communication tool, not used for CI/CD.

*F: Ansible

Feedback: Correct! Ansible can be used for deployment automation in CI/CD pipelines.

Question 241 - checkbox, shuffle, partial credit, easy difficulty

Question category: Module: APIs and Data Collection

Which of the following status codes indicate a successful HTTP request?


*A: 200 OK

Feedback: Correct! The status code 200 OK indicates that the HTTP request has succeeded.

B: 404 Not Found

Feedback: Incorrect. The status code 404 Not Found indicates that the requested resource could not be
found.

C: 500 Internal Server Error

Feedback: Incorrect. The status code 500 Internal Server Error indicates a server error.

*D: 201 Created

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.

Question 242 - checkbox, shuffle, partial credit, medium

Question category: Module: APIs and Data Collection

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.

D: REST APIs require a persistent connection between client and server.

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.

You might also like