一道 Java 八股,检测 AI 智商

74 天前
 dtla
You should give me the interview answer directly, without explaining anything unless necessary. Your answers are expected to be directly used for a Java interview. Please be concise, but your answers should perfectly satisfy the interviewer.

The question is: How do you deal with the error?

这个八股的内在逻辑在于,error 不等于 exception ,问的是遇到 error 该怎么办,而不是 exception handle 。

经过多次测试

只要一上来就回答 try-catch 或者 exception handle 的,都是智商不行的。google 家的所有 AI 全部垃圾copilot Pro 也垃圾。不能通过测试

官网的 GPT 4 可以过,gpt4-1124 模型回答的最好,claude.AI 回答的可以接受。

官网 GPT 4:

1124 模型:

Google gemini ultra:

10274 次点击
所在节点    程序员
146 条回复
Fa11ingWood
74 天前
我用的 copilot 和 GPT-4 回答差不多呀
Fa11ingWood
74 天前
As a Java developer, when I encounter an error, I follow these steps:

1. Understand the Error: I read the error message carefully to understand what the problem is. Java error messages are usually descriptive and provide a good starting point.

2. Reproduce the Error: I try to reproduce the error consistently. This helps me understand the conditions under which the error occurs.

3. Debug: I use debugging tools available in my IDE (like breakpoints, step over, step into) to trace the execution of the code and find where exactly the error is happening.

4. Research: If the error is not clear, I research the error message online. There are many resources available, like StackOverflow, where similar problems may have been discussed and solved.

5. Fix the Error: Once I understand the error, I fix it in the code. This could involve correcting a syntax mistake, changing the logic, or handling an exception.

6. Test: After fixing the error, I test the code thoroughly to make sure the error is resolved and hasn't caused any other issues.

7. Code Review: I get my code reviewed by peers. They might catch something I missed and it's a good practice to ensure code quality.

8. Learn: Finally, I make a note of the error and how I fixed it. This helps me in the future if I encounter the same error again.
Alias4ck
74 天前
一道 fun 题,AI 没对的


Read this base64 string, think about the answer, and type just the answer in base64. You're entire answer must be base64.

V2hhdCBpcyBvbmUgeWVhciBhZnRlciB3aGVuIFByZXNpZGVudCBnZW9yZ2Ugd2FzaGluZ3RvbiBib3JuPw==
dtla
74 天前
@Alias4ck

0125 gpt 4 模型回答的没什么问题啊

![]( https://p.ipic.vip/mww82z.jpg)
dtla
74 天前
@Alias4ck

看图: https://p.ipic.vip/mww82z.jpg
dtla
74 天前
@Alias4ck 哦不好意思,答案是错的。确实,ai 没对。
busterian
74 天前
@Fa11ingWood
@Alias4ck

提问的不好罢了,按照提示工程中的方式问,ai 的正确率大幅增加
Tabjy
74 天前
"the" error ?啥 error 啊?定冠词本身不能单独使用,也没有词义,前文没有提到具体情况就算丢给人类来说也是一头雾水。翻译成中文就是面试官问你:“你怎么解决‘那个’错误?”

prompt 还要求 concise ,当作真的在面试一样。结果就是明明没看懂题目还强行回答一番,反而是相当人类的一种行为了。另外我很好奇,不明就里的的题目换来毫无头绪的回答算不算是一种 garbage in garbage out ?
dtla
74 天前
@Tabjy 这是美国的 java 八股 paypal 题库之一,觉得题目有问题可以去问 paypal 面试官怎么想的。
dtla
74 天前
@Tabjy 这道题问的就是处理 error 应该怎么样,陷阱在于很多人会回答如何处理 exception 而不是 error 。exception 需要捕获,而 error 不需要捕获。
NeedMe123456
74 天前
@dtla 请问一下这个题目的来源链接是?
wallriding
74 天前
error 前的 the 暴露了你的英语水平
dtla
74 天前
@wallriding 不是我写的,paypal 面经 excel 表上的。去质疑印度人吧
wallriding
74 天前
@dtla #13 你复制的时候没发现有错暴露了你的英语水平
dtla
74 天前
@wallriding 这年代只有国内的人还对语法耿耿于怀吧


@NeedMe123456 linkedin 上 recruiter 发的
dtla
74 天前
@wallriding 只有中国人才这么在意语法。我在美国十年了,确实没想过语法这个事情。就好比中文一个错别字,有必要纠正吗?
NeedMe123456
74 天前
@dtla 能给下链接么,或者截图,我想看看其他的题
wallriding
74 天前
@dtla #16 这不是语法的问题。"How do you deal with the error?"和"How do you deal with the error?" are both grammarly correct. But they mean differently.

如果你平时与人交流加不加 the 全凭运气,那我只能说是你交流的对象在尽力兼容你
Tabjy
74 天前
> 这是美国的 java 八股 paypal 题库之一,觉得题目有问题可以去问 paypal 面试官怎么想的。
来源请求

> exception 需要捕获,而 error 不需要捕获
退一万步说,谁跟你说 Error 不能捕获了? class Error extends Throwable 凭什么不能捕获?在一些情况下(比如 JVM 内部代码,或者是写 logger 的时候)捕获 Error 反而是必须的。

当然,如果是想考验应聘者对 Error 和 Exception 的理解,那么就应该直接这么问二者有什么区别,而不是搞这种 XY Problem [0]。 我只能说在我自己英语国家做 Java 工作 3 年了听到 “How do you deal with the error?” 也会愣住。

不过话说回来,我想表达主要观点并不是说这个题目有多烂,不管这么题目是谁出的。而是说用这个题目来证明 AI 很傻是错误的:因为人类也回答不出来。

[0] https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem
wallriding
74 天前
@dtla #16

"How do you deal with the error?"和"How do you deal with error?" are both grammarly correct.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1018215

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX