关注我们,每周发布最新的笔面试题目和解析
前言
申请完Datathon后就会发OA,时间60min 15道选择题,题目相较以往有一些变化,但是不多,整体不算难,以数理统计、机器学习和python编程为主,下面给个汇总版。外资也有很多不错的选择,同学们可以内资、外资一起投,找实习的时候可以多尝试些不同的方向,寻找适合自己并且感兴趣的,为秋招做准备。
春招和暑期实习和笔试也陆陆续续开始了,欢迎同学们在公众号后台留言投稿,你们的每条留言小编都会仔细查看,投稿一场完整笔试的同学有机会获得一杯奶茶的现金奖励,累计投稿三场将免费加入知识星球。
题目1
In Python, which of the following gives the correct order, from first to last, of scope resolution?
A. local function, enclosing function, global statements, built-in names
B. local function, global statements, built-in names, enclosing function
C. built-in names, global statements, local function, enclosing function
D. built-in names, global statements, enclosing function, local function
E. local function, global statements, enclosing function, built-in names
【参考答案】A
在Python中,变量的作用域解析遵循LEGB规则,这表示查找变量时,Python会按照以下顺序进行:局部(Local)作用域、封闭(Enclosed)作用域、全局(Global)作用域和内置(Built-in)作用域。
题目2
In Python, if you had to iteratively read over two files line-by-line, which of the following would be the BEST way to accomplish this task?
A. Use with open () to open the two files as f1 and f2 then use readline() and a for loop to iteratively read lines from each file
B. Use open () to open the two files as f1 and f2, then use readline() and a for loop to iteratively read lines from each file
C. Use with open () to open the two files as f1 and f2, then use zip() to iterate over the two files together
D. Use open () to open the two files as f1 and f2, then use zip() to iterate over the two files together
E. Implement a file seek () function and call the function for the two files simultaneously
【参考答案】C
选项C是最佳选择,因为它利用了with语句来确保文件在使用后能够正确关闭,并且使用zip()函数同时迭代两个文件,这使得可以方便地逐行比较或处理两个文件的内容。与仅使用open()的B和D选项相比,with语句提供了更好的资源管理。而A和B虽然也能达到逐行读取文件的目的,但它们没有提供同时处理两个文件的简洁方式。E选项提出的方法并不是处理这种情况的标准或最佳做法。
题目3
In Python, which of the following statements are true?:
• I. The pipe module can be used to run shell commands in a program • Il. A pickle can store any Python object except tuples in string format • Ill. If you have a Python program called player.py, then you can import the module by running import player. py
A. l and Il only
B. I and Ill only
C. Il and Ill only
D. I, Il, and Ill
E. None of A through D
【参考答案】E
I. Python中并没有一个叫做pipe的标准模块用来运行shell命令。虽然Python可以通过其他方式(如subprocess模块)执行shell命令,但没有直接叫做pipe的模块。
II. pickle模块可以存储几乎所有Python对象,包括元组。其主要限制不是不能存储元组,而是它不能存储一些不能序列化的对象,如文件句柄、数据库连接等。因此,这个陈述是不正确的。
III. 在Python中导入模块时,不应包含文件扩展名.py。正确的导入语句应该是import player,而不是import player.py。因此,这个陈述也是不正确的。
题目4
Suppose you are given a highway congestion dataset with one feature - the average vehicle speed. It is found that if the average speed is above 70 kilometers per hour, then there are no accidents on the highway. However, if the average speed is below 70 kilometers per hour, then there is at least one accident on the highway. You would like to build a classifier for this problem using support vector machines (SVM). Your colleague suggests that this approach could be problematic due to imbalances in the distribution of vehicle speeds. Is your colleague correct, and why or why not?
A. Your colleague is correct - a SVM's performance will suffer because of the reason he mentioned
B. Your colleague is incorrect - SVMs assign greater weights to the data near the boundary so will perform fine
C. Your colleague is correct - SVMs are bad at classifying traffic-related data in general
D. Your colleague is incorrect - although linear VMs will perform poorly, radial basis VMs will perform fine
E. None of the above
【参考答案】B
SVM的核心思想是找到一个最优的决策边界(或超平面),这个边界能够最大化不同类别之间的间隔。在本例中,"平均速度高于70公里/小时没有事故"与"平均速度低于70公里/小时有事故"之间存在一个清晰的分界线,即平均速度等于70公里/小时。SVM特别擅长处理这种类型的问题,因为它会自动调整模型参数,使得边界附近的点(即支持向量)对模型的影响最大。这意味着,尽管数据的分布可能在不同的速度区间内有所不平衡,SVM通过其优化过程能够有效地处理这一点,因此你的同事对于SVM性能可能受到影响的担忧是不成立的。
题目5
3% of a country's population has a particular disease. The national health institute has developed a test for this disease: the test has a 98% "true positive" rate (the probability that a person will test positive given that they have the disease). However, it also has a 4% "false positive" rate (the probability that a person will test positive given that they do NOT have the disease). If you simultaneously take the test twice, and it comes out with two positive results, which of the following is CLOSEST to the probability that you actually have the disease, assuming the tests are independent?
A. 0.96
B. 0.95
C. 0.94
D. 0.93
E. 0.92
【参考答案】B
这个问题可以通过应用贝叶斯定理来解决,考虑到患病人口的比例、测试的真阳性率和假阳性率。
题目6
What is the MAIN advantage of using a random forest over a decision tree?
A. It can be parallelized
B. It captures non-linear decision boundaries
C. It allows for batch learning
D. It reduces overfitting
E. It uses less memory
【参考答案】D
随机森林是一种集成学习方法,通过结合多个决策树的预测来提高模型的准确性和稳定性。每棵树在训练时使用的是随机抽取的数据集的子集以及随机选择的特征,这种方法有助于减少模型对训练数据的过度拟合。
题目7
You have a dataset with two features, employee _age (range of 20 to 60) and annual_salary (range of 50,000 to 500,000). Which of the following situations is MOST likely to occur if you feed the dataset as is to a K - means clustering algorithm?
A. The data will be appropriately clustered
B. The program will run out of memory due to the large annual_salary values
C. There will be numerical overflows due to the large annual_salary values
D. The clusters will not be meaningful due to the disparity between the variances of the two features
E. None of the above
【参考答案】D
K-均值聚类算法在处理特征尺度差异较大的数据时可能会遇到问题,因为算法在计算距离时可能会过分强调数值范围较大的特征。在这个例子中,年薪的范围(50,000到500,000)远大于年龄的范围(20到60),这可能导致聚类结果过分依赖于年薪特征,而忽略了年龄特征。因此,如果不对数据进行适当的规范化或标准化处理,聚类结果可能不会有意义。这并不意味着程序会因为年薪值较大而内存不足或出现数值溢出,也不意味着数据不能被聚类,而是指聚类结果可能不会反映数据的真实结构。
题目8
Which of the following machine learning algorithms is NOT sensitive to the initial variables used in the optimization algorithm?
A. Hidden Markov models
B. Artificial neural networks
C. Random forests
D. Support vector machines
E. k - nearest neighbors
【参考答案】E
k-最近邻(k-NN)算法的工作原理是在特征空间中查找最接近的k个邻居,然后根据这些邻居的标签来决定新数据点的标签。因为k-NN算法直接基于数据点之间的距离进行操作,而不需要训练过程中的优化算法,所以它不依赖于初始变量。
题目9
Which of the following assumptions is NOT necessary when performing multiple linear regression with homoskedastic errors?
A. The distribution of errors is normal
B. The variables are continuous
C. The variables are uncorrelated
D. The error variance is constant across sample data
E. The sample data are independent
【参考答案】B
在进行多元线性回归分析时,有几个核心假设需要考虑,但变量必须是连续的并不是其中之一。实际上,多元线性回归可以处理连续和/或分类变量作为预测变量。关键的假设包括误差项具有常数方差(同方差性),误差项之间相互独立,以及误差分布近似正态分布等。而变量之间不相关的假设是指预测变量之间不应该存在完全的多重共线性。因此,变量是否连续并不影响多元线性回归模型的基本假设要求,尤其是在考虑具有同方差误差的情况下。
题目10
You have two fair coins and one coin with heads on both sides. You pick a coin at random and toss it twice. If it reads heads both times, what is the probability it also reads heads after a third toss?
A. 1/6
B. 1/3
C. 1/2
D. 2/3
E. 5/6
【参考答案】E
题目11
A government office has two officers handling people's requests. Suppose that the time between request arrivals at the first officer's desk is random and follows an exponential distribution withλ=μ1lambda=mu_1 . Similarly, the time between request arrivals at the second officer's desk is also random and follows an exponential distribution with λ=μ2lambda=mu_2 . The first officer has probability P1P_1 of referring any request he receives to the office supervisor, and the second officer has probability P2P_2 of doing so. What is the average time between requests referred to the supervisor?
A. P1/μ1 P2/μ2P_1/mu_1 P_2/mu_2
B. (P1 P2)/(μ1 μ2)(P_1 P_2) / (mu_1 mu_2)
C. 1/(μ1P1 μ2P2)1/(mu_1P_1 mu_2P_2)
D. 1/μ1P1 1/μ2P21/mu_1P_1 1/mu_2P_2
E. None of the above
【参考答案】C
题目12
Consider a function f(x,y)f(x, y) of two variables xx and yy . Which of the following statements is ALWAYS true? Here, maxkmax_k and minkmin_k , refer to the maximum over kk and the minimum over kk respectively.
A. maxx,minyf(x,y)=minymaxxf(x,y)max_x,min_y f(x, y) = min_ymax_xf(x, y)
B. maxx,minyf(x,y)≤minymaxxf(x,y)max_x,min_y f(x, y) leq min_ymax_xf(x, y)
C. maxx,minyf(x,y)≥minymaxxf(x,y)max_x,min_y f(x, y) geq min_ymax_xf(x, y)
D. maxx,minyf(x,y)<minymaxxf(x,y)< span="">max_x,min_y f(x, y) < min_ymax_xf(x, y)
E. None of the above, because the answer depends on the specific functional form of f
【参考答案】B
这个陈述基于最小化和最大化操作的属性。当你首先对一个变量取最大值,然后对另一个变量取最小值,你可能限制了自己只能访问函数的一个较小的值范围。相反,如果你首先对一个变量取最小值,然后对另一个变量取最大值,这通常允许你访问函数值的一个更大范围。因此,第一个操作(先最大化,再最小化)得到的结果通常不会超过第二个操作(先最小化,再最大化)的结果,这是因为第二个操作在优化过程中考虑了更广泛的可能性。
题目13
Suppose you have NN samples drawn from NN independent and identical distributions. You use the method of Maximum Likelihood Estimators to estimate the true parameters ΘTheta governing these distributions, and it gives you parameters ΘTheta . Which of the following statements is true?
A. As NN grows asymptotically large, ΘTheta becomes an unbiased estimator for ΘTheta
B. As NN grows asymptotically large, no other unbiased estimator of ΘTheta can achieve a strictly smaller mean squared error value on the sample than ΘTheta does
C. ΘTheta tends to be normally distributed for large sample sizes
D. If the MLEs for Θ1Theta_1 , Θ2Theta_2 are Θ1,Θ2Theta_1, Theta_2 , respectively, then the MLE of any function of Θ1,Θ2Theta_1, Theta_2 is that same function with Θ1,Θ2Theta_1, Theta_2 as arguments instead
E. All of the above
【参考答案】E
A选项正确,因为最大似然估计(MLE)在样本数量趋向于无限大时,成为无偏估计器,意味着它的期望值等于真实参数值Θ。
B选项也正确,根据Cramér-Rao下界,任何无偏估计器的方差都不会小于通过MLE得到的估计器的方差,在大样本极限下,MLE达到了这个下界。
C选项正确,根据中心极限定理,大样本量下的MLE估计量倾向于正态分布,这是因为它可以被看作多个独立随机变量的和(或平均),每个变量都贡献了对参数估计的信息。
D选项也正确,这是估计量不变性的一个例子,意味着如果Θ1, Θ2是通过最大似然估计得到的参数,那么Θ1, Θ2的任何函数的最大似然估计就是该函数以Θ1, Θ2作为参数。这一性质是最大似然估计特有的特性之一。
题目14
A space probe is controlled by 7 different instructions from the ground. The probabilities of sending these instructions vary - the three most common instructions have probabilities 1/2. 1/4, and 1/8 of being sent, respectively. The remaining four instructions are equally likely to be sent. In expectation, what is the minimum number of whole number bits required to communicate with the probe?
A. 2
B. 3
C. 4
D. 5
E. 6
【参考答案】A
题目15
15. An alternative to k - means clustering is k - medoids clustering. This algorithm chooses actual data points as centers, as opposed to choosing centroids (the mean of data points in a cluster) as centers. Which of the following BEST describes why the k - mediods algorithm is often used over the k - means
algorithm?
• I. The k - medoids algorithm runs faster than the k - means algorithm does
• I. The k - medoids algorithm is more robust to outliers than the k - means algorithm is
• Ill. It is easier to choose the value of k in the k - mediods algorithm than in the k - means algorithm
A. I only
B. lI only
C. Ill only
D. I and Il only
E. ll and Ill only
【参考答案】B
k-medoids算法相比于k-means算法的一个主要优势是它对异常值更加鲁棒。因为k-medoids选取实际的数据点作为簇的中心(称为medoids),而这些medoids对异常值不那么敏感,所以当数据包含异常值时,k-medoids能够提供更稳定的聚类结果。与此相反,k-means通过计算簇内所有点的平均值来确定簇中心,这会使得结果对异常值非常敏感,因为异常值会显著影响平均值。
关于运行速度,k-medoids算法通常不比k-means快,实际上由于需要在数据点中寻找medoids,它可能会更慢。同时,选择k的值对于两种算法来说都是一个挑战,没有一种算法在这方面明显更容易。因此,II是描述k-medoids算法相对于k-means算法优势的正确答案。
题目16
A bag contains one fair coin, two two-headed coins, and three two-tailed coins. Each of the six coins is flipped, but the outcomes of five of the coins are hidden from you. randomly. If the outcome you see is heads, what is the probability that the fair coin (which may or may not be the coin that was shown to you) landed heads up?
A. 1/5
B. 2/5
C. 1/2
D. 3/5
E. 4/5
【参考答案】B
题目17
Marty has a bar of gold. Marty's friend Shea is to be paid this gold over the course of 15 days, such that on day XX , 0<=X<=150 <= X <= 15 , Shea has exactly X/15X/15 of the total gold. Additionally, on day 0, Shea has no available gold to use as change. What is the MINIMUM number of pieces that Marty must break the gold bar into so that he can pay Shea in this way?
A. 4
B. 5
C. 7
D. 8
E. 15
【参考答案】A
分金条问题,只需将金条分成4块(1/15, 2/15, 4/15, 和8/15),就可以确保在每一天按照要求支付给谢伊,同时避免任何时候需要从谢伊那里找零。因此,马蒂最少需要将金条分成4块。
其他思路或想法欢迎在留言区交流补充
最后介绍一下我们的知识星球
一个专门为那些寻求在量化投资、数据科学和机器学习领域内深度学习与交流交流的专业人士和爱好者设计的社群。创建这个星球,目的是为了沉淀有价值的内容,构建一个质量更高、更专注的学习和交流环境,从而帮助每一位成员提升自己。
在这个知识星球里,你将获得:
1.实习/校招/社招笔面试经验交流与分享:包含学习路线、准备笔面试的规划、方法、技巧等,同时提供全市面最全的真题资料,帮助你充分准备,助力你成为offer收割机。
2.专业知识与技能提升:
数据处理与分析:分享如何处理和分析数据,包括使用最新的工具和技术,以及数据清洗和预处理的最佳实践。
量化策略:深入量化交易的世界,学习如何从零开始设计、测试和优化你的量化策略。提供丰富的案例和实践指导,帮助你打造出稳健的交易模型
因子挖掘:分享如何在庞大的数据海洋中发现影响市场的隐藏因素。将因子分析融入量化策略,增强模型的预测能力。
组合优化:介绍如何通过组合优化提高投资组合的性能,包括风险管理和资产配置的策略。
交易系统开发:分享交易系统的开发过程,从系统架构设计到实现,包括API接口的使用、自动化交易的实现等。
高性能计算:分享如何应用高性能计算技术处理大规模数据集,提高计算效率
3.不定期行业大咖分享:邀请量化投资与机器学习领域的行业专家,分享他们的知识、见解和经验。
4.编程技巧与算法知识:不定期分享编程技巧、算法知识、学习方法和个人心得,帮助成员更有效地规划时间和学习路径。
5.大厂面试内推渠道:实时发布大厂面试内推信息,为你的职业发展提供支持。
我们致力于打造一个全面、高效且互帮互助的社群。无论你是量化投资和机器学习领域的初学者,还是已有深厚背景的专业人士,这里都将是你学习新知识、分享经验、扩展人脉的理想之地。