2015网易互娱校园招聘笔试题游戏插件研发岗

时长:90分钟 总分:100分

119浏览 0人已完成答题

题型介绍
题型 单选题 多选题 判断题 简答题
数量 4 3 3 6
1.
根据要求写出pqueue的工作原理
问题详情

有pqueue.h如下
#ifndef HEADER_PQUEUE_H
#define HEADER_PQUEUE_H
typedef struct_pqueue{
    pitem *items
     int count
}pqueue_s
typedef struct_pqueue *pqueue
typedef struct_pitem{
    unsigned char priority[8]
    void *data
    struct_pitem *next
}pitem
typedef struct_pitem *piterator
pitem *pitem_new(unsigned char *prio64be,void *data)
void pitem_free(pitem *item)
 
pqueue pqueue_new(void)
void pqueue_free(pqueue pq)
pitem *pqueue_insert(pqueue pq,pitem *item)
pitem *pqueue_peek(pqueue pq)
pitem *pqueue_pop(pqueue pq)
pitem *pqueue_find(pqueue pq,unsigned char *prio64be)
pitem *pqueue_iterator(pqueue pq)
pitem *pqueue_next(piterator *iter)
int pqueue_size(pqueue pq)
#endif /*! HEADER_PQUEUE_H */
pq_test.c如下:
#include<stdlib.h>
#include<string.h>
#include"pqueue.h"
/*remember to change expected.txt if you change there values*/
unsigned char prio1[8]="supercal"
unsigned char prio2[8]="ifragili"
unsigned char prio3[8]="sticexpi"
static void
pqueue_print(pqueue pq)
{
     pitem *iter,*item
     iter=pqueue_iterator(pq)
     for(item=pqueue_next(&iter)item!=NULL
         item=pqueue_next(&iter)){
         printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
             item ->priority[0],item->priority[1],
             item ->priority[2],item->priority[3],
             item ->priority[4],item->priority[5],
             item ->priority[6],item->priority[7],
         }
}
int main(void)
{
     pitem *item
     pqueue pq
     pq=pqueue_new()
     item=pitem_new(prio3,NULL)
     pqueue_insert(pq,item)
 
     item=pitem_new(prio1,NULL)
     pqueue_insert(pq,item)
 
     item=pitem_new(prio2,NULL)
     pqueue_insert(pq,item)
     item=pqueue_find(pq,prio1)
     fprintf(stderr,"found %p\n",item->priority)
     item=pqueue_find(pq,prio2)
     fprintf(stderr,"found %p\n",item->priority)
 
     item=pqueue_find(pq,prio3)
     fprintf(stderr,"found %p\n",item->priority)
     
     pqueue_print(pq)
     for(item=pqueue_pop(pq)item!=NULLitem=pqueue_pop(pq))
     pitem_free(item)
 
     pqueue_free(pq)
     return 0
}
pq_test.sh如下:
#!/bin/sh
set -e
./pq_test | cmp $srcdir/pq_expected.txt-
pq_expected.txt如下:
item 6966726167696c69
item 7374696365787069
item 737570657263616c
1.根据测试代码描述pqueue的工作原理。
2.请实现 pitem *pqueue_insert(pqueue pq,pitem *item)
2.
比较B+Tree/Hash_Map/STL Map三种数据结构。
问题详情

有B+Tree/Hash_Map/STL Map三种数据结构。对于内存中数据,查找性能较好的数据结构是(),对于磁盘中数据,查找性能较好的数据结构是()。




3.
tcp三次握手创建连接,双方交互的报文中SYN和ACK的序列是什么样的()
问题详情




4.
函数参数使用的空间是在()中申请的,malloc或new是在()中申请空间的?
问题详情




5.
错误:unresolved external symbol BeginScene属于()阶段错误。
问题详情

由源代码生成可执行文件需要经过预编译,编译,汇编,链接等阶段,错误:unresolved external symbol BeginScene属于()阶段错误。




6.
下面属于进程间通信的有?
问题详情




7.
下面关于ISO网络参考模型分层及每一层功能描述错误的有?
问题详情






8.
用命令()可以查看mysql数据库中user表的表结构?
问题详情




9.
根据下面程序,a和b输出的结果是?
问题详情

char *p1int64 *p2
p1=(char *)0x800000
p2=(int64 *)0x800000
char *a=p1+2
int64_t *b=p2+2
那么a=(),b=()
10.
采用线性探测的方式解决冲突,访问hash表的次数分别为多少?
问题详情

有一个数组(53,83,18,59,38,35),依次将其存储在hash表中,其中哈希函数为h(k)=k%7,如采用线性探测(每次向后查找1位)的方式解决冲突,则该hash表上查找38,35,53访问hash表的表项次数分别为(),(),()。
11.
32位系统上,如下语句的输出是多少?
问题详情

32位系统上
char c1[]={'a','b','\0','d','e'}
char c2[]="hello"
sizeof(c1),strlen(c1),sizeof(c2),strlen(c2)值分别是()()()()。
12.
请找出下面用于拷贝内存的代码中的逻辑错误,并修正。
问题详情

请找出下面用于拷贝内存的代码中的逻辑错误,并修正。
void memcpy(const char* src,char* dest){
    int len=strlen(src)
    dest=(char*)malloc(len)
    char* d=dest
    char* s=src
    while(len--!=0){
        *d=*s
        d++
        s++
    }
}

13.
现有/home/script/check.sh脚本,要求每周一到周五14点内每三分钟运行一次,相应的crontab配置是()
问题详情
14.
http状态码中,()表示访问成功,()表示坏请求,()表示服务不可用
问题详情
15.
根据题目要求写出sql
问题详情

在SQL中,一个表的定义如下:
CREATE TABLE t_account(
     account varchar(100),
     account_type TINYTEXT,
     PRIMARY KEY (account),
}
account为账号,account_type为该账号的类型,写出一个sql,统计账号数累计超过5000个账号类型,并显示对应的账号数,即结果中每行是(账号类型,账号数)

16.
使用C/C++语言写一个函数,实现字符串的反转,要求不能用任何系统函数,且时间复杂度最小。
问题详情

使用C/C++语言写一个函数,实现字符串的反转,要求不能用任何系统函数,且时间复杂度最小。
函数原型是:char *reverse_str(char *str)