Interviewer And Interviewee Guide

Role-specific Analyst Integration Interview Questions & Answers:

1. Explain regular expression?

Regular expression is a way to perform pattern matching on text data. It's very powerful tool to find something e.g. some character in a long string e.g. finding if a book contains some word or not. Almost all major programming language supports regular expression but Perl has been renowned for its enormous capability. Java also supports Perl like regular expression using java.util.regex package. You can use regular expression to check if a email is valid or not, if a phone number is valid, or if a zip code is valid, or even a SSN number is valid or not. One of the simplest example of regular expression is to check if a String is number or not.

2. Can you please explain the difference between linked list and an array?

linked list and array are two of the most important data structure in programming world. Most significant difference between them is that array stores its element at contiguous location while linked list stores its data anywhere in memory. This gives linked list enormous flexibility to expand itself because memory is always scattered. It's always possible that you wouldn't be able to create an array to store 1M integers but can do by using linked list because space is available but not as contiguous chunk. All other differences are result of this fact. For example you can search an element in array with O(1) time if you know the index but searching will take O(n) time in linked list. For more differences see the detailed answer.

3. Explain shell script?

shell script is set of shell commands with some programming constructs e.g. if and for loop, which allow you to automate some repetitive task. For example, you can write shell script to daily cleanup of logs files, for backing up data for historical use and for other housekeeping jobs, releases and monitoring.

4. How to find large files in UNIX e.g. more than 1GB?

You can easily find big files by using find command because it provides option to search files based upon there size. Use this if your file system is full and your Java process is crashing with no more space. This command will list all files which is more than 1GB. You can tweak the size easily e.g. to find all files with more than 100 MB just use +100M.

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

5. Can you please explain the difference between correlated and non-correlated subquery?

In correlated sub-query, inner query depends upon outer query and executes for each row in outer query. While non-correlated sub query doesn't depend upon outer query and can be executed independently. Due to this reason former is slow and later is fast. BTW, correlated subquery has some nice application, one of them is finding Nth highest salary in Employee table, as seen on previous SQL question as well.

6. How to find a running Java process on UNIX?

You can use combination of 'ps' and 'grep' command to find any process running on UNIX machine. Suppose your Java process has a name or any text which you can use to match against just use following command.

ps -ef | grep "myJavaApp"

ps -e will list every process i.e. process from all user not just you and ps -f will give you full details including PID, which will be required if you want to investigate more or would like to kill this process using kill command.

7. How to find if a number is power of two, without using arithmetic operator?

Assume its a question about using bitwise operator as soon as you hear restriction about not allowed to use arithmetic operator. If that restriction is not in place then you can easily check if a number is power of two by using modulus and division operator. By the using bitwise operator, there is a nice trick to do this. You can use following code to check if a number if power of two or no.

8. Write an SQL query to find second highest salary in employee table?

This is one of the classic question from SQL interviews, event it's quite old it is still interesting and has lots of follow-up you can use to check depth of candidate's knowledge. You can find second highest salary by using correlated and non-correlated sub query. You can also use keyword's like TOP or LIMIT if you are using SQL Server or MySQL, given Interviewer allows you. The simplest way to find 2nd highest salary is following :

SELECT MAX(Salary) FROM Employee WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee)

This query first find maximum salary and then exclude that from list and again finds maximum salary. Obviously second time, it would be second highest salary.

9. Explain stateless system?

A stateless system is a system which doesn't maintain any internal state. Such system will produce same output for same input at any point of time. It's always easier to code and optimize a stateless system, so you should always strive for one if possible.

10. Explain couple of ways to resolve collision in hash table?

Linear probing, double hashing, and chaining. In linear probing, if bucket is already occupied then function check next bucket linearly until it find an empty one, while in chaining, multiple elements are stored in same bucket location.

Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.