Which of the following sorting algorithms is most efficient for small-sized data sets?

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
Insertion sort is the most efficient sorting algorithm for small-sized data sets. It has a simple implementation and performs well when the number of elements is small. Other sorting algorithms like Quick Sort and Merge Sort are more efficient for larger data sets.

Which Pandas function is used to read a CSV file into a DataFrame?

  • read_csv()
  • read_excel()
  • read_json()
  • read_sql()
The correct function to read a CSV file into a DataFrame in Pandas is read_csv(). It's used to load data from a CSV (Comma-Separated Values) file into a tabular data structure.

Which Python built-in function will you use to sort a list of numbers in ascending order?

  • arrange()
  • order()
  • sort()
  • sorted()
To sort a list of numbers in ascending order, you should use the sorted() function. The sort() method is used for in-place sorting, whereas sorted() returns a new sorted list, leaving the original list unchanged.

Which Python data structure is suitable for storing multiple data types and allows duplicate elements?

  • Dictionary
  • List
  • Set
  • Tuple
In Python, a list is a versatile data structure that can store multiple data types and allows duplicate elements. Lists are ordered and mutable, making them suitable for a wide range of use cases.

Which Python entity is primarily affected or modified by a metaclass?

  • Classes
  • Functions
  • Modules
  • Variables
Metaclasses primarily affect or modify classes. They define how classes themselves are created and behave, allowing you to add, modify, or replace class attributes and methods.

Which Python feature would you use to modify the behavior of a function or method?

  • Decorators
  • Encapsulation
  • Inheritance
  • Polymorphism
In Python, decorators are used to modify the behavior of functions or methods. They allow you to add functionality to existing code without modifying its structure. Decorators are often used for tasks like logging, authentication, and more.

Which Python framework allows you to integrate Python back-end code with HTML, CSS, and JavaScript for web development?

  • Bottle
  • Django
  • Flask
  • Pyramid
Flask is a micro web framework for Python that allows you to integrate Python back-end code with HTML, CSS, and JavaScript to build web applications. Django, Pyramid, and Bottle are also Python web frameworks, but Flask is known for its simplicity and flexibility, making it suitable for beginners.

Which Python keyword is primarily used in generator functions to yield values?

  • break
  • continue
  • return
  • yield
The yield keyword is used in generator functions to yield values one at a time. It allows the function to pause its execution state and resume it when the next value is requested, making generators memory-efficient and suitable for iterating over large datasets.

Which Python keyword is used to define a base class?

  • class
  • inherit
  • parent
  • superclass
In Python, the class keyword is used to define a class, including a base class (parent class). You create a base class by defining a class using the class keyword.

Which library would you primarily use for implementing linear regression in Python?

  • Matplotlib
  • NumPy
  • Pandas
  • Scikit-learn
Scikit-learn is a powerful library in Python for machine learning, including linear regression. While NumPy, Pandas, and Matplotlib are essential for data manipulation and visualization, Scikit-learn provides tools for regression tasks, making it the primary choice for linear regression.