A
PING B
TRACERT C
TELNET D IPCONFIG
A
在类?法中可?this 来调?本类的类?法B
在类?法中调?本类的类?法时可直接调?C
在类?法中只能调?本类中的类?法D 在类?法中绝对不能调?实例?法
A
*B
.*C
::D delete
A
template
template
template
A
static B
virtual C
extern D
inline E const
A
the return value of main function if program ends normally B return (7&1)
腾讯2015春招pc 客户端开发练习卷
?. 单项选择题
1. ?来检查到?台主机的?络层是否连通命令是( )?
?. 多选选择题
2. 下列说法错误的有( )
3. 下列运算符,在C++语?中不能重载的是()
4. 下列的模板说明中,正确的有( )
5. In C++, which of the following keyword(s) can be used on both a variable and a function?
6. Which of the following statement(s) equal(s) value 1 in C programming language?
C
char *str="microsoft"; return str=="microsoft"D
return "microsoft"=="microsoft"E None of the above
A
int px*;B
char *acp[10];C
char (*pac )[10];D int (*p )();
A
嵌套类B
派?类C
含有纯虚函数D 多继承类
A p1++;
B p1[2] = ‘w’;
C p2[2] = ‘l’;
D
p2++;A
IP 地址采?分层结构,它由?络号与主机号两部分组成B
根据不同的取值范围IP 地址可以分为五类C
202.112.139.140属于B 类地址D
每个C 类?络最多包含254台主机E
IPv6采?128位地址?度F 私有地址只是ABC 类地址的?部分
A
只能?于数组B
只能?于链表C 只能在已经排序的数据上进?查找
7. 下列定义语句中,错误的是
8.
抽象基类是指( )
9.
给出以下定义,下列哪些操作是合法的?
const char *p1 = “hello”;
char *const p2 = “world”;
10. 关于IP 地址下列说法错误的是?
11. 对于?分查找算法下?描述正确的是哪个?
D 最坏情况下时间复杂度是O(N*logN)
A
帧头B
IP 报?头部C
SSAP ?段D DSAP ?段
A
4B
6C
8D 16
A 在并?程度中,当两个并?的线程,在没有任何约束的情况下,访问?个共享变量或者共享对象的?
个域,?且?少要有?个操作是写操作,就可能发?数据竞争错误。
B 原语Compare-and-swap(CAS)是实现?锁数据结构的通?原语。
C 获得内部锁的唯?途径是:进?这个内部锁保护的同步块或?法。
D volatile 变量具有synchronized 的可?性特性,但是不具备原?特性。
E
减?竞争发?可能性的有效?式是尽可能缩短把持锁的时间A
public 成员B
private 成员C
protected 成员D
数据成员E 函数成员
12. 路由器转发数据包到?直接?段的过程中,依靠下列哪?个选项来寻找下?跳地址( )13. IPv6地址占____个字节
14. 以下说法正确的是:
15. 类B 从类A 派?,则类B 可以访问类A 中的( )成员?
三. 问答题
16. 调?动态连接库的函数有哪?种?法?
17. WM_QUIT 消息的?途是什么??个普通的Windows 窗?能收到的最后?条消息是什么?18.
有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
#include
#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!=NULL;item=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);
登录?客?,参与以上题?讨论,查看更多笔试?试题
技术QQ 群:157594705 微博:https://www.doczj.com/doc/dc11287272.html,/nowcoder
微信