Home  >  Article  >  Backend Development  >  Programmer Interview: Top 42 Phone Interview Questions and Answers (Part 1)

Programmer Interview: Top 42 Phone Interview Questions and Answers (Part 1)

WBOY
WBOYOriginal
2016-08-08 09:27:26988browse

This year is 2015. In the past few years, face-to-face (telephone interview) has been the most popular way to screen candidates for programmer positions. It makes it easy for both the employer and the employer to get to know each other. The candidate does not need to go to the location of the future employer, and the interviewer does not need to make additional arrangements. This is the second part of my article covering programmer interview questions. I got feedback that the first section was too focused on coding questions, and many programmers wanted me to make a similar list for the electrical questions. In order to successfully pass the interview and advance to the next round, you must answer all the questions related to your job requirements well enough. In most interviews for Java and C++ developers, you will not only encounter problems with the corresponding programming languages, but also with other technologies, such as SQL, XML, UNIX, Generic Programming, Object-Oriented Programming, Data Structures & Algorithms, Networking, Coding, and other aspects of the job. Due to the variability of programmer job interviews, you need to have special skills to present yourself in the way that the interviewer expects.

An important thing to remember is that when answering interview questions, raise key points as early as possible and always give key answers. Since interviewers' questions tend to cover a wide range of topics, they prefer critical answers rather than empty words like "OK, I know." In a face-to-face interview, you will have the opportunity to explain the problem in more depth. By the way, this is not a hard and fast rule, and based on how the interviewer reacts to your answer, you can get an idea of ​​what kind of response he expects. If he presses the question and expects you to say more, then you should say more. But if he immediately jumps to the next question, then you should answer clearly and concisely. In this article, I'm going to share with you some common interesting programming problems that have been adapted for electronics. Most of them come from the electronic side of technology companies, including banks like Barclays, Citi, Nomura, and Infosys, TCS, Companies like CTS, Tech Mahindra and HCL are providing services. Like I mentioned before, the interview questions are randomly selected, but most of them are based on basic knowledge because that's what the interviewer wants to test during the interview. Although most of these questions are aimed at junior developers (2 to 5 years of experience), senior and veteran programmers can still use them as questions for their own interviews. If you're an interviewer, you can use these questions to quickly screen candidates for development positions. I'll provide the short answer here, with a link to the longer answer.

The following is a list of almost 42programmer interview questions. These questions can be used to test any programmer, developer, software engineer, test and operations engineer as they are based on the fundamentals of programming. But they are best suited for programmers and developers. By the way, if you are a Java developer and looking for Javaelectronic interview questions, go check out that list. This list is more general and applies to all programmers, including Python, Ruby, Perl, and C# developers.

1. How much time does it take to get elements from hash table, binary tree and linked list? What if you have millions of records?

Hash table requires O(1) time, binary tree requires O(logN) (N is the number of nodes in the tree), and linked list requires O(N) ( N is the number of nodes in the linked list). If the data structure is working properly (for example, a hash table has no or relatively few collisions, a binary tree is balanced), millions of records do not affect efficiency. If it doesn't work properly, efficiency will decrease as the number of records increases.

2. What is the difference between overriding(Overriding) and overloading(Overloading)? (detailed answer)

Overrides are determined at runtime, and overloading is determined at compile time. And the mechanisms of overriding and overloading are different. For example, in Java, the signature of the overloaded method must be different from that of the original method, but the overriding signature must be the same.

3. What is the difference between forkinga process and spawning a thread?

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

4. What is the critical section? (answer)

The critical section is a piece of code, which is very important. In multi-threading, it can only be executed by one thread at the same time. Critical sections can be protected with semaphores or mutexes. In Java you can protect critical sections using synchronized keyword or ReentrantLock.

5. What is the difference between value types and reference types? (answer)

Value types are more optimized types that are always immutable (immutable), such as Javaoriginal int, long, double and float. A reference type points to an object, which may 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 the heap and stack in a process? (detailed answer)

In the same process, there are two different memory areas. In the case of Java, the stack is used to store primitive values ​​and reference types pointing to objects, but the objects themselves are always created on the heap. 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? (answer)

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

8. What is a strongly typed programming language? (answer)

In strongly typed languages, the compiler ensures the correctness of the types, for example you cannot store numbers in the String type and vice versa. Java is a strongly typed language, so there are various data types (like int, float, String, char, boolean etc.). You can only store compatible values ​​into corresponding types. In contrast, weakly typed languages ​​do not require type checking at compile time; they handle values ​​based on context. Python and Perl are two common examples of weakly typed programming languages, where you can store strings of numbers in numeric types.

9. Can you describe the valid(valid)XML and the correct format(well-formed)X The difference between ML?

Well-formed

XMLhas a root element, all tags are closed correctly, attributes are correctly defined, and their values ​​are properly quoted. On the other hand, valid XML can be validated against a XSD file or schema (schema). So an XML might be well-formed but not valid (because it contains tags that are not allowed by the schema).

10. What is the difference between DOM

and SAXparser? (detailed answer)

DOM

The parser is memory-resident, loading the entire XML file into memory and creating a DOM tree for syntax analysis. The SAXparser is an event-based parser, so it parses the XML document based on the events it receives (such as start tag, end tag, attribute start, and attribute end). According to their analysis method, DOMparser is not suitable for large XML files as it will take up a lot of memory space and your process may run out of memory. Large files should be analyzed using SAX. For small files, DOM tends to be much faster than SAX.

11.

What is the relationship between threads and processes? (detailed answer)

A process can have multiple threads, but a thread always belongs to the only process. Two processes cannot share memory space unless they intentionally communicate through shared memory for inter-process communication. But two threads of the same process always share the same memory.

12. What does immutable(immutable)class mean? (detailed answer)

A class is immutable if its state cannot be changed after creation. For example, String in Java. Once you create a String, such as "Java", you can no longer change its content. Any changes to this string (e.g. converting to uppercase, concatenating with another String) will create a new object. Immutable objects are useful in parallel programming because they can be shared between processes without having to worry about synchronization. In fact, the entire functional programming model is built on immutable objects.

13. Why do you want to create a mock (mock) object? (answer)

Mock objects are useful when testing an independent unit of software. In fact, stubs (stub) and mocks are both powerful tools for creating automated unit tests. Suppose you are writing a program that displays currency exchange rates, but there is no URL that can be connected. Now if you want to test your code, you can use a mock object. In the world of Java, there are many frameworks that can generate powerful mock objects for you, such as Mockito and PowerMock.

14. What is SQL injection?

SQLInjection is a security vulnerability that allows intruders to steal data from the system. Any system that takes input from the user and creates SQL queries without validation is potentially vulnerable to a SQLinjection attack. In such a system, an intruder can enter SQLcode instead of data to obtain additional data. There are many instances where sensitive information (such as user id, passwords, and personal information) has been harvested by exploiting this vulnerability. In Java, you can use the Prepared statement to avoid SQL injection.

15. In SQL, what is the difference between inner join(inner join) and left join(left join)? (answer)

In SQL, there are two main types of connections, inner joins and outer joins. Outer joins include right outer join and left outer join. The main difference between inner joins and left joins is that in inner joins only records that match both tables are selected, while in left joins records that match both tables are selected, plus all records in the left table are selected. Be aware of queries that contain "all", which often require left joins. For example, write a SQL query to find all departments and their number of employees. If you handle this query with an inner join, you'll miss empty departments where no one is working.

16. What does V in MVC stand for and what does it mean? (answer)

In the MVC pattern, V is the view (View). A view is what the user sees, such as a web page. This is a very important web application development design pattern. It is based on the principle of separation of concerns. The purpose is that different modules can be modified independently without affecting other modules. In the world of Java, there are many open source frameworks that offer the MVC pattern, such as Struts 2 and Spring MVC. By the way, M stands for model(Model), and C stands for controller(Controller). Models are the actual business objects, such as users, employees, orders, that the controller uses to distribute requests to the correct processing unit.

17. What is the difference between a class and an object? (detailed answer)

Classes are design drawings used to create objects. A class includes code and behavior, and an object includes state and behavior. To create an object, you must create a class that expresses the object's structure. Classes are also used to map objects in memory, and in Java, JVM does this work for you.

18. What is loose coupling(loose-coupling)?

Sparse coupling is a software feature worth pursuing, which allows modifications to one part of the software to not affect other parts. For example, in a loosely coupled software, changes to the layout of the UI should not affect the class structure of the backend.

19. What is the difference between combination(composition), aggregation(aggregation) and association(association)? (detailed answer)

Association means that two objects are related to each other. Combination is a form of association, that is, an object is composed of multiple objects, but they must coexist. For example, the human body is composed of various organs. Independent organs cannot survive and they must function within the body. Aggregation is also a form of association and represents a collection of objects. For example, a city is an aggregation of residents.

20. What is the difference between interface and abstract class? (detailed answer)

This is the most classic question in all programmer interviews. An interface is the purest form of abstraction, without anything concrete. An abstract class is a combination of abstract and concrete things. This difference may differ in different languages. For example, in Java you can extend (extend) multiple interfaces, but you can only inherit one abstract class. A more detailed discussion can be found in the detailed answer.

21. What is unit testing? (answer)

Unit testing is a way to test the functionality of independent units (rather than the entire application). There are many tools for unit testing in different languages. For example, in Java, you can use JUnit or TestNG to write unit tests. Unit tests are often run automatically at build time, or in a persistent environment such as Jenkins.

Get it for freeLAMPBand of BrothersOriginalPHPTutorialCD/ DetailsPHP》 Essential version, please contact the official website customer service for details: http://www.lampbrother.net

PHPCMSSecondary developmenthttp://yun.itxdl.cn/online/phpcms/index .php?u=5

WeChat developmenthttp://yun.itxdl.cn/online/weixin/index.php?u=5

Mobile Internet server-side development http://yun.itxdl.cn/online/server/index.php?u=5

JavascriptCoursehttp://yun.itxdl.cn/online /js/index.php?u=5

CTOTraining Camphttp://yun.itxdl.cn/online/cto/index.php?u=5

The above introduces the programmer interview: Top 42 telephone interview questions and answers (Part 1), including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn