Programmer Interview: Phone interview top 42 (below)

Source: Internet
Author: User
Tags bitwise operators integer numbers
: This article mainly introduces the Programmer Interview: top 42 (below) in the telephone interview Q & A. If you are interested in the PHP Tutorial, please refer to it. This year is July 2015. in the past few years, electronic Interview (Telephone interview) is the most popular way to screen candidates for programmer positions. It makes it easy for both employers to understand each other. candidates do not need to go to the location of the employer in the future, and the interviewer does not need to make additional arrangements. This is the second part of my article about programmer interviews. I got feedback that the first part is too coding-intensive. many programmers want me to list a similar list of electrical problems. In order to smoothly enter the next round through the electric plane, you must answer all the questions related to your work requirements well. In most of the electrical aspects for Java and C ++ developers, you will not only encounter problems with the corresponding programming language, but also encounter other technical problems, for example, SQL, XML, UNIX, generic programming, object-oriented programming, data structures and algorithms, network, coding, and other aspects of work. Due to the variability of the programmer's job-seeking power, you need special skills to present yourself as the interviewer expects.

It is important to remember that when answering an electrical problem, key points should be raised as early as possible, and key answers should always be given. Because the interviewer's questions often cover a wide range of topics, they prefer key answers, rather than empty talk like "OK, I know. In a face-to-face interview, you will have a chance to explain the problem in depth. By the way, this is not a fixed rule. based on the interviewer's response to your answer, you can understand what kind of answer he expects. If he asks you more, you should say more. But if he jumps to the next question immediately, you should answer the question clearly and concisely. In this article, I will share with you some common interesting programming problems that have been adapted for electrical surfaces. Most of these are from the electrical aspects of technology companies, including Barclays, Citi, Nomura and other banks, and companies that provide services such as Infosys, TCS, CTS, Tech Mahindra, and HCL. As I mentioned before, interview questions are randomly selected, but most of them are based on basic knowledge, because they are what the interviewer wants to examine on the electrical surface. Although most of these questions are for junior developers (2 to 5 years of experience), senior and senior programmers can still use them as their own interview questions. If you are an interviewer, you can use these questions to quickly screen candidates for development positions. I will provide a brief answer here and provide a link to the detailed answer.

The following is a list of almost 42 electrical questions for programmers. These questions can be used to examine any programmer, developer, software engineer, test and Operation engineer because they are based on the basic knowledge of programming. But they are most suitable for programmers and developers. By the way, if you are a Java developer and are looking for a Java electrical question, go to the list. This list is more common for all programmers, including Python, Ruby, Perl, and C # developers.

22. can you describe three different ways to test an application before it is released?

Unit testing, integration testing, Smoke testing. Unit tests are used to test whether an independent unit works as expected. integration tests are used to test whether an independent unit has been tested can work together. smoke tests are used to test whether the most common functions of the software work normally, for example, on an airplane ticket booking website, you should be able to book tickets, cancel or change flights.

23. what is the difference between iteration and recursion? (Detailed answer)

Iterations repeat the same step through loops, and recursively call the function itself for repetitive work. Recursion is often a clear and concise solution to complex problems (such as Tower of Hanoi, reverse linked list, or reverse string. One of the defects of recursion is depth. because recursion stores intermediate results in the stack, you can only perform a certain depth of recursion. after that, your program will crash due to StackOverFlowError. This is why iteration rather than recursion is preferred in product code.

24. what is the difference between & and & operators? (Detailed answer)

& Is a bitwise operator and & is a logical operator. A difference between & and & is that bitwise operators (&) can be used for integer and Boolean types. logical operators (&) can only be used for Boolean variables. When you write a and B, each of the two integer numbers is connected to each other. When you write a & B, the second parameter may not be executed, which is also known as the short-circuit operator, at least in Java. I like this question very much. I often ask this question to junior developers and graduates.

25. what is the result of XOR 1?

The answer is 0, because XOR returns 1 at the same time in two operands (bitwise) and 0 at the same time. For example, 0 XOR 0 is still zero, but the result of 0 XOR 1 and 1 XOR 0 is 1.

26. how do I get the last digit of an integer? (Answer)

The modulo operator returns the last digit of a number % 10. For example, 2345% 10 returns 5,567% 10 and 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,567/10 and 56. This is an important technique worth understanding and can be used to solve the problem of similar number of input and reverse numbers.

27. what is test-driven development?

Test-driven is a common development method in which the test code is written before the function code. The test determines the program structure. The test-driven purist will not write a line of application code before writing a test to an application. This can greatly improve the code quality, which is often regarded as the quality of superstar developers.

28. what is the Liskov substitution principle (LSP) principle? (Answer)

The RYS replacement principle is one of the five design principles Uncle Bob called SOLID. The RYS replacement principle stipulates that all child classes can work as proxies of the parent class. For example, if a method requires a parent class object as the input, it should also work normally if you provide a subclass object. Any class that cannot replace the parent class violates the Lee's replacement principle. This is actually a difficult question to answer. if you answer this question, it will leave a good impression on the interviewer.

29. what is the Open closed design principle? (Answer)

The principle of open/closed is another important principle in SOLID. it stipulates that a system is open to expansion, but it is closed to modification. This means that if a new function is to be added to a stable system, you do not need to touch the existing code that has been tested, new functions can be implemented by adding only new classes.

30. what is the difference between a binary tree and a binary tree?

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

31. can you give an actual example of a recursive algorithm? (Example)

Recursive algorithms can be applied in many places, such as algorithms related to binary trees and linked lists. Examples of several recursive algorithms include reversing strings and calculating the Fibonacci series. Other examples include reverse linked list, tree traversal, and fast sorting.

31. what is the time complexity of the algorithm?

Time complexity indicates the ratio of running time to input. It indicates how long it takes for an algorithm to process a certain amount of input. It is an estimate, but it is enough to indicate the performance of your algorithm when the input volume increases from 10 to 10 million.

33. What are the important differences between linked lists and arrays? (Detailed answer)

Linked lists and arrays are important data structures in the programming world. The most obvious difference between them is that arrays store elements in successive addresses, and linked lists store data anywhere in the memory. This gives the linked list great scalability because the memory is always scattered. This is always possible: you cannot create an array to store 1 million integers, but you can use a linked list to store them because space exists, but they are not continuous. Other differences are derived from this fact. For example, if you know the subscript in an array, you can use the time of O (1) to get an element, but it takes O (n) time in the linked list. For more information, see the answer.

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

Linear probing, double hashing, and chaining ). In linear detection, if the bucket is occupied, the function will linearly check the next bucket until a vacant space is found. In the link, multiple elements can be stored in the same bucket.

34. what does a regular expression mean? (Answer)

Regular expressions are used for pattern matching on text data. It is a powerful search method, such as searching for certain characters in a long string, for example, searching for whether a book contains a word. All mainstream programming languages support regular expressions, but the Perl regular expressions are well-known. The Java. util. regex package in java also supports regular expressions similar to Perl. You can use a regular expression to check whether the email address is valid, whether the phone number is valid, whether the zip code is valid, or even whether the Social Insurance Number (SSN) is valid. One of the simplest examples of regular expressions is to check whether a string is a number.

35. what is a stateless system?

Stateless systems do not maintain internal states. Such a system provides the same output for the same input at any time. It is always easy to compile and optimize a stateless system. if possible, you should always write a stateless system first.

36. write an SQL query to find the second highest salary in the employee table. (Solution)

This is one of the classic questions of SQL interviews. although it is very old and interesting, you can ask a lot of questions to test the knowledge depth of candidates. You can use related or irrelevant subqueries to find the second highest salary. If you are using SQL Server or MySQL, you can also use keywords such as TOP and LIMIT, provided that the interviewer permits. The simplest way to find the second highest salary is:

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

37. can I describe what is an associated and unrelated subquery? (Answer)

In the associated subquery, the inner layer query depends on the outer layer query, and each row of the external layer query is executed. Non-correlated subqueries are independent of outer queries and can be executed independently. Therefore, the former is slow, and the latter is fast. By the way, the associated subqueries have some great applications, including finding the Nth highest salary in the employee table, which is also mentioned in the previous SQL question.

39. how can I determine whether a number is a power of two without arithmetic operators? (Solution)

When you hear that arithmetic operators cannot be used, you should immediately assume that this is a bit operation question. Without this restriction, you can use the modulo and division operators to check whether a number is a power of two. Using bitwise operators, there is a clever way to complete the task. You can use the following code to check whether 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 set the rightmost bit of 1 to 0. I learned from the book "The Mysteries of efficient procedures.

40. how to find a running Java process on UNIX? (Command)

You can use the ps and grep commands in combination to find any process on a UNIX machine. If your Java process has a name or any text that can be used for matching, use this command.

Ps-ef | grep "myJavaApp"

Ps-e will list all processes (all user processes, not just yours), ps-f will show all details, including PID. If you want to investigate in depth or use the kill command to kill the process, you need a PID.

41. how to find large files in UNIX, such as files larger than 1 GB? (Command)

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

Find.-type f-size + 1G-print

42. what is a shell script?

A shell script is a set of shell commands that contain program elements (such as if and for loops). It can perform repeated tasks automatically. For example, you can write a shell script to clean up log files every day, and record historical backup data, as well as other household chores, version releases, monitoring, and so on.

Get free LAMP Brothers original PHP Tutorial CD/the elaborate PHP Essentials edition, details consulting official website Customer Service: http://www.lampbrother.net

PHPCMS secondary development http://yun.itxdl.cn/online/phpcms/index.php? U = 5

Develop http://yun.itxdl.cn/online/weixin/index.php? U = 5

Mobile internet server development http://yun.itxdl.cn/online/server/index.php? U = 5

Javascript http://yun.itxdl.cn/online/js/index.php course? U = 5

CTO training camp http://yun.itxdl.cn/online/cto/index.php? U = 5

The above introduces the Programmer Interview: Top 42 (below) of the telephone interview Q & A, including some content. I hope my friends who are interested in PHP tutorials can help me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.