Summary of interview topics in C + +

Source: Internet
Author: User
Tags class definition epoll message queue semaphore asymmetric encryption

Directory
1. What are polymorphism? How is dynamic binding implemented? 3
2. Virtual function, how is the memory allocated in the virtual function table? 3
3. How is a pure virtual function defined, and why is the destructor defined as a virtual function? 4
4. What can't be virtual functions in C + +? 4
5. What are type conversions? (Reference) 4
6. Why use static_cast instead of conversion in C? 4
7. Operator overloading (+ operator), how to define? 5
8. What is the principle of memory alignment? 5
9. What are the differences between inline functions and macro definitions? 5
10. Keyword static, extern, const, typedef 5
Why do I add extern "C" when I call a function compiled by the C compiler in C + +? 5
12. How do I implement a class object that can only be allocated dynamically and cannot define a class object? Reference 6
What is explicit for? 6
14. What are the factors of memory overflow? 7
What is the difference between new and malloc, delet and free? Reference 7
16. Case of data members that must be initialized with "initialization list" 8
What is the difference between a C + + reference and a pointer? 8
18. Talk about stacks and stacks and static storage areas? Reference 8
Auto_ptr class, C + + smart pointer implementation? 9
20. What happens when an iterator deletes an element? Iterator invalidation? Not finished 9
21. What are the factors of memory overflow? Not finished 10
22. How to achieve the template??? Not finished 10
23. The concept of template special, why Special????? Not finished 10
24. What is the meaning of static member functions and data members????? Not finished 10
25. What is the anomaly mechanism? 11
26. A recent project, technical difficulties ah, how to overcome? 11
27. =============== operating system related =================== 11
A. Linux process, thread summary? Reference 11
29. Thread Synchronization Mode 12
30. How does the process communicate? 13
31. The four conditions that generate a deadlock, and how are they handled? Not finished 13
The IO multiplexing has epoll, poll, select? Linux network programming, unfamiliar with 13
What are the common Linux commands? "Bird's-brother Linux private Cuisine" 14
34. Hash table? Notebook issues 25 14
35. Database transactions? 14
36. ================ data structure and algorithm ================= 14
37. Find the number k in the array? 30 questions on offer. 14
38. What are the sorting algorithms? Quick Sort implementation? Best time complexity, average time complexity? 15
How do you write the strcpy function? What is the strcpy return type for? 15
What containers do stl have, compare vectors and set? 15
41. Definition and interpretation of red and black trees? B-Tree, the basic nature of A + + tree? 15
42. ============== Network and other ==================== 15
43. What are the common cryptographic algorithms? 15
A. HTTPS? 15

1. What are polymorphism? How is dynamic binding implemented?

Polymorphism is an interface, a variety of implementations, is the core of object-oriented. Compile-time polymorphism: implemented by overloaded functions. Runtime polymorphism: Implemented by virtual functions, combined with dynamic binding.
Dynamic binding occurs when a virtual function is called by a reference or pointer to a base class. The fact that a reference (or pointer) can point either to a base class object or to a derived class object is the key to dynamic binding.
Dynamic bindings are implemented by virtual functions. The virtual function is implemented by a virtual function table.
A function declared with the virtual keyword is called a virtual function, and a virtual function is definitely a member function of a class.
A class that exists with virtual functions has a one-dimensional virtual function table called a virtual table. The object of the class has a virtual pointer that points to the beginning of the virtual table. A virtual table corresponds to a class, and a virtual table pointer corresponds to an object.

2. Virtual function, how is the memory allocated in the virtual function table?

At compile time, the compiler discovers that there are virtual functions in the animal class, at which point the compiler creates a virtual table for each class that contains the virtual function, which is a one-dimensional array that holds the address of each virtual function in the array. Both the animal and fish classes contain a virtual function, breathe (), so the compiler creates a virtual table for all two classes.
So when, or where, is the virtual table pointer initialized?
The answer is to create the virtual table in the constructor and initialize the virtual table pointer. Remember the order in which constructors are called, when constructing a subclass object, the constructor of the parent class is called, at which point the compiler only "sees" the parent class, does not know if there are successors after it, initializes the virtual table pointer of the parent class object, and the virtual table pointer points to the virtual table of the parent class. When the constructor of a subclass is executed, the virtual table pointer of the subclass object is initialized, pointing to its own virtual table.
Summary (the base class has virtual functions):
1. Each class has a virtual table.
2. The virtual table can be inherited, if the subclass does not override the virtual function, then the subclass of the virtual table will still have the address of the function, but this address points to the virtual function of the base class implementation. If the base class has 3 virtual functions, then there are three items in the virtual table of the base class (virtual function address), the derived class will have a virtual table, at least three items, if the corresponding virtual function is overridden, then the address in the virtual table will change, pointing to its own virtual function implementation. If a derived class has its own virtual function, the item is added in the virtual table.
3. The virtual function address in the virtual table of the derived class is arranged in the same order as the virtual function address in the virtual table of the base class.
In general, when we invoke a function with a pointer/reference, the function being called depends on the type of the pointer/reference. That is, if the pointer/reference is a pointer/reference to the base class object, the method of the base class is called, and if the pointer/reference is a pointer/reference to the derived class object, the method of the derived class is called, of course, if the derived class does not have this method, it will go up to the base class to find the appropriate method These calls are determined during the compilation phase. When it comes to polymorphism, virtual functions and dynamic bindings are used, at which point the call is not determined at compile time but at runtime. Instead of considering the pointer/reference type alone, the type of the pointer/reference object is used to determine the invocation of the function, which function is called based on the address of the function in the virtual table to which the virtual pointer points in the object.
http://blog.csdn.net/haoel/article/details/1948051

3. How is a pure virtual function defined, and why is the destructor defined as a virtual function?

A pure virtual function is a virtual function declared in a base class that is not defined in the base class, but requires that any derived class define its own implementation method. A pure virtual function is a virtual function plus = 0. virtual void fun () = 0.
In many cases, the base class itself generates objects that are unreasonable. For example, animals as a base class can be derived from tigers, peacocks and other sub-categories, but the animals themselves generated objects are obviously unreasonable. A class that contains a purely virtual function is called an abstract class, and it cannot produce an object.
Base *p =new Son;
Delete p;
If the destructor is not a virtual function, then when the memory is freed, the compiler uses a static binder, thinking that P is a base class pointer, calling the base class destructor, so that the memory of the class object is not released, causing a memory leak. Once defined as a virtual function, it is dynamically linked, calling the subclass destructor first in the base class.

4. What can't be virtual functions in C + +?

1) The normal function can only be overload, cannot be override, declared as virtual function does not mean anything, so the compiler will bind the function at compile time.
2) constructors know that all information is required to create objects, whereas virtual functions allow only partial information to be known.
3) inline functions are expanded at compile time, and virtual functions can be dynamically state-determined functions at run time.
4) Friend function because it cannot be inherited.
5) static member functions have only one entity and cannot be inherited. The parent class and child classes are common.

5. What are type conversions? Reference

? Static type conversions, static_cast, basic types, and types that have inheritance relationships.
The example a,double type is converted to int. B, converts the subclass object into a base class object.
? Constant type conversion, const_cast, removes the constant property of the pointer variable.
You cannot convert a constant that is not a pointer to a normal variable.
? Dynamic type conversions, dynamic_cast, and run-time conversion analysis are not performed at compile time. The dynamic_cast converter can only be used for classes that contain virtual functions. Dynamic_cast is used for up-and down-conversion between class hierarchies, and for cross-class conversions. An upward conversion between class hierarchies, where the subclass is converted to a parent class, completes at this time the same functionality and static_cast, because the compiler default upward conversion is always secure. Dynamic_cast has the function of type checking and is more secure when down conversion. Cross-conversion between classes refers to the conversion of pointers or references between multiple parent classes of subclasses.
The function can only type conversions between pointers to inherited class objects or between references. Or a class that has virtual functions. Two kinds of
example, a derived class pointer is converted to a base class pointer. b There is no inheritance relationship, but the converted class has a virtual function
? To redefine a type conversion, a pointer of one type is converted to a pointer of another type.

6. Why use static_cast instead of conversion in C?

The static_cast conversion, which checks the type to see if it can be converted, has a type security check.
For example, this is legal in C + +, but it's really wrong.
A * a= new A;
b* B = (b*) A;

7. Operator overloading (+ operator), how to define?

All operators in C + + can be overloaded except for the generic relational operator ".", the member pointer operator ". *", The scope operator "::", the sizeof operator, and the three-mesh operator "?:".
< return type descriptor > operator < operator symbol > (< parameter table >) {}
Overloads are member functions of a class and overloads are non-member functions of a class. The number of arguments is different and should be the this pointer.

8. What is the principle of memory alignment?

A. The size of the struct is an integer multiple of the largest member.
B. The offset of the member's first address is an integer multiple of its type size.

9. What are the differences between inline functions and macro definitions?

At the time of the program compiling, the function body is replaced with the inline function call, which is similar to the macro extension in C language, not the lone Phoenix code.
Motive: It is used to eliminate the time overhead of function calls. Short functions that are frequently called are very beneficial.
A, the macro definition does not check function parameters, return the value of what, just expand, in contrast, the inline function will check the parameter type, so more secure.
B. Macros are substituted by the preprocessor for macros, and inline functions are implemented by compiler control.

10. Keyword static, extern, const, typedef

The initial purpose of the Const rollout, in order to replace the precompiled directive, eliminates its drawbacks while inheriting its advantages.
Const usage 1: Constant. Usage 2: Pointers and constants. Usage 3:const modifier member function (c + + attribute)
Const objects can access only const member functions, and non-const objects have access to arbitrary member functions, including const member functions;
The members of a const object cannot be modified, whereas objects maintained by pointers can be modified;
The const member function cannot modify the object's data, regardless of whether the object is of a const nature. The compilation is checked against the modification of member data.
What is the principle of the Const implementation? Incomplete reference
There are two scenarios in which storage space is allocated for this variable:
1, when the const constant is global and needs to be used in other files, (extern)
2. When the address of the const constant is taken with the address character (&).
In C + +, a const-modified variable may allocate storage space for it, or it may not allocate storage space.

extern可以置于变量或者函数前,以标示变量或者函数的定义在别的文件中,提示编译器遇到此变量和函数时在其他模块中寻找其定义。此外extern也可用来进行链接指定。typedef char Line[81];   int (*PF)(int , int);

typedef int (*PF) (int, int);

Why do I add extern "C" when I call a function compiled by the C compiler in C + +?

C+ supports function overloading, while C does not, and functions are c+ compiled and C-compiled with different names in the library. For example, void foo (int a,int b), C may be _foo, and c+ is foo_int_int.
At this point the C function will need to use the extern "C" for the link designation, this tells the compiler, please keep my name, do not give me to generate the middle function name for the link. Solve the name matching problem.

12. How do I implement a class object that can only be allocated dynamically and cannot define a class object? Reference

Dynamic allocation is the use of operator new to create an object of a class that allocates memory on the heap.
static assignment is A; this is where the compiler creates an object and allocates memory on the stack.

Why use static?

What is explicit for?

1 constructor, 2 default and implied type conversion operator.
The explicit constructor is used to prevent implicit conversions.
struct A
{
A (int) {}//converting constructor
A (int, int) {}//converting constructor (C++11)
operator BOOL () const {return true;}
};
struct B
{
explicit B (int) {}
explicit B (int, int) {}
Explicit operator bool () const {return true;}
};
int main ()
{
B B1 = 1; Error:copy-initialization does not consider b::b (int)
B B2 (2); Ok:direct-initialization selects b::b (int)
B B3 {4, 5}; Ok:direct-list-initialization selects b::b (int, int)
B B4 = {4, 5}; Error:copy-list-initialization does not consider b::b (int,int)
b b5 = (b) 1; Ok:explicit Cast performs static_cast
if (B1) break; ok:b::operator BOOL ()
bool Nb1 = B2; Error:copy-initialization does not consider b::operator bool ()
BOOL Nb2 = static_cast (B2); Ok:static_cast performs direct-initialization
}

14. What are the factors of memory overflow?

People with experience in C + + development will find that we can use 0 as false, not 0 as true. A function, even if it is of type bool, but we can still return the int type, and automatically convert 0 to False, not 0 to true. C + + non-type safe, Java type safe.
(1) Use of non-type security (Non-type-safe) languages such as C + +.
(2) Access or copy the memory buffer in an unreliable manner.
(3) The compiler sets the memory buffer too close to the critical data structure.

What is the difference between new and malloc, delet and free? Reference

void *malloc (Long numbytes): The function allocates numbytes bytes and returns a pointer to the memory. If the allocation fails, a null pointer is returned (NULL).
void *firstbyte: This function returns the space previously allocated by malloc back to the program or the operating system, which frees up the memory and lets it regain its freedom.
New will have two events: 1). The memory is allocated (via the operator new function) 2). Calls one or more constructors to build the object for the allocated memory.
When you delete, two things happen: 1). Call one or more destructors 2 for the memory that is freed. Frees memory (via operator delete function).
Difference:
1.malloc/free is a standard library function for C + + languages, and New/delete is an operator of C + +
2.new can automatically allocate space size, malloc incoming parameters.
3. For user-defined objects, Maloc/free cannot meet the requirements of dynamic management objects. Objects are automatically executed when they are created, and the object executes the destructor automatically before it dies. Because Malloc/free is a library function and not an operator, the task of executing constructors and destructors cannot be imposed on malloc/free, not within the control of the compiler. C + + therefore requires an operator new that can perform dynamic memory allocation and initialization for an object, and an operator that can perform cleanup and release of memory on the object delete-in short new/ Delete can make a call to the object to construct and destructors, and then to work on the memory in more detail, and malloc/free cannot.
Since New/delete's functionality completely covers the Malloc/free, why is C + + still reserved for malloc/free? Because C + + programs often have to call C functions, the program can only use Malloc/free to manage dynamic memory.

16. You must initialize data members with the Initialize list

Situation one, is the case of the object (this includes the inheritance case, the parent class data members are initialized by displaying the constructor of the parent class); The data member is an object, and the object has only a constructor with parameters, and no parameterless constructor;
Second, const-modified class members;
Case three, reference member data;

The order in which classes are initialized is emphasized here, and it should be that the initialization of class member variables is not initialized in the order in which they were initialized, but rather initialized in the order in which they were declared in the class.

What is the difference between a C + + reference and a pointer?

1. Different definitions. The pointer is a variable that stores an address and refers to the alias of the original variable.
2 can change. The value of the pointer can be changed after initialization, that is, pointing to other storage units, and the reference will not change after initialization.
3 can be empty. The value of the pointer can be NULL, but the referenced value cannot be null, and the reference must be initialized at the time of definition;
4. Pointers can have multiple levels, but references can only be one level.
5 sizeof Reference "Gets the size of the variable (object) pointed to, and the" sizeof pointer "gets the size of the pointer itself (the address of the variable or object to which it is pointing);
18. Talk about stacks and stacks and static storage areas? Reference
(1). Management method: Stack resources are automatically managed by the compiler. The resources in the heap are controlled by the programmer.
(2). Different Space sizes
(3). can produce different fragments
(4). Growth direction: Stack is a continuous space to the low address growth, the heap is to the high address growth discontinuity space.
(5). Different Distribution methods
(6). Different allocation efficiency
The difference between static allocation and dynamic allocation of memory is mainly two:
One is that time is different. Static allocations occur at the time of program compilation and connection. Dynamic allocation occurs when the program is being transferred and executed.
Second, the space is different. The heap is dynamically allocated and there are no statically allocated heaps. Stacks are allocated in 2 ways: static allocation and dynamic allocation. Static allocations are done by the compiler, such as the allocation of local variables. Alloca, you can dynamically allocate memory from the stack without worrying about memory leaks, because the memory requested by Alloca is automatically freed when function a returns.

Auto_ptr class, C + + smart pointer implementation? 20. What happens when an iterator deletes an element? Iterator invalidation? Not finished

First, for vectors, the add and delete operations may invalidate some or all of the iterators in the container. Then why does the iterator fail? Vector elements are stored sequentially in memory. When a new element is added, there is no place to store it, so the vector must reallocate the storage space for the original element and the newly added elements: the elements stored in the old storage space are copied into the new storage space, then the new elements are inserted, and the old storage space is finally revoked. This happens and will cause all iterators in the vector container to fail.
Several failure scenarios for vector iterators:
1. When an element is inserted (push_back), the iterator returned by the end operation must be invalidated.
2. When an element is inserted (push_back), the capacity return value changes before the element is inserted, and the entire container needs to be reloaded, and the iterator returned by the first and end operations will be invalidated.
3. When the delete operation (Erase,pop_back) is performed, the iterator that points to the delete point is all invalidated, and the iterator to the element that follows the delete point is all invalidated.
1. For the deletion of the node-type container (map, list, set) element, the insert operation invalidates the iterator that points to the element, and the other element iterators are unaffected.
2, for the deletion of the sequential container (vector) element, the insertion operation causes an iterator that points to the element and subsequent elements to be invalidated.
21. What are the factors of memory overflow? Not finished
People with experience in C + + development will find that we can use 0 as false, not 0 as true. A function, even if it is of type bool, but we can still return the int type, and automatically convert 0 to False, not 0 to true. C + + non-type safe, Java type safe.
(1) Use of non-type security (Non-type-safe) languages such as C + +.
(2) Access or copy the memory buffer in an unreliable manner.
(3) The compiler sets the memory buffer too close to the critical data structure.

22. How to achieve the template??? Not finished

template void Swap (t& A, t& b) {}
A template is a tool that parameterize a type, and is an abstraction of a type.

23. The concept of template special, why Special????? Not finished

Template specialization is a template that is specifically implemented for these special type parameters when an existing generic template no longer applies to some special type parameters.
Full specificity, that is, template parameters are all specified as the type of determination.
Partial specificity, that is, template parameters in the template is not fully determined, the compiler needs to be determined at compile time.
We can also turn T special into T*,const t*, t&, const t&, etc.
Template
Class Stack {};
Template < >
Class Stack {//...//};
In the definition above, template < > tells the compiler that this is a special templates.

    1. What is the meaning of static member functions and data members????? Not finished
      A class member or member function declared as static can be shared within the scope of the class, with global variables in the class domain.
      The B derived class object shares the static data members of the base class with the base class object.
      C static members still follow the public,private,protected access guidelines.
      D static data members cannot be initialized inside the class definition, only outside of class body.
      Class test{
      Public
      static int num;
      static int getnum () {... It can also be implemented here:}
      }
      int test::num = 10;
      int Test::getnum () {...}
      In addition, static member functions do not need to add the static keyword when they are implemented outside the class, otherwise it is wrong.

The E static member function does not have the this pointer, and it cannot return a non-static member because the class itself can be called, in addition to the object calling it. A static member function cannot call a non-static member of a class. Because the static member function does not contain the this pointer.
The F non-static member function can arbitrarily access static member functions and static data members.

G static member functions cannot be declared as virtual, const, or volatile functions at the same time.
H. The address of a static member function can be stored using a normal function pointer, whereas a normal member function address needs to be stored with a class member function pointer.

Note: The memory space of a static member variable is not allocated when declaring the class, nor is it allocated when the object is created, but rather at initialization time. The static member variable is independent of the object, does not occupy the object's memory, but opens up memory outside of all objects, even if the object is not created. Static member variables, like normal static variables, allocate memory at compile time at the static data area and are released at the end of the program.

Static member variables can be accessed either through an object or through a class. The form accessed through the class is: Class Name:: member variable; Object. Member variables

25. What is the anomaly mechanism? 26. A recent project, technical difficulties ah, how to overcome? 27. Operating system-related 28. Linux process, thread summary? Reference

Distinguishing Process Threads
A conceptual process is a program with a certain set of independent functions about a single run on a data collection. Process is the basic unit of system resource allocation and dispatch. Threads embody features that are executable and are the basic unit of CPU dispatch and dispatch.
Relationships a process can have multiple threads, but at least one thread. A thread thread must belong to a process
Resources
Allocation resources are assigned only to processes, and all the threads of the same process share all the resources of that process. Multiple threads in the same process share code snippets (code and constants), data segments (global variables and static variables), extension segments (heap storage). When the process ends, all the resources are recycled. The thread itself basically does not own system resources, only has a point in the running of the necessary resources (thread ID, program counters, a set of registers and stacks).
System
When a cost is created or revoked, the system allocates or reclaims resources, such as memory space, I/O devices, and so on. When the process is switched on, it involves the storage of the CPU environment of the entire current process and the setting of the CPU environment of the newly scheduled running process. Thread creation and switching only need to save and set the contents of a small number of registers, and do not involve the operation of memory management.

Communication interprocess communication: Message Queuing, shared memory. semaphores, signals, sockets, pipes. Shared process resources are directly accessible.
Synchronous process synchronization actually refers to thread synchronization in different processes.
Note: Some synchronization methods cannot span processes, such as critical sections. Mutex, semaphore, event, condition variable,
Critical section, read-write lock, etc.
Concurrency threads can give the system a higher level of concurrency.
Job: A collection of work that a user requires a computer system to do in a single transaction.
Process: The process of a program running on a data set.
Thread: An entity in a process.
Enhancement: A tube defines a data structure and a set of operations that can be performed (on that data structure) for a concurrent process, which synchronizes the process and alters the data in the pipe.

29. Thread Synchronization Mode

1) Critical area critical section only one thread is allowed to access the shared resource at any time.
2) Mutex: Similar to the critical section, only the line friend with the mutex has permission to access the resource, because there is only one mutex object, so it is determined that the shared resource will not be accessed by multiple threads at the same time in any case.
3) Semaphore: Number allows multiple threads to use shared resources simultaneously, which is the same as the PV operation in the operating system. The semaphore S is an integer, s greater than or equals zero represents the number of resource entities available to the concurrent process, but s less than zero indicates the number of processes waiting to use the shared resource. P Operations Request Resource v to release resources.
4) The event object can also maintain thread synchronization by notifying the operation. And can be implemented in different processes of thread synchronization operations.
Synchronous thread Process Linux kernel
The critical section is fast and suitable for controlling data access questions. xx
Mutual exclusion This 3 synchronization method can be used for thread synchronization in the same process, or for thread synchronization in different processes. The semaphore differs from the other 2 in that multiple threads can be run concurrently.
Note: The process synchronization described here actually refers to thread synchronization in different processes. X
Event X
Long-term lock-up of signal volume
Holding a lock is a need to sleep, dispatch
Note: The semaphore differs from the process thread.
Spin lock XX low cost plus lock
Short-term lock
Lock in interrupt context
Inter-thread communication
* Lock mechanism: Includes mutex, condition variable, read-write lock.
Mutexes provide an exclusive way to prevent data structures from being modified concurrently.
Read-write locks allow multiple threads to read shared data at the same time, and write operations are mutually exclusive.
A condition variable can block a process in an atomic manner until a particular condition is true. The test of the condition is performed under the protection of the mutex. A condition variable is always used with a mutex.
* Semaphore mechanism (Semaphore): Includes nameless thread semaphore and named thread semaphore
* Signaling mechanism (Signal): signal processing between similar processes

30. How does the process communicate?

1) There are two types of communication restrictions, one is half-duplex communication, the data can only flow one way, the other is only in the process of affinity between the use. A process's affinity usually refers to a parent-child process relationship.
2) Semaphore is a counter that can be used to control access to shared resources by multiple processes.
3) signal is a more complex way of communicating to inform the receiving process that an event has occurred. Primarily as a means of synchronizing between processes and between different threads of the same process.
4) shared memory is the mapping of memory that can be accessed by other processes, which is created by a single process, but can be accessed by multiple processes. Shared memory is the fastest way to IPC
5) Message Queuing is a linked list of messages, stored in the kernel and identified by message queue identifiers. Message Queuing overcomes the disadvantages of less signal transmission information, only unformatted byte stream, and limited buffer size.
6) Socket: Unlike other communication mechanisms, it can be used for process communication between different machines.
31. The four conditions that generate a deadlock, and how are they handled? Not finished
1) Mutually exclusive conditions, a resource can only be used by one process at a time.
2) The inalienable condition, the resources that the process has acquired, shall not be forcibly deprived until it is exhausted.
3) Request to maintain the condition, a process because of the request for resources to block the time, to have been obtained hold.
4) Cyclic waiting conditions, multiple processes to form a closure of the waiting relationship.
Mutually exclusive conditions cannot be destroyed, only three additional
Avoid deadlocks: Banker algorithms.

The IO multiplexing has epoll, poll, select? Linux network programming, not familiar with

The same line range the purpose of processing multiple IO requests at the same time.
The first two are polling, the back one is callback, so the efficiency is high. 1 is an array implementation. 2 is a list of the implementation of 3 is a red-black tree. And there is a user-to-kernel copy process, 3 is not, because it uses the shared memory mechanism.

What are the common Linux commands? "Bird's-brother Linux private Cuisine"

? File system architecture and basic operations
Ls/chmod/chown/rm/find/ln/cat/mount/mkdir/tar/gzip ...
? Learn to use some text manipulation commands Sed/awk/grep/tail/less/more ...
? Learn to use some administrative commands
Ps/top/lsof/netstat/kill/tcpdump/iptables/dd ...

34. Hash table? Notebook issue 2535. Database transactions?

A sequence of operations performed as a single logical unit of work, either completely or completely without execution.
ACID (atomicity, consistency, isolation and durability)

37. Find the number k in the array? 30 questions on offer.
    1. Direct sort. Complexity O (NLOGN)
    2. Take advantage of the idea of quick sorting. Use partition to find index k-1. The complexity of O (n). One partition is the complexity of O (n), which is often divided into several times.
    3. Maintains the largest heap of a K-node. The complexity is O (Nlog (k)). Can be implemented using STL's set.
38. What are the sorting algorithms? Quick Sort implementation? Best time complexity, average time complexity? How do you write the strcpy function? What is the strcpy return type for? What containers do stl have, compare vectors and set? 41. Definition and interpretation of red and black trees? B-Tree, the basic nature of A + + tree?

Nature 1. The nodes are red or black.
Nature 2. The root node is black.
Properties 3 each leaf node is black.
Property 4 The two child nodes of each red node are black. (no two consecutive red nodes can be found on all paths from each leaf to the root)
Nature 5. All paths from any node to each of its leaves contain the same number of black nodes.

43. What are the common cryptographic algorithms?

Symmetric encryption is the use of the same key for encryption and decryption.
Asymmetric encryption is the use of encryption and decryption is not the same key, usually have two keys, called the "Public key" and "private key", they are two must be paired with, otherwise you cannot open the encrypted file.
DES (Data Encryption Standard): symmetric algorithm, data encryption standards, fast, suitable for encrypting large amounts of data;
A typical application of MD5 is to produce a fingerprint (fingerprint) of a message to prevent it from being "tampered with".
RSA is the first algorithm that can be used both for data encryption and for digital signatures.

A. HTTPS?

The SSL layer is added under HTTP, and the security base of HTTPS is SSL.

Summary of interview topics in C + +

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.