[問題] 公司考題 (觀念題??)
這是一家公司給我的題目
30 int * someIDs, theFirst, *r;
110 someIDs =GetSomeIDs(); /* defined below */
111 theFirst = someIDs [0];
112 r= ReorderIDs(someIDs);
113-150 /* we want to use 'theFirst' and 'r' here*/
499 /*-------- GetSomeIDs-----*/
500 int * GetSomeIDs()
501 {
502 int ids[8];
503-550 /* The ids are defined here */
551 return ids;
552 }
Q1: Is there a different way to write line 500 which preserves
the same effective prototype? If so, what is it?
我回答: Yes, we can replace int * by void GetSomeIDs(int *ids).
In that case, we don't need to re-declare int ids in line 502
and no need line 551.
結果公司給我個 hint 如下:
they are looking for an equivalent way to write line #500,
maintaining the same prototype
可是我看完他的hint 我還是不懂他是要我用啥寫法取代 int * GetSomeIDs()...囧
Q2: What will 'theFirst' contain after line 111 is executed?
Is this deterministic? Why?
這個問題我回答 'theFirst' 是不是 deterministic 要看GetSomeIDs()
裡面的寫法才能決定
結果公司說the answer is ‘deterministic’要我解釋why....
這邊我該如何解釋 'theFirst' 一定是 deterministic?
(其實我還是覺得不一定是 deterministic....=.=a...)
------------------------------------------------------
這測試 是那公司的HR寄了 差不多15題的題目給我回答 大概給3天時間
可以上網或翻書 查任何需要的資料(但要付上來源)
不過不能把題目直接po到網路~XD 他們查到就取消面試資格
我還真的有看到 有人把整分題目都po到網路問人...結果公司的人看到
在下面回他 他違反他簽的同意書 所以要把他的資格取消....
所以基本上我google過了 類似的問題,但還是沒辦法回答他們要的答案..>_<..
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 128.206.251.162
→
04/04 04:53, , 1F
04/04 04:53, 1F
→
04/04 07:47, , 2F
04/04 07:47, 2F
→
04/04 07:48, , 3F
04/04 07:48, 3F
推
04/04 10:20, , 4F
04/04 10:20, 4F
推
04/04 10:31, , 5F
04/04 10:31, 5F
→
04/04 10:42, , 6F
04/04 10:42, 6F
→
04/04 10:44, , 7F
04/04 10:44, 7F
→
04/04 10:46, , 8F
04/04 10:46, 8F
→
04/04 12:27, , 9F
04/04 12:27, 9F
→
04/04 12:28, , 10F
04/04 12:28, 10F
→
04/04 12:28, , 11F
04/04 12:28, 11F
→
04/04 12:29, , 12F
04/04 12:29, 12F
→
04/04 13:42, , 13F
04/04 13:42, 13F
→
04/04 14:14, , 14F
04/04 14:14, 14F
→
04/04 14:14, , 15F
04/04 14:14, 15F
→
04/04 14:20, , 16F
04/04 14:20, 16F
→
04/04 14:20, , 17F
04/04 14:20, 17F
→
04/04 14:32, , 18F
04/04 14:32, 18F
→
04/04 14:33, , 19F
04/04 14:33, 19F
→
04/05 01:41, , 20F
04/05 01:41, 20F
→
04/05 03:14, , 21F
04/05 03:14, 21F
推
04/05 03:55, , 22F
04/05 03:55, 22F
→
04/05 03:56, , 23F
04/05 03:56, 23F
→
04/05 13:24, , 24F
04/05 13:24, 24F
→
04/05 13:25, , 25F
04/05 13:25, 25F
→
04/05 13:26, , 26F
04/05 13:26, 26F
→
04/05 13:27, , 27F
04/05 13:27, 27F
→
04/05 13:56, , 28F
04/05 13:56, 28F
推
04/05 17:01, , 29F
04/05 17:01, 29F
→
04/05 17:55, , 30F
04/05 17:55, 30F
→
04/05 17:57, , 31F
04/05 17:57, 31F
→
04/05 23:41, , 32F
04/05 23:41, 32F
推
04/06 05:30, , 33F
04/06 05:30, 33F
→
04/06 05:31, , 34F
04/06 05:31, 34F
→
04/06 07:36, , 35F
04/06 07:36, 35F
→
04/06 07:38, , 36F
04/06 07:38, 36F
推
04/07 02:34, , 37F
04/07 02:34, 37F
推
04/09 23:06, , 38F
04/09 23:06, 38F
→
04/09 23:07, , 39F
04/09 23:07, 39F
討論串 (同標題文章)