Building master 8 push inside, 29 finish all process, one and two face separated by a little far, some questions can not remember too clear, here can think of all write down.


One side (1 hour) :


In the first 10 minutes, WE talked briefly about the research direction. C++ all the way back.
Q: the main language is C++, right? Let’s look at the basics of C++ first.
A: all right.


Q: how do constants are defined in C++? Where are constants stored in memory?
A: A constant in C++ is defined as A top-level const plus the type of the object. The constant definition must be initialized. For local objects, constants are stored in the stack area, and for global objects, constants are stored in global/static storage. For literal constants, constants are stored in the constant store.


Q: You said const. What is the purpose of const modifying a member function?
A: A const qualified member function indicates that the call does not make any changes to the object. In fact, if you are sure that no changes will be made to the object, you should qualify the function with const so that it can be called from either const or plain objects.


Q: Is there a problem with defining two functions, one with const and one without?
A: No, this is equivalent to an overload of the function.


Q: can reference data members be defined in C++ classes?
A: Yes, it must be initialized through the member function initializer list.


Q: How is new/delete different from malloc/free?
A: First, new/delete is A C++ keyword, while malloc/free is A C language library function, which must specify the size of the requested memory space. For objects of class type, malloc/free does not call the constructor and destructor.


Q: You write about implicit conversions in your blog. Can you talk about them briefly?
A: First, for built-in types, an implicit type conversion occurs when A low-precision variable is assigned to A high-precision variable. Second, for object constructs that only have A single-parameter constructor, the function call can be passed in with that parameter, and the compiler automatically calls its constructor to generate temporary objects.


Q: How can you avoid it?
A: Explicit keyword.


Q: Tell me what you know about type conversions.
A: there are four types of C++ conversions. (Please check these four by yourself)


Q: Talk about reinterpret_cast.
A: This is uncommon and can be used to convert between Pointers of any type, with no guarantee of the result of the conversion, and may be used for hashing.


Q: Talk about dynamic_cast
Dynamic itself can only be used for parent-child casts of virtual functions. For Pointers, nullptr is returned. For references, nullpTR is thrown.


Q: Tell me about CONST_cast
A: Actually, it’s quite common. For member functions that do not define const versions, we usually need to use const_cast to remove the const from the reference object to complete the function call. Another way to use this, with static_cast, is to add const to a nonconst member function and then use const_cast to remove the const qualification after calling the const member function.


Q: Tell me what you know about RTTI.
A: runtime type checking, at the C++ level, is mainly embodied in dynamic_cast and typeid.


Q: How did it happen?
A: Position -1 of the virtual function table in VS holds A pointer to type_info. For types with virtual functions, both TypeID and dynamic_cast query type_info.


Q: You mentioned virtual function tables, how to implement runtime polymorphism.
A: To put it simply, if A subclass overrides A virtual function of its parent class, the address of the function will be replaced in the virtual function table. For the object of the class with virtual functions, in VS, the head of the object’s object model stores Pointers to the virtual function table, which realizes polymorphism through this mechanism.


Q: what is the maximum stack space of C++ functions?
A: The default is 1M, but it can be adjusted.


Q: Extern “C”?
A: Extern C is required when C++ calls C functions, because the C language does not have function overloads.


Q: Do you know the design mode? Introduce the single example mode.
A: there are two implementations of C++. One uses local static variables that are initialized only once to return objects. GetInstance determines whether the pointer is null and instantiates the object if it is null.


Q: The second type you mentioned is called lazy loading. Now there is a question of what to do if you have concurrent access.
A: Use the lock mechanism to prevent multiple accesses.


Q: Does your lock lock all codes?
A: yes.


Q: This will repeatedly determine whether it is empty, but each time will lock, how to improve?
A: It can be done like this. The first judgment is empty without locking. If it is empty, the lock is performed to determine whether it is empty.


Q: you mentioned the locking mechanism, so you know several C++ locks.
A: Locks include mutex, condition variables, spin locks, and read/write locks.


Q: Tell me what you use.
A: The producer-consumer problem can be easily solved using mutexes and condition variables, which here act as A surrogate semaphore. Balabala.


Q: two maps in C++.


A: Unordered_map (hash table) and map (red-black tree)


Q: What about red black trees?
A: Just know that the essence is A BST, insert O (logN).


Q: What is the worst time complexity of quicksort?
A: O (N2)


Q: When is the worst?
A: The elements to the left of the pivot element are smaller than the pivot element (uncertain).


Q: What kind of stable sort? Why is that?
A: Look it up in your textbook. It’s easy.


Q: Let’s talk about computer networks. What is the TCP three-way handshake?
A: Please refer to relevant textbooks for this part.


Q: Why not twice?
A: The server does not receive the connection confirmation from the client, so it must be sent three times.


Q: Four times?
A: The third handshake after connection confirmation already contains client data, not four.


Q: TCP congestion is understood.
A: No. (Skip this part).


Q: What are the necessary conditions for deadlock?
A: Four requirements.


Q: How to prevent it?
A: -Please check your book.


Q: The last few questions, how do you improve yourself, in language?
A: I will read some classic books carefully. At the same time, I will also read some books that introduce new features of the language to keep sensitive.


Q: What books are there?
A: C++ primer, A classic introduction to the C++ object model, helps me understand the C++ object model. Effective C++, the classic advanced use of C++ experience. Effective modern C++ : an in-depth look at the new C++11/14 features.


Q: tell me about the C++primer that you felt most deeply about.
A: this book is A must-read for getting started. What impressed me most was the new features of C++ 11, such as automatic type derivation, lambda, rvalue references (interrupted here).


Q: What books are you reading now?
A: I’m looking at STL source code analysis.


Q: That’s all my questions. Do you have any questions for me?
A: About my interview. (good command of C++)


It was so long ago, maybe I can’t remember something. At that time, the whole process was basically C++ content, with a little interspersed with problems from other fields.


Second interview: The second interview is very dramatic and not suitable for most people. It involves discussing research with the interviewer throughout the interview and ends in 15 minutes.


Three Sides (3.26) :
The first thing I did was ask about my research direction for 10 minutes, and then C++.
Question 1:
Q: How does C make function calls?


A: Each function call allocates A function stack and executes the function within the stack.
Q: Next: C parameter pushdown order?
A: From right to left
Q: How does C handle return values?
A: C does not know that C++ generates A temporary variable and passes A reference to it as A function parameter.


Question 2:

Q: how does C++ handle memory leaks?
A: A lot of nervous nonsense, remind everyone, will not directly say no.


Question 3:
How does C++ handle program exceptions?
A: View the corresponding error code and locate the specific problem according to the code. (nonsense)


Question 4:

Q: Factory mode? Advantages?

A: The advantages are decoupling, code reuse, easy to change functionality.


HR (3.29) : Avoid stepping on the HR surface, mainly some personality problems to be careful, nothing else.
Confirm the OFFER (3.30) : Discuss the work content and duration of the internship with the supervisor.
That’s it. Most of the content prepared by the author is C++ and algorithm, but the final interview process is basically not asked about algorithm, language and research experience accounted for a large part, the summary is that you must have a particular good at one aspect to impress your interviewer.

Gold-digging techniques: links to 👉 https://juejin.cn/post/1