腾讯笔试题

  • 格式:doc
  • 大小:39.50 KB
  • 文档页数:7

下载文档原格式

  / 7
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

一些笔试题目和整理的答案 - 腾讯(Tencent)

NO1

Below is usual way we find one element in an array

const int *find1(const int* array, int n, int x)

{

const int* p = array;

for(int i = 0; i < n; i++)

{

if(*p == x)

{

return p;

}

++p;

}

return 0; }

In this case we have to bear the knowledge of value type "int", the size of array, even the existence of an array. Would you re-write it using template to eliminate all these dependencies?

template

const T *find1(const T* array, int n, T x)

{

const T* p = array;

for(int i = 0; i < n; i++)

{

if(*p == x)

{

return p;

}

++p;

}

return 0; }

NO2

Give an example of implementing a Stack in the template way(only template class declaration without detail definition and realization)

template

class Stack{

public:

Stack(int = 10) ;

~Stack() { delete [] stackPtr ; }

int push(const T&);

int pop(T&) ;

int isEmpty()const { return top == -1 ; }

int isFull() const { return top == size - 1 ; }

private:

int size ; // number of elements on Stack.

int top ;

T* stackPtr ;

} ;

NO3

Implement the simplest singleton pattern(initialize if necessary).

class Singleton {

public:

static Singleton* Instance();

protected:

Singleton();

private:

static Singleton* _instance;

}

// Implementation

Singleton* Singleton::_instance = 0;

Singleton* Singleton::Instance() {

if (_instance == 0) {

_instance = new Singleton;

}

return _instance;

}

NO4

1.Jeff and Diamond like playing game of coins, One day they designed a new set of rules:

1)Totally 10 coins

2)One can take away 1,2or 4 coins at one time by turns

3)Who takes the last loses.

Given these rules Whether the winning status is pre-determined or not

1:从后面开始考虑,最后肯定要留1个才能保证自己赢

2:所以要设法让对方留下2,3,5个

3:也就是要自己取后留下1,4,6,7,8,9

4:如果自己取后留下6,对方取2个,与(3)矛盾,所以排除6

5:如果自己取后留下8,对方取4个,与(3)一样情况,所以也排除8

6:同样,9也不行,如果我抽后剩下9,对方抽2个,就反过来成对方抽剩成7个了,也与3)矛盾,所以也排除

7:所以很显然,我只能抽剩1,4,7

8:因为只能抽后剩1,4,7才能赢,我先抽得话不可能达到这几个数,很显然,只能让对方先抽,也即是先抽的人输

2011.04.23腾讯技术运营部分笔试题目

zz

1、find -newer file1 ! file2 命令的意思是?

8、cat -n file1file2 命令的意思是?

9、vi编辑器中,删除一行的命令是?

10、chmod ug=rwx,o=x file命令功能相同的是:chmod 764 file、chmod 771 file、chmod 671 file、chmod 774 file

11、cp拷贝命令的-f参数含义为?

20、tar命令用于解压的参数是?

二、填空题

1、linux命令增加一条192.168.0.024的静态路由

5、linux下交换分区的格式

6、linux下查看当前网络连接的命令

8、linux下侦测主机到目的主机之前所经过的路由的命令

腾讯测试类实习笔试题及分析

18、在开发一个系统时,如果用户对系统的目标不很清楚,难以定义需求,这时最好使用(A )。 A.原型法

B.瀑布模型

C.V-模型

D.螺旋模型

19、软件开发中的瀑布模型典型的刻画了软件存在周期的阶段划分,与其最相适应的软件开发方法是(B)。

A.构件化方法

B.结构化方法

C.面向对象方法

D.快速原型法

20、软件设计的主要任务是设计软件的结构、过程和模块,其中软件结构设计的主要任务是要确定( C )。

A.模块间的操作细节

B.模块间的相似性

C.模块间的组成关系