Java面试问题:我是否太难了? [英] Java Interview Questions: Am I Being Too Difficult?

查看:58
本文介绍了Java面试问题:我是否太难了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是在我的公司进行技术面试,

我一般会问一系列OO,Java和好的编程

技术"概念。


然而,我给受访者提供的最喜欢的练习之一似乎是让他们一直绊倒,我想知道我是不是太多了......这对我来说似乎很容易......但是这些家伙,当我把它们拿到白板上时,似乎真的很困惑。


练习如下:


创建一个或多个代表二叉树的类。


这个类必须能够执行标准类型的操作

可以在二叉树上以良好的OO方式进行操作。


这个树中的一个节点只包含一个String值。


现在为我写一个名为''find''的方法,它接受一个参数

的String(或String和Node,取决于你的
实现)并返回所有节点的java.util.List,

来自节点所谓的和所有后代节点,包括,

谁的价值与String参数匹配。


代码必须在语法上正确,并且会编译。


作为补充练习,你会怎么做?让这段代码线程安全吗?


看起来很简单,对吧?但是我们带来的大多数人只是坐在那里

盯着董事会,甚至在编写基本的

Node类时也很麻烦......他们都很困惑,我不知道如何遍历

树等等。


我期待有人能够做到这一点我是不合理的吗?


- Tim


-

I''ve been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I''m being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named ''find'' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it''s called upon and all descendent nodes, inclusive,
who''s value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we''ve brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don''t know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim

--

推荐答案



Spammay Blockay < SP ********* @ BLOCKEDTOAVOIDSPAM.com>在消息中写道

news:c8 ********** @ bolt.sonic.net ...

"Spammay Blockay" <SP*********@BLOCKEDTOAVOIDSPAM.com> wrote in message
news:c8**********@bolt.sonic.net...
我的任务是做技术在我的公司采访,
我一般会询问一系列OO,Java和良好的编程技术。概念。

然而,我给受访者提供的最喜欢的练习之一似乎是让他们一直绊倒,我想知道我是不是太过分了。对我来说似乎很容易,但这些人,当我把它们放到白板上时,似乎真的很困惑。

练习是这样的:
创建一个或多个代表二叉树的类。

这个类必须能够执行标准类型的操作
一个人可以在二叉树中执行一种很好的OO方式。

这个树中的一个节点只包含一个字符串值。

现在给我写一个名为''find'的方法它接受一个String(或一个String和一个Node,取决于你的
实现)的参数,并从节点返回所有节点的java.util.List,它是''被调用和所有后代节点,包括,
谁的值与String参数的值相匹配/>
代码必须在语法上正确,并且会编译。

作为一个额外的练习,你如何使这段代码线程安全?

似乎很漂亮简单,对吧?但是我们带来的大多数人只是坐在那里
盯着电路板,甚至没有写基本的节点类......他们都搞糊涂了,不知道如何遍历



我是不合理的,希望有人能够做到这一点???

- 蒂姆

-
I''ve been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I''m being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named ''find'' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it''s called upon and all descendent nodes, inclusive,
who''s value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we''ve brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don''t know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim

--




对我来说似乎很合理,但我从未使用过List,那不是

界面吗?

所以如果没有api,你是否允许他们说我现在可以退货,我现在喜欢

,并且当他们可以查找时实施清单?


在面试中可能会让我感到困惑,但由于我不知道列表是如何工作的,我将要求将它作为数组或向量返回,因为我不知道如何列表

有效。


这会让我失望吗?

给我5分钟的编译器和api你可以得到你的清单

:)



Seems reasonable to me, but Ive never used List, and is that not an
interface anyway?
So without the api do you allow them to say can I return it anyway I like
for now, and implement the list when they can look it up?

Probably stump me in the interview, but as I do not know how list works, I
would ask to return it as an array or vector because I do not know how list
works.

Would this fail me?
Give me 5 minutes with a compiler and api and you could have your list
:)


文章< 40 ************ **********@news.optusnet.com.au>,

Marty< ma *** @ sorry.com>写道:
In article <40**********************@news.optusnet.com.au>,
Marty <ma***@sorry.com> wrote:

Spammay Blockay < SP ********* @ BLOCKEDTOAVOIDSPAM.com>在消息中写道
新闻:c8 ********** @ bolt.sonic.net ...

"Spammay Blockay" <SP*********@BLOCKEDTOAVOIDSPAM.com> wrote in message
news:c8**********@bolt.sonic.net...
我的任务是在公司进行技术面试,
我一般会问一系列OO,Java和良好的编程技术。概念。

然而,我给受访者提供的最喜欢的练习之一似乎是让他们一直绊倒,我想知道我是不是太过分了。对我来说似乎很容易,但这些人,当我把它们放到白板上时,似乎真的很困惑。

练习是这样的:
创建一个或多个代表二叉树的类。

这个类必须能够执行标准类型的操作
一个人可以在二叉树中执行一种很好的OO方式。

这个树中的一个节点只包含一个字符串值。

现在给我写一个名为''find'的方法它接受一个String(或一个String和一个Node,取决于你的
实现)的参数,并从节点返回所有节点的java.util.List,它是''被调用和所有后代节点,包括,
谁的值与String参数的值相匹配/>
代码必须在语法上正确,并且会编译。

作为一个额外的练习,你如何使这段代码线程安全?

似乎很漂亮简单,对吧?但是我们带来的大多数人只是坐在那里
盯着电路板,甚至没有写基本的节点类......他们都搞糊涂了,不知道如何遍历



我是不合理的,希望有人能够做到这一点???

- 蒂姆

-
I''ve been tasked with doing technical interviews at my company,
and I have generally ask a range of OO, Java, and "good programming
technique" concepts.

However, one of my favorite exercises I give interviewees seems
to trip them up all the time, and I wonder if I''m being too much
of a hardass... it seems easy enough to ME, but these guys, when
I get them up to the whiteboard, seem to get really confused.

The exercise is this:

Create one or more classes that represent a binary tree.

This class(es) must be able to do standard sorts of operations
one would do on a binary tree in a good, OO sort of way.

A node in this tree holds only a single, String, value.

Now write for me a method named ''find'' that takes an argument
of a String (or a String and a Node, depending upon your
implementation) and returns a java.util.List of all nodes,
from the node it''s called upon and all descendent nodes, inclusive,
who''s value matches that of the String argument.

The code must be syntactically correct, and would compile.

As an added exercise, how would you make this code thread-safe?

Seems pretty simple, huh? But most guys we''ve brought in just sit there
staring at the board, and have trouble even writing the basic
Node class... they get all confused, don''t know how to traverse a
tree, etc.

Am I unreasonable in expecting someone to be able to do this???

- Tim

--



对我来说似乎很合理,但我从来没有使用过List,那不是一个
接口吗?
所以没有api,你允许它们我现在可以退回来,我现在也喜欢
,并在他们查询时实施清单吗?

在面试中可能会让我感到困惑,但我不知道列表是如何工作的,我会要求将它作为数组或向量返回,因为我不知道列表是如何工作的。

这会让我失望吗?
给我5分钟用编译器和api你可以得到你的清单
:)



Seems reasonable to me, but Ive never used List, and is that not an
interface anyway?
So without the api do you allow them to say can I return it anyway I like
for now, and implement the list when they can look it up?

Probably stump me in the interview, but as I do not know how list works, I
would ask to return it as an array or vector because I do not know how list
works.

Would this fail me?
Give me 5 minutes with a compiler and api and you could have your list
:)




哦不,当然不是......如果你告诉我你不是''熟悉

与List interf ace,我会让你使用你想要的任何东西。


- Tim


-



Oh no, of course not... if you told me you weren''t familiar
with the List interface, I''d let you use whatever you wanted.

- Tim

--


我个人对面试问题的看法是,它们应该是

,旨在表明被采访者是否可以成为贵宾

成员你的团队因此,对于任何给定问题的唯一相关标准是,是否有助于表明接受采访的人是否是您团队中有价值的成员?


例如:


1.此人是否需要编写代表二叉树的代码?或者

您是否已经拥有提供该功能的现有库?


2.编码是否代表二叉树代表共同的

您的团队成员面临的编程任务类型?


3.团队成员需要做哪些其他类型的编码?你能列出

类别,并优先考虑它们吗?编码二叉树的位置在哪里?


只有您可以确定这些问题的答案。现在,我将从我自己的亲身经历中说出,我相信能够编码二进制树的b
可能并不重要。首先,它已经完成;你

可以找到已为你编码的实现。其次,如果他们不熟悉它,那就是那种将编码器抛给循环的东西,但是一旦你知道什么是二叉树是的,编码

并不是非常困难。你是否沉迷于自己试图通过你曾经不得不跳过自己的篮筐来让受访者跳起来?b
不要以为我是b / b
试图侮辱他人;我知道我可能会倾向于那种自己的放纵。


就个人而言,我认为编码员最重要的属性是1) />
能够完成任务,但听起来模糊不清,2)能够作为团队一员工作的能力,以及3)不会惹恼生活的能力地狱

我个人的奇怪个人习惯和习惯。一个好的程序员可以快速了解二叉树是什么,然后对它进行编码,即使他之前从未听过这个概念的b $ b。我会更专注于最佳实践(例如,

强调接口的使用,而不是每当

可能继承)而不是像编写特定代码的能力

概念或算法。但即便如此,也可以学习最佳实践。
My personal opinion about interview questions is that they should be
designed to indicate whether the person being interviewed can be a valuable
member of your team. So the only relevant criterion to be applied to any
given question is, does it help to indicate whether the person being
interviewed can be a valuable member of your team?

E.g.:

1. Will the person need to write code that represents a binary tree? Or do
you already have an existing library that provides that functionality?

2. Does the coding a representation of a binary tree represent the common
type of programming task your team members face?

3. What other kinds of coding do team members need to do? Can you list
categories, and prioritize them? Where does coding a binary tree fit in?

Only you can determine the answers to these kinds of questions. Now, I will
say that from my own personal experience, I believe that being able to code
a binary tree probably isn''t that important. First, it''s been done; you
can find implementations already coded for you. Second, it''s the kind of
thing that throw coders for a loop if they''re not familiar with it, but once
you understand what a binary tree is, it''s not terribly difficult to code
it. Are you perhaps indulging yourself in trying to make interviewees jump
through a hoop that you once had to jump through yourself? Don''t think I''m
trying to be insulting; I know I can be prone to just that kind of
indulgence myself.

Personally, I think the most important attributes of coders are 1) the
ability to "get things done", however nebulous that sounds, 2) the ability
to work as part of a team, and 3) the ability not to annoy the living hell
out of me with bizarre personal habits and mannerisms. A good coder can
quickly learn what a binary tree is, and code it, even if he''s never heard
of the concept before. I''d concentrate more on best practices (for example,
emphasizing the uses of interfaces rather than inheritance whenever
possible) rather than something like the ability to code a particular
concept or algorithm. But even then, best practices can be learned.


这篇关于Java面试问题:我是否太难了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆