Articul8 AI OA – Coderbyte 平台 – 真题记录 – 一亩三分地 – OA代写 – OA代做

选择题部分:

  1. What should the <FUNCTION> below be called to set up a new object?
class Student:
def (self, name):
self.name = name
  • init
  • construct
  • _init
  • main

  1. What is the abc module used for?
  • It provides functionalities for abstract classes.
  • It provided common word parsing functions.
  • It provides functionalities for alphabet and string manipulation.

  1. What does the expression range(5, 15, 3) in Python generate?
  • A sequence of numbers starting from 5 to 14, incremented by 3 each time (5, 8, 11, 14).
  • A sequence of numbers starting from 3 to 14, incremented by 5 each time (3, 8, 13).
  • A sequence of numbers starting from 5 to 15, incremented by 3 each time (5, 8, 11, 14, 17).
  • A sequence of numbers starting from 3 to 15, incremented by 5 each time (3, 8, 13, 18).

  1. What is the purpose of torch.nn.Module in PyTorch?
  • It is a base class for all neural network modules.
  • It is a class for handling tensor operations.
  • It is a class for storing dataset information.
  • It is a class for handling all sorts of matrix operations.

  1. Describe the memory management mechanism used by Python, including its primary features and how it differs from traditional memory management in languages like C or C++.
  • Python uses manual memory management, where developers must explicitly allocate and deallocate memory for objects. This approach provides more control and efficiency compared to automatic memory management used in languages like Java or C#.
  • Python relies on a stack-based memory management system, similar to how memory is managed in languages like C or C++. This system allocates memory in a linear fashion and releases it in a last-in, first-out (LIFO) order.
  • Python uses a private heap to manage memory, which is a data structure that keeps track of all the objects and data in a Python program.
  • In Python, memory management is handled by the operating system, which allocates memory blocks as needed and releases them when they are no longer in use.

  1. In PyTorch, how can you move all parameters and buffers of a model to a GPU?
  • By using the torch.cuda.move() function
  • By using the .gpu() method of the model
  • By passing the model to the torch.cuda.Tensor() function
  • By using the .cuda() or .to(device) method of the model

  1. Which metric is used to evaluate the performance of a regression model in scikit-learn?
  • Area Under Curve (AUC)
  • F1-Score
  • Mean Squared Error (MSE)
  • Accuracy

  1. What is the effect of calling .zero_grad() on an optimizer in PyTorch?
  • It initializes the gradients of all optimized parameters
  • It sets the learning rate of the optimizer to zero
  • It resets the internal state of the optimizer
  • It sets the gradients of all optimized parameters to zero

  1. Explain the concept of inheritance in Python, including its purpose, how it’s implemented, and how it differs from composition.
  • Inheritance in Python allows a class to define its own attributes and methods independently of other classes, providing encapsulation and modularity. It’s implemented by creating a new class and specifying the base class using the "extends" keyword.
  • Inheritance in Python allows a class to inherit attributes and methods from another class, enabling code reuse and the creation of hierarchies. It’s implemented by defining a new class that extends an existing class using the syntax class NewClass(BaseClass):.
  • Inheritance in Python is more flexible than composition, where objects are composed of other objects, allowing for more flexibility and reusability.

  1. What command is used to create a Docker image?
  • docker compile
  • docker build
  • docker create
  • docker make

  1. In Docker, what command is used to list all running containers?
  • docker list
  • docker running
  • docker ps
  • docker containers

  1. What is the Docker command to stop a running container?
  • docker stop [container_id]
  • docker pause [container_id]
  • docker kill [container_id]

代码题部分

1. Statistics Challenge

You are provided with a dataset containing personal attributes of individuals. Some columns, notably Eye Color and Height, have missing values. Your task is to implement mode imputation for the Eye Color column and KNN imputation for the height column. For the KNN imputation, use the features of Weight and Age to better estimate missing height values. Do not scale the features before using them. Use KNNImputer from sklearn.impute with the following settings:

  • n_neighbors: 5
  • weights: 'uniform'
  • metric: 'nan_euclidean'

When imputing height values, please round the values to one decimal place. After performing the imputations, print the processed data as a list of lists, where each inner list represents an individual's data.


2. Machine Challenge

In the Python file, write a PyTorch program to create a 2-dimensional tensor of size 5x5, initialized with random values between -1 and 1. Be sure to set the torch seed to 0.

Next, compute this tensor’s singular value decomposition (SVD) using the torch.svd() function and square each of the singular values to compute the eigenvalues of the original tensor and print it. Finally, convert the eigenvalues to a Python list and print it.


3. Moving Median Challenge

Write a program that returns the Moving Median for each element based on the element and its N-1 predecessors, where N is the sliding window size. The final output should be a string with the moving median corresponding to each entry in the original array separated by commas.

Note that for the first few elements (until the window size is reached), the median is computed on a smaller number of entries. For example:
if arr = [3, 1, 3, 5, 1, 0, 6, 4, 3, 1] then your program should output 1,2,3,5,6,6,4,3

我们长期稳定承接各大科技公司如TikTok、Google、Amazon等的OA笔试代写服务,确保满分通过。如有需求,请随时联系我们。

We consistently provide professional online assessment services for major tech companies like TikTok, Google, and Amazon, guaranteeing perfect scores. Feel free to contact us if you're interested.

Leave a Reply

Your email address will not be published. Required fields are marked *