廣東北電面試題

時間:2024-08-11 02:10:52 學人智庫 我要投稿
  • 相關推薦

廣東北電面試題

  下面是廣東北電的筆試題(中英文題),這套題早已在網絡上流傳數年,從來只見題目,不見解答,那就讓我做做吧。英文搞得不對的地方那就沒辦法了。

廣東北電面試題

  一:英文題。

  1. Tranlation (Mandatory)

  CDMA venders have worked hard to give CDMA roaming capabilities via the development of RUIM-essentially, a SIM card for CDMA handsets currently being deployed in China for new CDMA operator China Unicom. Korean cellco KTF demonstrated earlier this year the ability to roam between GSM and CDMA using such cards.However,only the card containing the user’s service data can roam-not the CDMA handset or the user’s number (except via call forwarding).

  翻譯:CDMA開發商一直致力于RUIM卡的開發,以此賦予CDMA漫游的能力。RUIM卡類似于SIM卡,事實上目前它已經被中國的CDMA運營商中國聯通廣泛使用。韓國手機制造企業KTF今年早些時候展示了使用此種卡在GSM和CDMA網絡中漫游的功能,但是,只有該卡包含的用戶服務數據能夠漫游,CDMA手機本身及用戶號碼則不能(除了呼叫前轉業務)。

  呵呵。上文可能翻譯的不太精準,歡迎批評。

  2. Programming (Mandatory)

  Linked list

  a. Implement a linked list for integers,which supports the insertafter (insert a node after a specified node) and removeafter (remove the node after a specified node) methods;

  b. Implement a method to sort the linked list to descending order.

  答:題目的意思是實現一個整型鏈表,支持插入,刪除操作(有特殊要求,都是在指定節點后進行操作),并寫一個對鏈表數據進行降序排序的方法。

  那我們不妨以一個線性鏈表進行編程。

  // 單鏈表結構體為

  typedef struct LNode

  {

  int data;

  struct LNode *next;

  }LNode, *pLinkList;

  // 單鏈表類

  class LinkList

  {

  private:

  pLinkList m_pList;

  int m_listLength;

  public:

  LinkList();

  ~LinkList();

  bool InsertAfter(int afternode, int data);//插入

  bool RemoveAfter(int removenode);//刪除

  void sort();//排序

  };

  實現方法

  //insert a node after a specified node

  bool LinkList::InsertAfter(int afternode, int data)

  {

  LNode *pTemp = m_pList;

  int curPos = -1;

  if (afternode > m_listLength ) // 插入點超過總長度

  {

  return false;

  }

  while (pTemp != NULL) // 找到指定的節點

  {

  curPos++;

  if (curPos == afternode)

  break;

  pTemp = pTemp->next;

  }

  if (curPos != afternode) // 節點未尋到,錯誤退出

  {

  return false;

  }

  LNode *newNode = new LNode; // 將新節點插入指定節點后

  newNode->data = data;

  newNode->next = pTemp->next;

  pTemp->next = newNode;

  m_listLength++;

  return true;

  }

  //remove the node after a specified node

  bool LinkList::RemoveAfter(int removenode)

  {

  LNode *pTemp = m_pList;

  int curPos=-1;

  if (removenode > m_listLength) // 刪除點超過總長度

  {

  return false;

  }

  // 找到指定的節點后一個節點,因為刪除的是后一個節點

  while (pTemp != NULL)

  {

  curPos++;

  if (curPos == removenode+1)

  break;

  pTemp = pTemp->next;

  }

  if (curPos != removenode) // 節點未尋到,錯誤退出

  {

  return false;

  }

  LNode *pDel = NULL; // 刪除節點

  pDel = pTemp->next;

  pTemp->next = pDel->next;

  delete pDel;

  m_listLength--;

  return true;

  }

  //sort the linked list to descending order.

  void LinkList::sort()

  {

  if (m_listLength<=1)

  {

  return;

  }

  LNode *pTemp = m_pList;

  int temp;

  // 選擇法排序

  for(int i=0;i

  for(int j=i+1;j

  if (pTemp[i].data

  {

  temp=pTemp[i].data;

  pTemp[i].data=pTemp[j].data;

  pTemp[j].data=temp;

  }

  }

  前兩個函數實現了要求a,后一個函數sort()實現了要求b

  3. Debugging (Mandatory)

  a. For each of the following recursive methods, enter Y in the answer box if the method terminaters (assume i=5), Otherwise enter N.

  (題目意思:判斷下面的遞歸函數是否可以結束)

  static int f(int i){

  return f(i-1)*f(i-1);

  }

  Ansewr: N,明顯沒有返回條件語句,無限遞歸了

  static int f(int i){

  if(i==0){return 1;}

  else {return f(i-1)*f(i-1);}

  }

  Ansewr:Y,當i=0時可結束遞歸

  static int f(int i){

  if(i==0){return 1;}

  else {return f(i-1)*f(i-2);}

  }

  Ansewr:N,因為i=1時,f(i-2)=f(-1),進入一個無限遞歸中

  b. There are two errors in the following JAVA program:

  static void g(int i){

  if(i==1){return;}

  if(i%2==0){g(i/2);return;}

  else {g(3*i);return;}

  }

  please correct them to make sure we can get the printed-out result as below:

  3 10 5 16 8 4 2 1

  答:在第一個if語句前加 System.out.print(i+" ");

  else 里面的g(3*i)改為g(3*i+1)

【廣東北電面試題】相關文章:

Microsoft面試題09-04

iOS面試題07-10

公司面試題09-12

hibernate面試題10-18

英語面試題精選06-13

小升初面試題06-10

PHP面試題10-14

小升初面試題型08-24

小升初面試題類型07-23

關于網管面試題07-27

国产v亚洲v天堂无码网站,综合亚洲欧美日韩一区二区,精品一级毛片A久久久久,欧美一级待黄大片视频
中文字幕乱码免费不卡精品 | 久热re6在线精品视频 | 亚洲国产一区二区三区最新 | 日韩一区二区精品视频在线观看 | 亚洲精品线路一在线观看 | 日韩性色一区二区三区 |