Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common questions in the interview for C++ engineers?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

The editor would like to share with you what are the common questions in C++ engineer interview. I believe most people don't know much about it, so share this article for your reference. I hope you will learn a lot after reading this article. Let's find out together.

1. Is C++ an object-oriented programming language? what is the virtual in C++? What's the advantage?

(1) C++ is not a pure object-oriented language, C++ is object-oriented and process-oriented, because C++ supports classes and procedures.

(2) the virtual function (virtual) is transitive, that is, the rewriting of the virtual function of the parent class in the subclass is also a virtual function, but the parameter table of the function is the same.

(3) the operation of the member function can be generalized. When the pointer of the base class is used to point to the object of a different derived class, and the pointer of the base class calls its virtual member function, it will call the member function that really points to the object. Not the member function defined in the base class (as long as the derived class overrides the member function). If it is not a virtual function, the function defined in the base class is called no matter which derived class object the base class pointer points to.

2. talk about the difference between pointers and references.

Pointers use operators "*" and "- >", references use operators "&".

The common point is that both pointers and references allow you to refer to other objects indirectly.

The difference is: (1). A pointer is an entity that points to a block of memory whose content is the address of the memory it refers to, while a reference is just an alias, an alias for a block of memory.

(2)。 When using a reference, there is no need to dereference (*). The pointer needs dereferencing.

(3)。 References can only be initialized once when defined, and then immutable, "from one to the end"; the pointer is variable.

(4)。 References have no const type, pointers have const types, and pointers to const are immutable.

(5)。 Reference cannot be empty, pointer can be empty

(6)。 The "sizeof reference" gets the size of the variable (object) it points to, while the "sizeof pointer" gets the size of the pointer itself (the address of the variable or object it points to); typeid (T) = = typeid (T &) is always true, sizeof (T) = = sizeof (T &) is always true, but when the reference is a member, it takes up the same space as the pointer (no standard is found).

(7)。 The meaning of self-increment (+ +) operation of pointer and reference is different.

3. Int m = 100 and n = 101

Int & k = m

K = n; / / what are the values of K and m at this time?

The values of k and m are both 101, because k is a reference to m, the value of k changes, and so does the value of m.

4. In C++, the const modifier is generally used in those situations. What is the specific function?

(1)。 Define const int n = 100 with constants

For constant parameters, namely fn (const int & a)

For constant functions, that is, the function of the class does not modify its state.

Used to return a value

(2)。 Can define const constant, with immutability; facilitate type checking, so that the compiler has a better understanding of the content of processing, eliminating some hidden dangers; can protect the modified things, prevent accidental modification, enhance the robustness of the program; provide a reference for function overloading; can save space, avoid unnecessary memory allocation; improve efficiency. The compiler usually does not allocate storage space for ordinary const constants, but stores them in the symbol table, which makes it a constant during compilation. Without the operation of storing and reading memory, it is also very efficient.

5. Do you use assert in your program code? what is assert used for?

(1) it is often used by me.

(2) mainly used for DEBUG assertions, that is, the assumption must be so, otherwise it will be wrong. For example, asser (a > 100)

6. Which is more efficient than + + I? Why?

Answer: (1) + + I is more efficient than iTunes +.

(2) the construction and analysis function of the class should be called more than one time.

7. What are the network programming models under the windows platform? Which one are you most familiar with? And compare them?

(1) there is blocking, form-based event model, event model, overlap model, completion port model.

(2) what I am most familiar with is the event model.

(3) except for the blocking model, all the others are non-blocking models, among which the completion port model is the most efficient, especially the server under windows.

The event model is generally used as a client, which can be used in both window and like unix.

8. When tcp transmits, how does the receiver tell the sender, "I can no longer handle it, so don't send me any more data yet."

A: the receiver sends a notification packet to the sender, which asks the sender to suspend the sending of data, or send it slowly. After the recipient has finished processing, send a recovery notification packet.

9. How big is the udp network protocol package and why?

A: it is best designed to be the size of MTU. MTU is the abbreviation of Maximum Transmission Unit. It means the largest packet transmitted on the network. In this way, the transmission speed will be fast.

10. There are several versions of win2000/win2003. What is the latest system patch pack for each version?

11. How to realize DNS?

12. Load balancing of WEB servers?

13. What are the advantages and disadvantages of several network operating systems commonly used in the market at present?

Which servers have you used? Please describe the characteristics and advantages of raid0, 1, 5?

15. List the segment slogans of the following protocols: HTTP, HTTPS, DNS, FTP, TELNET, PPTP, SMTP, POP3?

16. What protocols or ports do you need to open on the other computer if you want to access the other computer through the UNC path or NETBIOS name in the local area network?

17. OSI seven-layer model? TCP/IP model?

18. Can I upgrade WIN2000P to WIN2000S?

The above is all the contents of the article "what are the frequently asked questions for C++ engineer interview". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report