## VMWare Inc Interview Questions

- 0of 0 votes
`We encode a string, s, by performing the following sequence of actions: Replace each character with its ASCII value representation. Reverse the string. For example, the table below shows the conversion from the string "Go VMWare" to the ASCII string "711113286778797114101": // Character G o V M W a r e // ASCII Value 71 111 32 86 77 87 97 114 101 // // We then reverse the ASCII string to get the encoded string 101411797877682311117. // // For reference, the characters in s are ASCII characters within the range 10 - 126 which include special characters. // // Complete the decode function in the editor below. It has one parameter: // encoded - A reversed ASCII string denoting an encoded string s. // // The function must decode the encoded string and return the list of ways in which s can be decoded. static Collection<String> decode(String encoded) { }`

- 0of 0 votes
Given two strings containing only numbers, return product of the two strings. Strings are large so conversion to interger is not possible.

- 1of 1 vote
VMWare Standard Online Screen

3rd Question Given an array of strings and a long description about the formatting of IPv6 and IPv4 (it took me more than 5 minutes to read the description). Write a function to find if a string is IPv4 or IPv6 address or neither.

4th Question Given an integer array, whenever a duplicate number is found, you may increment it (++). Find the minimum sum of the numbers in the array by keep incrementing the dups until all the numbers are unique.

- 2of 2 votes
VMWare Standard Online Screen

The Online Assessment was called something like Life Cycle Challenge-qpan.

There are 4 questions in total given 60 minutes. The problem description was unexpectedly long that it takes 5 minutes just to read a question.

1st Question Design a function to create BST. Given an integer array, insert the integers into the binary search tree and print all the steps taken.

2nd Question Given an integer, print the index of all the positions in which the binary bit is 1 in order.

- 1of 1 vote
You have two servers. Both of these servers have an identical file with billion characters except for one single character. These servers are connected over a very slow connection.

How do you find the different character?

My ans: split those files in to batches of characters of 10,000 (say), now calculate checksum and compare the checksums for the chunks of 10,000 character lines. So now you are just comparing 'ints' and not the files per say. (remember the connection is very slow)

His question: How do you optimize this?

- 0of 0 votes
Given a sorted array, and given a number n, find number of times n occurs in the array.

- 0of 0 votes
The 64-bit representation of a 48-bit address is said to be in canonical form if bits 63 through 48 are either all ones or all zeroes. Implement X86IsCanonicalAddress().

- 0of 0 votes
Implement a function, set_bit_l_to_r(x,y,l,r).

For bits l to r (both inclusive), if they are set in x, also set them in y. Do not change bits of y, if they are not in range l to r, or those bits are not set in x. l and r are 0-based.

- 0of 0 votes
Assume that garbage collector is not there in place or you are implementing a garbage collector for C++. Write the design and sample code for garbage collector implementation

We have 3 classed and Class A, B, C. object of A uses object B and Object of B uses Object of C. How can we track the object existence and clear memory ?

Answer which I suggested : Write a tree (or Graph?)data structure (Garbage collector is a container class holds this data structure) where each node has multiple paths to reach. If any of the node is not having a path to reach then we can clean that memory. This way the garbage collection will work. Please suggest your design as well.

- 1of 1 vote
Device an algorithm to find duplicates in array where each duplicate can occur k times. The algorithm must be of O(n) time and space complexity at max

- 1of 1 vote
Given the array of integers containing equal number of even and odd numbers. Rearrange

the array such that even number is at even place and odd number is at odd place.

Example : [2,1,3,4,7,9,24,98]

Answer : 1,2,3,4,7,24,9,98

- 0of 0 votes
Check binary number is prime or not

input : 1001

output : 9 is not prime number

- 0of 2 votes
8 coins are given where all the coins have equal weight, except one. The odd one may be less weight than the other or it may be heavier than the rest 7 coins. In worst case, how many iterations are needed to find the odd one out?

- 1of 1 vote
An array which is a Post order traversal of a Binary Tree. Write a function to check if the Binary Tree formed from the array is a Binary Search Tree.

Eg:

2

1 3

The array given as input would be 1 3 2.

Write a function to say if the tree formed is a Binary Search Tree.

Example 2: 4 is root. 0 is left child of 1 , 1 is left child of 2 and 2 is left child of 4. 5 is right child of 4 and 6 is right child of 5.

4

2 5

1 6

0

0 1 2 6 5 4 is the input array.

- 0of 0 votes
There are at most eight servers in a data center. Each server has got a capacity/memory limit. There can be at most 8 tasks that need to be scheduled on those servers. Each task requires certain capacity/memory to run, and each server can handle multiple tasks as long as the capacity limit is not hit. Write a program to see if all of the given tasks can be scheduled or not on the servers?

Ex:

Servers capacity limits: 8, 16, 8, 32

Tasks capacity needs: 18, 4, 8, 4, 6, 6, 8, 8

For this example, the program should say 'true'.

Ex2:

Server capacity limits: 1, 3

Task capacity needs: 4

For this example, program should return false.

Got some idea that this needs to be solved using dynamic programming concept, but could not figure out exact solution.

- 0of 0 votes
Given two strings, write an efficient algorithm (in Java) to compare the two of them. Your algorithm should handle all cases

- 0of 0 votes
You are given a binary array with N elements: d[0], d[1], ... d[N - 1].

You can perform AT MOST one move on the array: choose any two integers [L, R], and flip all the elements between (and including) the L-th and R-th bits. L and R represent the left-most and right-most index of the bits marking the boundaries of the segment which you have decided to flip.

What is the maximum number of '1'-bits (indicated by S) which you can obtain in the final bit-string?

'Flipping' a bit means, that a 0 is transformed to a 1 and a 1 is transformed to a 0 (0->1,1->0).

Input Format

An integer N

Next line contains the N bits, separated by spaces: d[0] d[1] ... d[N - 1]

Output:

S

Constraints:

1 <= N <= 100000

d[i] can only be 0 or 1f

0 <= L <= R < n

Sample Input:

8

1 0 0 1 0 0 1 0

Sample Output:

6

Explanation:

We can get a maximum of 6 ones in the given binary array by performing either of the following operations:

Flip [1, 5] ==> 1 1 1 0 1 1 1 0

- 0of 0 votes
Given a unsorted array. Create a balanced B tree. Whether it is possible to solve this problem algorithm in logarithmic complexity ?.

- -3of 3 votes
You will get a continuos stream of numbers.... u have to add these numbers to some list (u shouldn't sort it)... and any time user does a pop on the list, we should return the minimum of the list and remove it from the list... the minimum should now point to the next minimum in the list.

- 0of 0 votes
Given a list of arraylists containing elements, write a function that prints out the permutations of of the elements such that, each of the permutation set contains only 1 element from each arraylist and there are no duplicates in the list of permutation sets.

Eg: consider the following lists

L1= {a1,b1,c1,d1}

L2={a2,b2,c2}

L3= {a3, b3, c3}

Valid Permutations are:

{a1,b2,c3}

{a1,a2,a3}

{b1,c2,b3}

...

...

..

Please note that

{a1,b2,c3} is same set as {b2,a1,c3}

- -1of 1 vote
Delete every third element of an array until only one element is remaining. Tell the index of that remaining element in O(1) time complexity.

- 1of 1 vote
You are given a sorted skewed binary tree. How can you create a binary search tree of minimum height from it?

- -1of 1 vote
Delete the repeated elements in a singly linked list in O(n) time complexity without using extra space. Linked list contains elements in unsorted order

P.S. - Sorting is not allowed

- 1of 1 vote
A user creates a file test.sh on a linux system. He wishes to give another user on the same system the permission to execute that file. What permissions should he give to the file?

- 0of 2 votes
Where could we use deadlock? The interviewer was very clear about his question. The use of deadlock.

In which scenario could we use deadlock?

- 0of 0 votes
What is the difference between paging and swapping?

In windows OS, "My Computer", we see the option of paging, what does that mean?

- 0of 0 votes
When we click on the power button of our Laptop, what happens immediately and how the windows is loaded?

- 0of 0 votes
Two arrays are given. Data from both the arrays have to be taken and put into the third array and this third array should have only unique elements. Implement this without using set.

- -1of 1 vote
What is the difference between MVC and Factory pattern?

- 0of 0 votes
How does the print operation work when we try to give a print from a word document?

What is the use of software that comes along with the printer?

How the data is printed after we click on the print button?

What logic is applied for the data to be transferred to the printer?

What is the logic that makes the printer print the data on a sheet of paper?