Tencent T3C ++ development engineer interview summary, these questions can you answer a few? With answers

Tencent C ++ first round of interview questions:

Do not do not worry, there is the end the answer

1, self-introduction (free play)

2,301 and 302 difference?

3, red-black tree is what kind of data structure? Red-black tree and the difference between the number of B?

4, the difference between stack and heap?

5, talk about the awareness of the optimistic and pessimistic locking in

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


6, the difference between structure struct and union of union

7, concrete realization of three-way handshake, time_wait principle?

8, C and C ++ features and differences

9, a computer network to which different layers of useful agreement?

If you only half of these questions above, you will be eliminated in the first round, then you have to continue Sike C ++ it!

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Tencent T3C ++ development engineer interview summary

c / c ++ v1.0 Interview Questions and Answers

1. Fundamentals

1.1. Languages

A, C and C ++ features and differences?

Second, set forth the C ++ polymorphism

Third, to achieve Explanation c ++ virtual functions

Four, C and C ++ memory allocation problem

2. Advanced section

2.1 Network

Five, four and drawn three-way handshake waving flow chart

Six, please explain the process to establish a connection https

Seven Draw OSI and TCP / IP protocol stack of correspondence between

Eight, please explain the principle of ARQ protocols and procedures

Nine, please explain the principles and procedures sliding window protocol

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Operating system .

X. process communication options? Which maximum efficiency?

XI communication between threads

Twelve, please explain the concept of processes and threads, respectively, and to analyze the similarities and differences?

database

Difference thirteen, MySQL and innodb in the myisam

Fourteen, innodb engine of the four major characteristics

Fifteen, MyISAM and InnoDB selectcount (*) Which is faster, and why

Sixteen, Redis data types supported?

XVII What is Redis persistence? Redis, which has several persistent way? What advantages and disadvantages?

Eighteen, redis protocol (RESP), explain under what is RESP? What are the characteristics? ....

Nineteen, Redis architectural patterns which have? Talk about their characteristics

data structure

XX, linear table

XXI binary tree.

XXII, red-black tree

Xxiii, balanced tree

Twenty-four, Radix tree

XXV, octree

XXVI, Merkel tree

algorithm

Xxvii, sorting algorithms

选择/冒泡/快速/堆排等

二十八、 一致性哈希算法

二十九、 paxos 算法

三十、 raft 算法

答案部分

1. 基础部分

1.1.语言

一、 C 和 C++的特点与区别?

参考答案:

答:(1)C 语言特点:

1) 作为一种面向过程的结构化语言,易于调试和维护;

2) 表现能力和处理能力极强,可以直接访问内存的物理地址;

3) C 语言实现了对硬件的编程操作,也适合于应用软件的开发;

4) C 语言还具有效率高,可移植性强等特点。

(2)C++语言特点:

1) 在 C 语言的基础上进行扩充和完善,使 C++兼容了 C 语言的面向过程特点,又成为了

一种面向对象的程序设计语言;

2) 可以使用抽象数据类型进行基于对象的编程;

3) 可以使用多继承、多态进行面向对象的编程;

4) 可以担负起以模版为特征的泛型化编程。

二、 阐述 C++的多态

参考答案:

编译时多态:主要指泛型编程

运行时多态:

C++的多态性用一句话概括:在基类的函数前加上 virtual 关键字,在派生类中重写该函数,

运行时将会根据对象的实际类型来调用相应的函数。如果对象类型是派生类,就调用派生

类的函数;如果对象类型是基类,就调用基类的函数。

1) 用 virtual 关键字申明的函数叫做虚函数,虚函数肯定是类的成员函数;

2) 存在虚函数的类都有一个一维的虚函数表叫做虚表,类的对象有一个指向虚表开始的

虚指针。虚表是和类对应的,虚表指针是和对象对应的;

3) 多态性是一个接口多种实现,是面向对象的核心,分为类的多态性和函数的多态性。;

4) 多态用虚函数来实现,结合动态绑定.;

5) 纯虚函数是虚函数再加上 = 0;

6) 抽象类是指包括至少一个纯虚函数的类;

纯虚函数:virtual void fun()=0;即抽象类,必须在子类实现这个函数,即先有名称,没

有内容,在派生类实现内容。

三、 阐释 c++虚函数的实现

参考答案:

简单地说,每一个含有虚函数(无论是其本身的,还是继承而来的)的类都至少有一个与

之对应的虚函数表,其中存放着该类所有的虚函数对应的函数指针。

例:

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


其中:

The virtual function table B stored in the B :: foo B :: bar and two function pointers.

Inherited from both B D virtual function table stored in the virtual function B :: foo, there rewritten (the override) base class virtual functions

Number of B :: bar D :: bar, as well as the new virtual function D :: quz.

Virtual function table construction process:

From the perspective of the compiler, the virtual function table B good configuration D virtual function table construction process is relatively complicated. Given below

A way of the virtual function table of the configuration D (Reference):

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Virtual function call

In the following program as an example:

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Because after part of the answer too much, not one by one to show it, if you want to get this part Tencent T3 level surface through the PDF answer, I can private letter "interview" to get, first of all pay attention to my private letter Oh

Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Tencent T3C ++ development engineer interview summary, these questions can you answer a few?  With answers


Has been organized into a PDF document, face questions + answers

Obtaining + Skirt: 7770.28506

Focus on programming, dynamic Internet. The final summary of the technology, experience, experience (data structures and algorithms, source code analysis, etc.) for everyone to enjoy, here is not limited to technology! There workplace experience, understanding of life, as well as face warp. Click the button above concerns, the first time to be served!


Guess you like

Origin blog.51cto.com/14443507/2432483