Home > Backend Development > PHP Tutorial > Programmer Interview: Top 42 Phone Interview Questions and Answers (Part 2)

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

WBOY
Release: 2016-08-08 09:27:25
Original
990 people have browsed it

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, 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.

22. Can you describe three different ways to test an app before releasing it?

Unit testing, integration testing, smoke testing. Unit testing is used to test whether independent units work as expected. Integration testing is used to test whether independent units that have been tested can work together. Smoke testing is used to test whether the most commonly used functions of the software work normally, such as in an aircraft ordering process. In the ticket website, you should be able to book tickets, cancel or change flights.

23. What is the difference between iteration and recursion? (detailed answer)

Iteration performs the same step repeatedly through a loop, and recursion does repetitive work by calling the function itself. Recursion is often a clear and concise solution to complex problems such as the Tower of Hanoi, reversing a linked list, or reversing a string. One drawback of recursion is depth. Since recursion stores intermediate results on the stack, you can only go to a certain depth of recursion, after which your program will crash with StackOverFlowError. This is why iteration is preferred over recursion in production code.

24. What is the difference between & and && operators? (detailed answer)

& are bitwise operators, && are logical operators. One difference between & and && is that bitwise operators (&) can be used for integer and boolean types, and logical operators (&&) can only be used for Boolean type variable. When you write a & b, each bit of the two integers is ANDed. When you write a && b, the second parameter may or may not be executed, which is why it is called a short-circuit operator, at least in Java. I love this question and often ask it to junior developers and graduates.

25. What is the result of 1 XOR 1?

The answer is 0 because XOR returns 1 when the two operands (bitwise) are different and 0 when they are the same. For example 0 XOR 0 is still zero, but the result of 0 XOR 1 and 1

26.

How to get the last digit of an integer?

(answer)

Using the modulo operator, the number % 10

returns the last digit of the number. For example,

2345 % 10 will return 5, 567 % 10 will return 7. Similarly, the division operator can be used to remove the last digit of a number. For example, the result of 2345 / 10 is 234, and the result of 567 / 10 is 56. This is an important technique to know and can be used to solve problems like palindromes and reversals.

27.

What is test-driven development?

Test-driven is a common development approach in which test code is written before functional code. Tests determine the structure of the program. Test-driven purists don't write a single line of application code before writing tests for the application. This can greatly improve code quality and is often considered the quality of a superstar developer.

28.

Liskov substitution principle

(Liskov substitution principle, LSP)

What is it? (answer)The Richter Substitution Principle is one of the five design principles that Uncle Bob calls SOLID

. The Liskov Substitution Principle stipulates that all subclasses can work as the proxy

(proxy) of the parent class. For example, if a method requires a parent class object as input, it should also work fine if you provide a child class object. Any class that cannot replace its parent class violates the Liskov Substitution Principle. This is actually a difficult question to answer, but if you answer it well, it will leave a good impression on the interviewer.

29.

What is the design principle of opening and closing

(Open closed)

? (answer)The open-closed principle is another important principle in SOLID

, which stipulates that a system is open to expansion but closed to modification. This means that if a new feature is to be added to a stable system, then you do not need to touch the existing code that has been tested, the new feature can be implemented by just adding new classes.

30.

What is the difference between a binary tree and a binary search tree?

Binary search tree is an ordered binary tree. The value of the left subtree node of all nodes (such as the root node) is less than or equal to the value of the node, and the value of the right subtree node is greater than or equal to the node. value. It is an important data structure that can be used to represent ordered data.

31.

Can you give a practical example of a recursive algorithm?

(example)

Recursive algorithm can be applied in many places, such as algorithms related to binary trees and linked lists. A few examples with recursive algorithms include reversing a string and calculating the Fibonacci sequence. Other examples include reversed linked lists, tree traversal, and quick sort.

31.

What is the time complexity of the algorithm?

Time complexity represents the ratio of running time to input amount. It indicates how long it takes an algorithm to process a certain amount of input. It's an estimate, but it's a good indication of how your algorithm will perform as the number of inputs increases from ten to ten million.

33.

What are the important differences between linked lists and arrays?

(detailed answer)

Linked lists and arrays are both important data structures in the programming world. The most obvious difference between them is that arrays store elements in consecutive addresses, while linked lists store data in any location in memory. This gives the linked list tremendous flexibility to expand itself, since memory is always spread out. This situation is always possible: you cannot create an array to store a million integers, but you can use a linked list to store them, because the space is there, it is just not contiguous. All other differences arise from this fact. For example, in an array, if you know the subscript, you can get an element in O(1) time, but in a linked list it takes O(n) time. See the detailed answer for more differences.

33. What are the methods to handle conflicts in hash tables?

Linear probing(linear probing), quadratic hashing(double hashing) and linking(chaining). In linear probing, if a bucket is already occupied, the function checks the next bucket linearly until an empty slot is found. In a chain, multiple elements can be stored in the same bucket.

34. What does regular expression mean? (answer)

Regular expressions are a method of pattern matching on textual data. It is a powerful way to search for certain characters in long strings, such as searching for a certain word in a book. All major programming languages ​​support regular expressions, but Perlregular expressions are famous for their capabilities. Java’s java.util.regex package also supports regular expressions similar to Perl. You can use regular expressions to check if the email address is valid, if the phone number is valid, if the zip code is valid, and even if the social security number (SSN) is valid. One of the simplest examples of regular expressions is checking whether a string is a number.

35. What is a stateless(stateless) system?

A stateless system is a system that does not maintain internal state. Such a system will give the same output for the same input at any time. It is always easier to write and optimize a stateless system, so you should always prioritize writing stateless systems if possible.

36. Write a SQLquery to find the second highest salary in the employees table. (solution)

This is one of the classic questions in SQL interviews. Although it is very old, it is still interesting and can ask many questions to test the depth of the candidate's knowledge. You can use a correlated or unrelated subquery to find the second highest salary. If you are using SQL Server or MySQL, you can also use keywords like TOP and LIMIT if the interviewer allows it. The shortest answer to find the second highest salary is:

This query first finds the highest salary, then excludes it from the list, and then finds the highest salary. Obviously, the second return is for the second highest salary.

37. Can you describe what are correlated and uncorrelated subqueries? (answer)

In a correlated subquery, the inner query depends on the outer query and is executed for each row of the outer query. Non-correlated subqueries do not depend on the outer query and can be executed independently. Therefore, the former is slow and the latter is fast. By the way, correlated subqueries have some great applications, including finding the Nth highest salary in an employees table, which was also mentioned in the previous SQL question.

39. How to determine whether a number is a power of two without using arithmetic operators? (solution)

When you hear the restriction that arithmetic operators cannot be used, you should immediately assume that this is a question about bit operations. Without this restriction, you could easily check whether a number is a power of two using the modulo and division operators. There is a neat way to accomplish the task using bitwise operators. You can use the following code to check if a number is a power of two

1

2

3

public static boolean powerOfTwo(int x) {

return ( x & (x - 1)) == 0;

}

x & (x-1) is a great trick to convert the rightmost bit to 1 Set to 0. I learned this from the book "Secrets of Effective Programming".

40. How to find a running Java process on UNIX? (command)

You can use a combination of ps and grep commands to find any process on a UNIX machine. Assuming your Java process has a name, or any text that can be used to match, then use this command.

ps -ef | grep "myJavaApp"

ps -e will list all processes (all user's processes, not just yours), ps -f will show all details , including PID. If you want to investigate further or kill the process with the kill command, you will need the PID.

41. How to find large files in UNIX, such as files above 1GB? (command)

You can easily find large files using the find command as it provides the option to find files based on size. If your file system is full and your Java process crashes because there is no space, then use this command. This command can list all files larger than 1GB. You can easily change the size, for example to find all files above 100MB, just use +100M.

find . – type f -size +1G -print

42. What is the shellscript?

shellA script is a set of shellcommands containing procedural elements (such as if and forloops) that can automate some repetitive tasks. For example, you can write a shell script to clean log files every day, backup data for historical recording, and other housework, version release, monitoring, etc.

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 Developmenthttp://yun.itxdl.cn/online/server/index.php?u=5

JavascriptCourseshttp://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 2), including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template