1.    Please specify what does “func()” do with the list "pParam", and what are the errors.

struct LIST 

    int nValue; 
    struct LIST * pPrev; 
    struct LIST * pNext; 
}; 
struct LIST * func(struct LIST * pParam) 

    struct LIST* pCur = pParam; 
    struct LIST* pNext; 
    struct LIST* pPrev = NULL; 
    struct LIST* pTail; 
    struct LIST* pReturn = NULL;

if (pCur == NULL) 
    { 
        return pReturn; 
    } 
    else 
    { 
        pPrev = pCur->pPrev; 
        if (pCur->pNext == NULL) 
        { 
             pReturn = pCur; 
        } 
        else 
        { 
             pReturn = pCur->pNext; 
        } 
    }

while (pCur != NULL) 
    { 
        pNext = pCur->pNext; 
        if (pNext == NULL) 
        { 
            return pReturn; 
        } 
        else 
        { 
            pTail = pNext->pNext;

pNext->pPrev = pPrev; 
            pNext->pNext = pCur; 
            pCur->pPrev = pNext; 
            if (pTail == NULL) 
            { 
                pCur->pNext = pTail; 
            } 
            else 
            { 
                if (pTail->pNext == NULL) 
                { 
                    pCur->pNext = pTail; 
                } 
                else 
                { 
                    pCur->pNext = pTail->pNext; 
                } 
            } 
        }

pPrev = pCur; 
        pCur = pTail; 
    }

return pReturn; 

2.    Please complete the standard C function: memmove(), here is the description (don’t use any C standard function): 
void * memmove (void *to, const void *from, unsigned int size) 
memmove copies the size bytes at from into the size bytes at to. The value returned by memmove is the value of to. 
3.    please complete this function, get binary tree’s depth. For example, the following binary tree’s depth is 4. The function returns depth. 
   1 
/     \ 
2    3 
     /       \ 
   4          5 
/     \ 
6        7

struct NODE 

    struct NODE* pLeft;        // pLeft is NULL if it has no left sub node 
    struct NODE* pRight;    // pRight is NULL if it has no right sub node 
}; 
int GetDepth(const struct NODE* pRoot) 

}

4.    A worker needs to do A work and B work. B’s priority is higher than A. For example, if he shall do A from 9:00 to 13:00, and shall doing B from 10:00 to 11:00, his choice shall be doing A from 9:00 to 10:00, doing B from 10:00 to 11:00, and doing A from 11:00 to 13:00.

Complete the following function (you can use pseudo-code or solution steps explanation instead of actual code), ”pSchedule“ is a worker’s work schedule (it’s an array), "nNum" is number of elements in array "pSchedule", "ppResult" is the result array which shall be returned and its buffer shall be allocated by yourself, "nRNum" is number of elements in “ppResult". The time phases in "pSchedule" cover each other, and not sorted, the output data in "ppResult" shall be a new schedule that are not covered of any phase, and sorted by start time. Return 0 if success.

enum WORK 

    A,        // A work 
    B        // B work 
}; 
struct SCHED 

    int nStartHour;        // at that hour work start 
    int nEndHour;            // at that hour work end 
    enum WORK work;        // work type 
}; 
int func(const struct SCHED* pSchedule, unsigned int nNum, struct SCHED** ppResult, unsigned int& nRNum) 

}

1.    请指出以下函数对参数"pParam"做了什么动作,并指出其中的错误

将链表中的元素奇数位与偶数位互换。

int func(struct LIST * pParam) 

    // … … 
    while (pCur != NULL) 
    { 
        pNext = pCur->pNext; 
        if (pNext == NULL) 
        { 
            pCur->pPrev = pPrev; 
            return pReturn; 
        } 
        // … … 
    } 
    return pReturn; 
}

2.    请完成标准C函数:memmove()

void *memmove(void *dest, const void *src, size_t count) 

    char *tmp; 
    const char *s;

if (dest == NULL || src == NULL) 
    { 
        return NULL; 
    }

if (dest <= src) { 
        tmp = dest; 
        s = src; 
        while (count–) 
            *tmp++ = *s++; 
    } else { 
        tmp = dest; 
        tmp += count; 
        s = src; 
        s += count; 
        while (count–) 
            *–tmp = *–s; 
    } 
    return dest; 
}

3.    请完成以下函数,返回二叉树的深度。例如下面所示二叉树的深度为4。

#include <stdlib.h>

struct NODE 

    struct NODE* pLeft;    // pLeft is NULL if it has no left sub node 
    struct NODE* pRight;    // pRight is NULL if it has no right sub node 
};

int GetDepth(const struct NODE* pRoot) 

    if (pRoot == NULL) 
    { 
        return 0; 
    } 
    int nLeft = GetDepth(pRoot->pLeft); 
    int nRight = GetDepth(pRoot->pRight); 
    return nLeft > nRight ? nLeft + 1 : nRight + 1; 
}

4.    工人需要做A工作和B工作。B工作的优先级比A工作更高。例如,如果他要在9:00至13:00做A工作,而且在10:00至11:00做B工作,那么他应该在9:00至10:00做A工作,在10:00至11:00做B工作,在11:00至13:00做A工作。 
完成下面函数,"pSchedule"是工人的工作计划(它是一个数组),"nNum"是数组"pSchedule"中的元素数量,"ppResult"是需要返回的结果数组,"nRNum"是结果中的元素数量。"pSchedule"中的时间段互相覆盖,而且未排序,输出结果"ppResult"中的时间段不允许有覆盖,并且按开始时间排序。函数执行成功返回0。

//以下是2011年的笔试题

5、已知2010年的1月1日是星期五,写一个函数,输入M年和N 月,计算出该月的第3个星期五是几号?

6、写SQL 语句的题,其中有一个是如何创建索引?

答案:(http://www.cnblogs.com/hanjin/archive/2008/09/09/1287505.html)

语法:
CREATE [索引类型] INDEX 索引名称
ON 表名(列名)
WITH FILLFACTOR = 填充因子值0~100
GO

/*实例*/
USE 库名
GO
IF EXISTS (SELECT * FROM SYSINDEXES WHERE NAME='IX_TEST_TNAME')--检测是否已经存在IX_TEST_TNAME索引
DROP INDEX TEST.IX_TEST_TNAME--如果存在则删除

--创建索引
CREATE NONCLUSTERED INDEX IX_TEST_TNAME --创建一个非聚集索引
ON TEST(TNAME)  --为TEST表的TNAME字段创建索引
WITH FILLFACTOR = 30 --填充因子为30%
GO

SELECT * FROM TEST(INDEX = IX_TEST_TNAME) WHERE TNAME = 'A' --指定按‘IX_TEST_TNAME’索引查询

总结:
      1.什么是索引:数据库中的索引是某个表中一列或多列值的集合和相应的指向表中物理标识这些值的数据页的逻辑指针清单。
  2.分类:
     唯一索引(UNIQUE):不允许两行具有相同的索引值(创建了唯一约束,系统将自动创建唯一索引)
     主键索引:主键索引要求主键中的每个值是唯一的,(创建主键自动创建主键索引)
     聚集索引(CLUSTERED):表中各行的物理顺序与键值的逻辑(索引)顺序相同,表中只能包含一个聚集索引,主键列默认为聚集索引
     非聚集索引(NONCLUSTERED):表中各行的物理顺序与键值的逻辑(索引)顺序不匹配,表中可以有249个非聚集索引
    3.创建索引的标准:用于频繁搜索的列;用于对数据进行排序的列
注意:如果表中仅有几行,或列中只包含几个不同的值,不推荐创建索引,因为SQL Server 在小型表中用索引搜索数据所花的时间比逐行搜索更长。

备注:转载于 http://www.mianwww.com/html/2011/03/7844.html

转载于:https://www.cnblogs.com/cswolf/archive/2011/10/13/2267124.html

各大计算机公司 笔试及面试 题目 - 恒生电子相关推荐

  1. 各大计算机公司 笔试及面试 题目 - 人民搜索

    一.面试形式          1.3轮1V1的技术面试:某轮面试通过,稍事休息后开始下一轮面试.          2.面试过程基本分为两部分:           1)对简历上所写项目的描述,及回 ...

  2. 西工大-计算机学院-2021复试-面试题目

    网络远程复试 录取总成绩=初试成绩/5×0.65+复试成绩×0.35 复试总成绩=思想政治考核成绩*10%+专业外语水平考核成绩*20%+专业综合能力考核成绩*70 抽十道题,问完之后,如果时间没到2 ...

  3. C/C++ 笔试、面试题目大汇总

    C/C++ 笔试.面试题目大汇总 这些东西有点烦,有点无聊.如果要去C++面试就看看吧.几年前网上搜索的.刚才看到,就整理一下,里面有些被我改了,感觉之前说的不对或不完善. 1.求下面函数的返回值( ...

  4. 某通信公司的Android面试题目

    某通信公司的Android面试题目 今天的面试感觉做的不是很好,有些知识点明显没有掌握好,现在抽空把面试题目抄下来,同时努力掌握好对应的知识点. stack和heap有什么区别? heap是堆,sta ...

  5. 2011 各大IT公司笔试面试题目

    2011.10.17百度面试题 1.进程切换需要注意哪些问题? 保存处理器PC寄存器的值到被中止进程的私有堆栈:      保存处理器PSW寄存器的值到被中止进程的私有堆栈:    保存处理器SP寄存 ...

  6. 2011各大IT公司笔试面试题目

    2011.10.17百度面试题 1.进程切换需要注意哪些问题? 保存处理器PC寄存器的值到被中止进程的私有堆栈:      保存处理器PSW寄存器的值到被中止进程的私有堆栈:    保存处理器SP寄存 ...

  7. C/C++笔试、面试题目大汇总

    1.求下面函数的返回值(微软) int func(x) {    int countx = 0;    while(x)    {          countx ++;          x = x ...

  8. 各大IT公司笔试真题汇总开发人员一定要加入收藏夹的网站(收藏)

    巨人网络java笔试基础题分享 http://www.coderarea.net/bbs/read.php?tid=834 百度笔试题 http://www.coderarea.net/bbs/rea ...

  9. 校招八股:C/C++开发工程师常见笔试、面试题目不完全汇总【很基础】

    这里汇总一些C/C++开发岗的常见面试八股题,都属于比较基础.偏理论性的题目.换句话说,如果这些题目答不上来,可能会给面试官留下的基础不好的印象,尤其是科班生哈. 废话不多说,直接开始. 一.C/C+ ...

最新文章

  1. 多文档版的的正则表达式工具
  2. SAP ABAP实用技巧介绍系列之反模式:一些低效的ABAP内表操作
  3. Ajax 和 PHP 实现验证码的实时验证
  4. piccolo2d android,如何在Piccolo2D中打洞?
  5. conda命令没找到的处理方案
  6. mysql int 11 最大多少_mysql - mysql中int(11)的列大小是多少? - 堆栈内存溢出
  7. html 页面加载事件,页面加载事件--DOMContentLoaded
  8. 在Excel中用vba编写的进销存管理系统
  9. c语言酒店信息管理实训作业,c语言实训报告宿舍管理系统.docx
  10. VS2010/MFC编程入门教程之目录和总结(鸡啄米)
  11. e4a换行_这个易语言代码用E4A怎么写?
  12. 关于 “Ubuntu 18.04.2 LTS _Bionic Beaver_ - Release amd64 (20190210)” 的盘片插入驱动器“/cdrom/”再按「回车」键 的解决问题
  13. python打开autocad
  14. 第14周收录104起融资,国外企业服务领域较为火爆丨潜在周报
  15. android fragmentpageradapter切换不更新,android – FragmentPagerAdapter不会在方向更改时重新创建片段吗?...
  16. vue页面特效:雨滴、流星
  17. 中英文翻译功能 php,PHP微信开发之翻译功能
  18. win7怎么开热点(win7怎么开热点)
  19. 模糊神经网络(三)模糊逻辑和神经网络的对比
  20. 期货法律法规重点笔记1

热门文章

  1. 记 路由器TP-link WR1043ND-V2 刷Openwrt后 非TTl 修砖经历
  2. 我训练了一个AI来复制我的声音,结果吓坏了我
  3. hackmap-[常见的文件解析漏洞总结]
  4. Error parsing Mapper XML. The XML location is ‘com/xxxxx/com/system/mapper/XXXXMapper.xml‘.
  5. Spring Cloud Gateway实现网关统一鉴权,网关统一Token认证
  6. 西门子EDA软件产业版图如何养成?
  7. 第7章 为什么巴比伦塔会失败
  8. linux脚本打不开文件夹,为什么这个程序向文件地址和内存地址不一样的文件加入shellcode会导致文件打不开...
  9. K 近邻算法(KNN)与KD 树实现
  10. 智慧城管解决方案-最新全套文件