IT评测·应用市场-qidao123.com

标题: 【模拟面试】盘算机考研复试集训(第二天) [打印本页]

作者: 大号在练葵花宝典    时间: 2025-3-13 10:51
标题: 【模拟面试】盘算机考研复试集训(第二天)

媒介

今天是模拟面试系列第二天,为各人精心预备了 5 道经典面试题、2 道英文口语题和 2 道算法题上机题,涵盖复试中常见的观察点,助你从容应对考官提问!
一、专业面试

1、OSI 参考模型和 TCP/IP 模型的主要区别是什么?简述各层功能

OSI 模型分为 7 层:

TCP/IP 模型分为 4 层:

主要区别 :


2、什么是瀑布模型?其优缺点是什么?

定义 :瀑布模型是线性开辟模型,分为:需求分析 → 系统设计 → 编码 → 测试 → 维护,阶段间严格顺序且文档驱动。
优点 :流程清楚,易于管理;文档规范,得当需求明确的项目。
缺点 :难以应对需求变更;测试阶段晚,早期问题难以发现;不得当复杂或需求模糊的项目。
3、什么是递归?使用时需注意什么?

定义 :递归是函数直接或间接调用自身,需满足递归边界 (终止条件)和递归公式 (分解子问题)。
注意事项 :栈溢出风险(递归深度过大);重复盘算问题(需优化,如记忆化)。
4、监督学习与无监督学习的核心区别是什么?请举例阐明典型算法

核心区别 :

典型算法举例 :

5、你在项目中遇到过哪些技术挑衅?是如何解决的?

在开辟XX项目时,我遇到了XX问题(如性能瓶颈、兼容性问题)。
起首,我通过查阅文档/调试日志/团队讨论定位到根本原因(如数据库查询服从低)。
然后,我尝试了XX方法(如添加索引、优化算法),并通过A/B测试验证效果。
最终,系统性能提升了XX%,并总结出XX经验(如提前性能测试的告急性)。
二、英文口语

1、Can you tell us about a time you worked in a team and faced challenges? How did you handle it?

您能否跟我们讲讲您曾身处团队之中并遭遇挑衅的经历?您又是如何应对的?
   “During a group project at university, our team had conflicting ideas about the project direction. I facilitated a discussion to ensure everyone’s opinions were heard, and we eventually reached a consensus by combining the best aspects of each idea. This experience taught me the importance of communication and collaboration in teamwork.”
 
“在大学的一个小组项目中,我们对项目方向有分歧。我组织了一次讨论,确保每个人的意见都被听到,最终我们联合了各自想法中的优点告竣共识。这次经历让我认识到沟通和协作在团队合作中的告急性。”
  2、Explain the term ‘Big O Notation’ in algorithm analysis.

解释算法分析中 “大 O 表示法” 这一术语。
   “Big O Notation is a mathematical concept used to describe the performance or complexity of an algorithm. It represents the worst-case scenario of how the runtime or space requirements grow as the input size increases. For example, O(n) means the algorithm’s complexity grows linearly with the input size.”
 
“Big O Notation 是一种用于形貌算法性能或复杂性的数学概念。它表示算法在最坏环境下,运行时间或空间需求随输入规模增长的厘革趋势。例如,O(n) 表示算法的复杂度随输入规模线性增长。”
  三、算法上机

1、倒序输出一个四位整数

输入一个四位正整数,然后按数字的相反序次输出。
如:输入 9187,则输出 7819;
又如:若输入为 7000,则输出为 0007。
要求:只能用一个整型变量接收键盘输入。
代码实现
  1. #include <bits/stdc++.h>
  2. #include <algorithm>
  3. using namespace std;
  4. int reverseN(int n) {
  5.         // 非法检测
  6.         if (n < 1000 || n > 9999) {
  7.                 return 0;
  8.         }
  9.        
  10.         // result 用于存储反转后的结果,p 是权重(初始为 1000)
  11.         int result = 0, p = 1000;
  12.         for (int i = 0; i < 4; i++) {
  13.                 result += n % 10 * p; // 将 n 的最后一位乘以权重 p,加到 result 中
  14.                 p /= 10;  // 权重 p 缩小 10 倍            
  15.                 n /= 10;  // 去掉 n 的最后一位
  16.         }
  17.         return result;
  18. }
  19.                           
  20. int main()
  21. {
  22.         int n;
  23.         scanf("%d", &n);
  24.        
  25.         int ret = reverseN(n);
  26.        
  27.         printf("%04d", ret);
  28.        
  29.         return 0;
  30. }
复制代码
循环 4 次(因为 n 是 4 位数):

2、提取字符串中的数字

输入一个字符串,内有数字和非数字字符,如:b56x6g*6454er790v,将其中一连的数字作为一个长整型数依次存入数组 a 中,例如:56 存入 a[0] 中,6 存入 a[1] 中,6454 存入 a[2] 中,统计共有多少个整数,并通过数组 a 输出这些整数。(假设一连的数字作成的长整型数不存在溢出环境)。
注:若字符串中存在字符 -(减号),且厥后为数字,则该数字应看作负数。
代码实现
  1. #include <bits/stdc++.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. using namespace std;
  5. int func(char str[], long int arr[]) {
  6.         int len = strlen(str); // 获取字符串长度
  7.         int cnt = 0, temp = 0, index = 0; // cnt: 当前数字字符个数,temp: 当前数字的值,index: arr 的索引
  8.         int op; // 用于判断是否有负号
  9.        
  10.         for (int i = 0; i < len; i++) {
  11.                 if (str[i] == '-')
  12.                         op = i; // 记录负号的位置
  13.                
  14.                 if (str[i] >= '0' && str[i] <= '9') { // 如果当前字符是数字
  15.                         temp = temp * 10 + str[i] - '0'; // 将字符转换为数字并累加
  16.                         cnt++; // 数字字符个数加 1
  17.                        
  18.                         // 如果下一个字符不是数字,则当前数字结束
  19.                         if (!(str[i+1] >= '0' && str[i+1] <= '9')) {
  20.                                 arr[index] = temp; // 将当前数字存入数组
  21.                                 if (op == i - cnt) // 如果负号在当前数字的前面
  22.                                         arr[index] = -arr[index]; // 将数字变为负数
  23.                                 temp = 0;
  24.                                 index++;
  25.                                 cnt = 0;
  26.                         }
  27.                 }
  28.         }
  29.        
  30.         return index;
  31. }
  32.                
  33. int main()
  34. {
  35.         char str[256];
  36.         scanf("%s", str);
  37.         long int arr[100];
  38.        
  39.         int n = func(str, arr);
  40.        
  41.         for (int i = 0; i < n; i++)
  42.                 printf("%ld ", arr[i]);
  43.        
  44.         return 0;
  45. }
复制代码
遍历字符串:


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 IT评测·应用市场-qidao123.com (https://dis.qidao123.com/) Powered by Discuz! X3.4