- Học kỳ
- SU2026
- Thời Gian
- 26/7/26
- Loại tài liệu
- FE
PDS301m SU26 FE
1. (Choose 1 answer)
What is the Output of the following code? for x in range(0.5, 5.5, 0.5): print(x)
A. [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5]
B. [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
C. Error: The Program executed with errors
D. [1, 2, 3, 4, 5]
2. (Choose 1 answer)
What is a correct syntax to add the lables "x", "y", and "z" to a Pandas Series?
A. pd.Series(mylist, lables = ["x", "y", "z"])
B. pd.Series(mylist, index = ["x", "y", "z"])
C. pd.Series(mylist, names = ["x", "y", "z"])
D. pd.Series(mylist, keys = ["x", "y", "z"])
3. (Choose 1 answer)
Which method do you use to find all <div> elements with the HTML class "card-content" within a BeautifulSoup object?
A. .find("div", class_="card-content")
B. .select_all("div.card-content")
C. .find_all("div", class_="card-content")
D. .find_all("div", class="card-content")
4. (Choose 1 answer)
What is a correct syntax to create a Pandas DataFrame?
A. pd.df(data)
B. pd.DataFrame(data)
C. pd.dataframe(data)
D. pd.makeDataFrame(data)
5. (Choose 1 answer)
For the Pandas head() method, how many rows are returned by default, if you do not specify it?
A. 5
B. 0
C. 10
D. 1
6. (Choose 1 answer)
What is the output of the following display() function call? def display(**kwargs): for i in kwargs: print(i) display(emp="Kelly", salary=9000)
A. Error
B. Kelly 9000
C. ('emp', 'Kelly') ('salary', 9000)
D. emp salary
7. (Choose 1 answer)
What is a correct syntax to create an array of type float?
A. arr = np.array([1, 2, 3, 4], dtype='f')
B. arr = np.float([1, 2, 3, 4])
C. arr = np.array([1, 2, 3, 4]).toFloat()
D. arr = np.array.float([1, 2, 3, 4])
8. (Choose 1 answer)
What does this code do?
url = "You do not have permission to view link Đăng nhập hoặc Đăng ký."
response = urllib.request.urlopen(url)
result = json.loads(response.read())
A. Scrapes all astronaut images
B. Fetches live data about astronauts in space
C. Tracks ISS orbit in real time
D. Downloads the JSON schema
9. (Choose 1 answer)
What is the purpose of the if __name__ == "__main__": block?
A. It defines a global variable
B. It marks the beginning of a class definition
C. It ensures that the code inside this block only runs when the script is executed directly
D. It is used for multi-threading
10. (Choose 1 answer)
What will this code return if the request is successful?
import requests
response = requests.get("You do not have permission to view link Đăng nhập hoặc Đăng ký.")
print(response.status_code)
A. 404
B. 500
C. 200
D. None
11. (Choose 1 answer)
What is the output of the following code?
names = {'Vicki', 'Jodi', 'Garry', 'Eric'}
print(names[1])
A. {'Vicki', 'Jodi', 'Garry', 'Eric'}
B. {'Jodi', 'Garry', 'Eric', 'Vicki'}
C. The program executed with error
D. {'Eric', 'Vicki', 'Jodi', 'Garry'}
12. (Choose 1 answer)
What will be the output of the following Python code? x = 5 def update_x(): global x x = 10 update_x() print(x)
A. 5
B. 10
C. Error (Cannot assign to global variable)
D. None
13. (Choose 1 answer)
What is the correct syntax to output the type of a variable or object in Python?
A. print(typeof(x))
B. print(type(x))
C. print(typeOf(x))
D. print(typeof x)
14. (Choose 1 answer)
What is the purpose of the pass statement in Python?
A. It acts as a comment.
B. It skips the current iteration of a loop.
C. It is a null operation; nothing happens when it executes.
D. It terminates the program
15. (Choose 1 answer)
What is the correct file extension for Python files?
A. .py
B. .pyth
C. .pyt
D. .pt
16. (Choose 1 answer)
Which of the following for loop correctly iterates through my_list and prints each element?
A. for i in 3: print(my_list)
B. for i in range(len(my_list)): print(my_list)
C. for my_list: print(my_list)
D. All of the above
17. (Choose 1 answer)
What will be the output of the following Python code? for i in range(3): print(i * 2, end=" ")
A. 0 1 2
B. 0 2 4
C. 0 2 6
D. 0 1 2 3 4 5
18. (Choose 1 answer)
Select which is True for Python function
A. A function only executes when it is called and we can reuse it in a program
B. A function can take an unlimited number of arguments.
C. A Python function can return multiple values.
D. All of the above
19. (Choose 1 answer)
Which status code means your API request was unauthorized due to missing or invalid credentials?
A. 400
B. 403
C. 401
D. 500
20. (Choose 1 answer)
What is a correct syntax to create a Pandas Series from a Python list?
A. pd.createSeries(mylist)
B. pd.Series(mylist)
C. pd.getSeries(mylist)
D. pd.makeSeries(mylist)
21. (Choose 1 answer)
What will be the output of the following Python code? numbers = [1, 2, 3, 4, 5] squared_numbers = list(map(lambda x: x*x, numbers)) print(squared_numbers)
A. [1, 4, 9, 16, 25]
B. [1, 2, 3, 4, 5]
C. Error
D. Null
22. (Choose 1 answer)
What is a correct syntax to return the index of all items that has the value 4 from the array below: arr = np.array([1,4,3,4,5,4,4])?
A. np.where(arr == 4)
B. arr.search(4)
C. arr.where()
D. np.find(arr == 4)
23. (Choose 1 answer)
Only one of the following statements is true when it comes to Views in NumPy, which one?
A. The view SHOULD be affected by the changes made to the original array.
B. The view SHOULD NOT be affected by the changes made to the original array.
C. The view creates a completely new copy of the original array in memory.
D. The view can only be created using the copy() method.
24. (Choose 1 answer)
What does the response.json() method return in Python's requests module?
A. The raw string of the response
B. A dictionary from the JSON response
C. An XML document
D. List of headers
25. (Choose 1 answer)
What is a correct syntax to return the first 20 rows of a DataFrame?
A. df.head(20)
B. df.start(20)
C. df.row(20)
D. df.top(20)
26. (Choose 1 answer)
What is the output of the following code? p, q, r = 10, 20,30 print(p, q, r)
A. 10 20
B. 10 20 30
C. Error: invalid syntax
D. 10 20 30 40
27. (Choose 1 answer)
Which one is NOT a legal variable name?
A. my-var
B. _myvar
C. my_var
D. Myvar
28. (Choose 1 answer)
What is the data type of print(type(0xFF))?
A. number
B. hexint
C. hex
D. int
29. (Choose 1 answer)
What is a correct method to split arrays?
A. array_split()
B. All the other 3 answers are correct
C. hstack()
D. vstack()
30. (Choose 1 answer)
What is the output of the following code? def calculate (num1, num2=4): res = num1 * num2 print(res) calculate(5, 6)
A. 20
B. The program executed with errors
C. 30
D. 40
31. (Choose 1 answer)
What is a correct method to remove duplicates from a Pandas DataFrame?
A. df.drop_duplicates()
B. df.remove_duplicates()
C. df.duplicates()
D. df.delete_duplicates()
32. (Choose 1 answer)
Which of the following is NOT a valid variable name in Python?
A. _my_variable
B. myVariable
C. 2myvariable
D. my_variable2
33. (Choose 1 answer)
What is the correct Pandas function for loading JSON files into a DataFrame?
A. read_json()
B. read_file()
C. ReadJSON()
D. ReadFile()
34. (Choose 1 answer)
What does the zip() function do when used with loops?
A. It concatenates multiple lists into one.
B. It combines corresponding elements from multiple iterables into tuples.
C. It creates a compressed archive of iterables.
D. It shuffles the elements of an iterable.
35. (Choose 1 answer)
Which of the following is an example of an ethical use of web scraping?
A. Scraping price comparison data for competitive analysis
B. Scraping private user data from social media platforms
C. Scraping financial records from a bank's website
D. Scraping personal emails without consent
36. (Choose 1 answer)
What is a correct method to find relationships between column in a DataFrame?
A. df.corr()
B. df.relation()
C. df.correlation()
D. df.rel()
37. (Choose 1 answer)
What would be the answer of this cummulative summation in NumPy? arr = np.array([1,2,3])
print(np.cumsum(arr))
A. [6]
B. [9]
C. [1 3 6]
D. [3 6 9]
38. (Choose 1 answer)
What is a correct syntax to mathematically add the numbers of arr1 to the numbers of arr2?
A. np.append(arr1, arr2)
B. sum(arr1, arr2)
C. np.add(arr1, arr2)
D. np.combine(arr1, arr2)
39. (Choose 1 answer)
What is a correct syntax to output "Hello World" in Python?
A. p("Hello World")
B. echo "Hello World"
C. console.log("Hello World")
D. print("Hello World")
40. (Choose 2 answers)
What can you pass as an argument to Beautiful Soup methods to filter elements based on their text content?
A. A dictionary
B. A string
C. A function
D. A BeautifulSoup object
41. (Choose 1 answer)
When using the Pandas dropna() method, what argument allows you to change the original DataFrame instead of returning a new one?
A. dropna(original = True)
B. dropna(inplace = True)
C. dropna(keep = True)
D. dropna(update = True)
42. (Choose 1 answer)
If my_string = "hello", what happens when you try to execute my_string[0] = 'H'?
A. The string becomes "Hello".
B. A new string "Hello" is created and my_string refers to it.
C. A TypeError is raised
D. The character at index 0 remains 'h'
43. (Choose 1 answer)
Which popular third-party Python library can you use to fetch HTML content from a website?
A. http.client
B. Beautiful Soup
C. Requests
D. urllib
44. (Choose 1 answer)
What will be the output of the following Python code? sum_val = 0 for i in range(1, 4): for j in range(1, 3): sum_val += 1 print(sum_val)
A. 6
B. 3
C. 9
D. 12
45. (Choose 1 answer)
What is the output of print(bool(0))?
A. True
B. False
C. None
D. Error
46. (Choose 1 answer)
Which of the following data types is mutable in Python?
A. int
B. tuple
C. str
D. list
47. (Choose 1 answer)
What will be the output of the following Python code? my_dict = {'a': 1, 'b': 2} my_dict['c'] = 3 my_dict['a'] = 10 print(my_dict['a'])
A. 1
B. 10
C. Error
D. {'a': 10, 'b': 2, 'c': 3}
48. (Choose 1 answer)
Why is using an API generally more stable than scraping the information from a website?
A. APIs are updated more frequently than websites
B. APIs provide data in a more human-readable format
C. APIs are designed to be consumed by programs
D. APIs require less internet bandwidth
49. (Choose 1 answer)
What is the output of the following code? x = 10 y = 3 print(x // y)
A. 3
B. 1
C. 0
D. 3.33
50. (Choose 1 answer)
What is the correct Pandas function for loading CSV files into a DataFrame?
A. read_csv()
B. ReadCSV()
C. read_file()
D. ReadFile()
Đính kèm
-
pds301m_su26_fe_01.webp21.7 KB · Lượt xem: 0 -
pds301m_su26_fe_02.webp24 KB · Lượt xem: 0 -
pds301m_su26_fe_03.webp26.3 KB · Lượt xem: 0 -
pds301m_su26_fe_04.webp18.7 KB · Lượt xem: 0 -
pds301m_su26_fe_05.webp15.3 KB · Lượt xem: 0 -
pds301m_su26_fe_06.webp22.8 KB · Lượt xem: 0 -
pds301m_su26_fe_07.webp20.7 KB · Lượt xem: 0 -
pds301m_su26_fe_08.webp28.4 KB · Lượt xem: 0 -
pds301m_su26_fe_09.webp25.5 KB · Lượt xem: 0 -
pds301m_su26_fe_10.webp20.6 KB · Lượt xem: 0 -
pds301m_su26_fe_11.webp22.9 KB · Lượt xem: 0 -
pds301m_su26_fe_12.webp19.8 KB · Lượt xem: 0 -
pds301m_su26_fe_13.webp18.8 KB · Lượt xem: 0 -
pds301m_su26_fe_14.webp22.2 KB · Lượt xem: 0 -
pds301m_su26_fe_15.webp12.8 KB · Lượt xem: 0 -
pds301m_su26_fe_16.webp22.5 KB · Lượt xem: 0 -
pds301m_su26_fe_17.webp16 KB · Lượt xem: 0 -
pds301m_su26_fe_18.webp24.8 KB · Lượt xem: 0 -
pds301m_su26_fe_19.webp16.4 KB · Lượt xem: 0 -
pds301m_su26_fe_20.webp20 KB · Lượt xem: 0 -
pds301m_su26_fe_21.webp21.6 KB · Lượt xem: 0 -
pds301m_su26_fe_22.webp21.3 KB · Lượt xem: 0 -
pds301m_su26_fe_23.webp35.2 KB · Lượt xem: 0 -
pds301m_su26_fe_24.webp21.1 KB · Lượt xem: 0 -
pds301m_su26_fe_25.webp16.7 KB · Lượt xem: 0 -
pds301m_su26_fe_26.webp16.6 KB · Lượt xem: 0 -
pds301m_su26_fe_27.webp13.1 KB · Lượt xem: 0 -
pds301m_su26_fe_28.webp13.1 KB · Lượt xem: 0 -
pds301m_su26_fe_29.webp15.9 KB · Lượt xem: 0 -
pds301m_su26_fe_30.webp19.4 KB · Lượt xem: 0 -
pds301m_su26_fe_31.webp20 KB · Lượt xem: 0 -
pds301m_su26_fe_32.webp16.5 KB · Lượt xem: 0 -
pds301m_su26_fe_33.webp17.3 KB · Lượt xem: 0 -
pds301m_su26_fe_34.webp26.5 KB · Lượt xem: 0 -
pds301m_su26_fe_35.webp28.9 KB · Lượt xem: 0 -
pds301m_su26_fe_36.webp17.1 KB · Lượt xem: 0 -
pds301m_su26_fe_37.webp17.6 KB · Lượt xem: 0 -
pds301m_su26_fe_38.webp20.3 KB · Lượt xem: 0 -
pds301m_su26_fe_39.webp18.4 KB · Lượt xem: 0 -
pds301m_su26_fe_40.webp20.2 KB · Lượt xem: 0 -
pds301m_su26_fe_41.webp24.6 KB · Lượt xem: 0 -
pds301m_su26_fe_42.webp23.7 KB · Lượt xem: 0 -
pds301m_su26_fe_43.webp17.7 KB · Lượt xem: 0 -
pds301m_su26_fe_44.webp17.7 KB · Lượt xem: 0 -
pds301m_su26_fe_45.webp12.3 KB · Lượt xem: 0 -
pds301m_su26_fe_46.webp13.3 KB · Lượt xem: 0 -
pds301m_su26_fe_47.webp18.6 KB · Lượt xem: 0 -
pds301m_su26_fe_48.webp28.8 KB · Lượt xem: 0 -
pds301m_su26_fe_49.webp13.3 KB · Lượt xem: 0 -
pds301m_su26_fe_50.webp17 KB · Lượt xem: 0