EMC Corporation Interview Questions
Posted on :10-02-2016
Q1. Write a program to find the first unique element in the following array:
{a, a, u, b}
Q2. Write a method to change the password of a valid user. The method accepts 3 parameters userId, oldPassword, NewPassword: The password should be changed only when the old password is valid.
Q3. Write a java program to explain life cycle of a thread.
Q4. Write a program to find the missing element in second array (Array2):
Array1:
5 15 2 20 30 40 8 1
Array2:
2 20 15 30 1 40 0 8
Q5. Without using loops, write a function to print 1 to 500 in serial order.
Q6. Write a program to get out of the Maze. Maze can be represented in the form of Matrix where x can be represented as wall. and - can be represented as a path.
Q7. Write output of the following program:
Class A
{
public static void main(String[] s)
{
System.out.println(Hello);
}
public static void main()
{
System.out.println(Hello);
}
public static void main (int args[])
{
System.out.println(Hello);
}
}
Q8. Design a class for a digital watch - outline the methods, properties, and class hierarchy. UML diagram welcome but not required. Write some test cases to test the above methods outlined.
Q9. Write a function that counts the number of primes in the range [1-N]. Write test cases for this function.
Q10. Write a java function to access properties from ini file. (contents of ini file will be like: username=xyz)
Q11. Write a java program to count number of words in a file.
Q12. Write a String Reverser (using Recursion) and write JUnit test for the reverse method.
Q13. Swap 2 variables without using a temporary variable.
Q14. Similar to memory barriers and conditional variable (used in multi threaded process),what can you do for multi process application?
Q15. In a single linked list, how to delete a node (no head node given)?
Q16. How will you determine the page size of a *nix machine using C code? Hint: Use malloc()
Q17. Given array of 3 integers. Write a method that returns possible numbers of those 3 integers.
For example:
int[] a = {1,2,3}
Output: 12,13,123,321,213 etc..
Q18. Write a method that returns 40% A, 50% B and 10% C.
Q19. Remove unnecessary from an expression:
1) (((a))) => a
2) (a+b) => a+b
3) (a+b)*c => (a+b)*c
4)(((a+b)*(c+d))+e) => (a+b)*(c+d)+e
Q20. Given a sorted array with repeated numbers: e.g: 1,2,2,7,7,7,7,9,9...
Find first occurance of any given value.