Current location - Quotes Website - Signature design - What questions do interviewers often ask in graduation interviews for computer majors?
What questions do interviewers often ask in graduation interviews for computer majors?
1. How long does it take to get elements from hash table, binary tree and linked list? What if you have millions of records?

Hash table needs O( 1) time, binary tree needs O(logN) (N is the number of nodes in the tree), and linked list needs o (n is the number of nodes in the linked list). If the data structure works normally (for example, hash table has no conflicts or relatively few conflicts, and binary tree is balanced), millions of records will not affect efficiency. If the work is not normal, the efficiency will decrease with the increase of the number of records.

2. What is the difference between rewriting and overloading? ?

Overrides are determined at run time and overloads are determined at compile time. The mechanisms of overwriting and overloading are different. For example, in Java, the signature of an overloaded method must be different from that of the original method, but it must be the same for overwriting.

3. What is the difference between a fork process and a generation thread?

When you spawn a process, the new process will execute the same code as the parent process, but in different memory space. But when you generate a thread in an existing process, it will generate a new code execution path, but * * * enjoys the same memory space.

4. What is the critical zone? ?

Critical section is a piece of code, which is very important and can only be executed by one thread in multithreading. You can use semaphores or mutexes to protect key parts. In Java, you can use the synchronized keyword or ReentrantLock to protect critical sections.

5. What's the difference between a value type and a reference type? ?

Value types are more optimized and will never change, such as the original int, long, double and float in Java. A reference type points to an object, which can be mutable or immutable. You can also say that a value type points to a value and a reference type points to an object.

6. What are heaps and stacks in a process?

In the same process, there are two different memory areas. In Java, the stack is used to store original values and reference types pointing to objects, but the objects themselves are always created in the stack. An important difference between heap and stack is that heap memory is shared by all threads, but each thread has its own stack.

7. What is version control?

Version control is software used to store code and manage code base versions, such as SVN, CVS, Git, Perforce and ClearCase. They are very efficient in comparing code, reviewing code and building code from previous stable versions. All professional developers use some version control tools, otherwise you can't manage the code effectively, especially if there are 20 developers working on the same code base. Version control tools play a very important role in keeping the consistency of code base and dealing with code conflicts.

8. What is strongly typed programming language?

In strongly typed languages, the compiler ensures the correctness of the type. For example, you can't store numbers in a string type, and vice versa. Java is a strongly typed language, so there are various data types (such as int, float, String, char, boolean, etc. ). You can only store compatible values in the corresponding type.

In contrast, weakly typed languages do not need type checking at compile time, and they process values according to the context. Python and Perl are two common examples of weakly typed programming languages. You can save a string of numbers as a number type.