现在的位置: 首页 > 综合 > 正文

阿尔卡特笔试题目之二

2013年09月02日 ⁄ 综合 ⁄ 共 3540字 ⁄ 字号 评论关闭

Part A是一些你的知识技能调查
Part B全是通信方面的东西,不会做了,题目都没看完
Part C是Computer Sience的东西。
前3道是选择题,很easy
1、用A[1...n]模拟栈,A[n]是栈底,当A[T]是当前栈顶时,POP操作后,当然栈顶是什么http://blog.csdn.net/weiweitj/archive/2008/04/27/2336067.aspx
2、假设二叉树的根是为0层,那么第i层最多有几个节点?2^(k-1)
3、以下各项那项是结构化编程语言不允许的
a if-else b loop-while,for c goto d function
4、给出软件生存周期图

一个软件从定义到开发、使用和维护,直到最终被弃用,要经历一个漫长的时期,通常把软件经历的这个漫长的时期称为生存周期。软件生存周期一般可分为 以下阶段:问题定义、需求分析与可行性研究、设计、编码、测试、运行与维护。软件生存期也可以分为三个大的阶段:计划阶段。开发阶段和维护阶段。

5、C的Structure和C++ 的class的什么不同之处

初始化、默认继承权限、默认访问权限
6、什么是virtual函数,为什么使用virtual函数
7、填空完成ip v4协议表头
8、你认为造成软件 crash的主要原因是什么,怎么预防?
9、用C自己写一个string copy函数

char* strcpy(char* strDest, const char* strSrc)
{
    assert(NULL 
!= strDest);   
    assert(NULL 
!= strSrc);
    
char *tmp= strDest;
    
while("0" != (*tmp++ = *strSrc++));
        return strDest;
}

10、写一个双向链表的插入函数(from luocong)

template<typename T>
inline 
int CDList<T>::InsertBefore(const int pos, const T data)
{
    
int i;
    
int nRetPos;
    CNode
<T> *pTmpNode;
    CNode
<T> *pNewNode;

    pNewNode 
= new CNode<T>;
    
if (NULL == pNewNode)
    
{
        nRetPos 
= 0;
        
goto Exit0;
    }


    pNewNode
->data = data;

    
// if the list is empty, replace the head node with the new node.
    if (NULL == m_pNodeHead)
    
{
        pNewNode
->prior = NULL;
        pNewNode
->next = NULL;
        m_pNodeHead 
= pNewNode;
        m_pNodeTail 
= pNewNode;
        nRetPos 
= 1;
        
goto Exit1;
    }


    
// is pos range valid?
    ASSERT(1 <= pos && pos <= m_nCount);

    
// insert before head node?
    if (1 == pos)
    
{
        pNewNode
->prior = NULL;
        pNewNode
->next = m_pNodeHead;
        m_pNodeHead
->prior = pNewNode;
        m_pNodeHead 
= pNewNode;
        nRetPos 
= 1;
        
goto Exit1;
    }


    
// if the list is not empty and is not inserted before head node,
    
// seek to the pos of the list and insert the new node before it.
    pTmpNode = m_pNodeHead;
    
for (i = 1; i < pos; ++i)
    
{
        pTmpNode 
= pTmpNode->next;
    }

    pNewNode
->next = pTmpNode;
    pNewNode
->prior = pTmpNode->prior;

    pTmpNode
->prior->next = pNewNode;
    pTmpNode
->prior = pNewNode;

    
// if tail node, must update m_pNodeTail
    if (NULL == pNewNode->next)
    
{
        m_pNodeTail 
= pNewNode;
    }


    nRetPos 
= pos;

Exit1:
    
++m_nCount;
Exit0:
    
return nRetPos;
}


template
<typename T>
inline 
int CDList<T>::InsertAfter(const int pos, const T data)
{
    
int i;
    
int nRetPos;
    CNode
<T> *pNewNode;
    CNode
<T> *pTmpNode;

    pNewNode 
= new CNode<T>;
    
if (NULL == pNewNode)
    
{
        nRetPos 
= 0;
        
goto Exit0;
    }


    pNewNode
->data = data;

    
// if the list is empty, replace the head node with the new node.
    if (NULL == m_pNodeHead)
    
{
        pNewNode
->prior = NULL;
        pNewNode
->next = NULL;
        m_pNodeHead 
= pNewNode;
        m_pNodeTail 
= pNewNode;
        nRetPos 
= 1;
        
goto Exit1;
    }


    
// is pos range valid?
    ASSERT(1 <= pos && pos <= m_nCount);

    
// if the list is not empty,
    
// seek to the pos of the list and insert the new node after it.
    pTmpNode = m_pNodeHead;
    
for (i = 1; i < pos; ++i)
    
{
        pTmpNode 
= pTmpNode->next;
    }


    pNewNode
->next = pTmpNode->next;
    pNewNode
->prior = pTmpNode;

    
// if NewNode's position is m_pNodeTail, update m_pNodeTail
    if (pTmpNode->next == m_pNodeTail)
    
{
        m_pNodeTail
->prior = pNewNode;
    }


    pTmpNode
->next = pNewNode;

    
// if tail node, must update m_pNodeTail
    if (NULL == pNewNode->next)
    
{
        m_pNodeTail 
= pNewNode;
    }


    nRetPos 
= pos + 1;

Exit1:
    
++m_nCount;
Exit0:
    
return nRetPos;
}

 

Part D (optional)
给出你认为贝尔会感兴趣的topic

我只做了Part C,那个ip v4也忘了,后面也就没兴趣做下去

抱歉!评论已关闭.