## Developer Program Engineer Interview Questions

- 0of 0 votes
write a pseudo code to calculate

func(n) = 2*(func(n-1)+func(n-2)) in log(n) complexity.

Given:.func(1) = 1;func(2) = 3

- 0of 0 votes
Write pseudo code for Optimal game stratagy:

You have X amount with you, and 2N cards (N - winning cards, and N-loosing cards).

you have to play all the cards.

all cards are well shuffled, and one card is drawn randomly for each time.

if you pic one card means, next time you have to take one card from rest of the cards, i.e at last of the game you will left with one card.

If you bet 100 rupees,

If you got winning card ===> then you will get 200 rupees,

If you got a loosing card ====> then you will loose all your betting amount.i.e 100 rupees in this case.

You need to play all the cards. (I solved it.)

He asked me to solve it, with card replacement, i.e every time one card is drawn from 2N CARDS.

- 0of 0 votes
travel the tree vertically like

2

3 4

5 6 7 8

output:5 3 2 6 7 4 8

- 0of 0 votes
Write the code for mutex in c that is threadsafe

- 0of 0 votes
There is a stream of numbers and you need to find the maximum k numbers at any instant when minimum of k numbers have passed.

- 0of 0 votes
Prove that addition of consecutive odd numbers from 1 will result in number that is the square of the count of numbers added.

e.g. 1+3+5 = 9 here count is 3 and the sum is 3^2 = 9

Give a mathematical proof

- 0of 0 votes
Write a code to in place sort the strings of the type "s1d3b2m0" to "sdbm1320". Solution must be of O(n) without the use of extra space. At max one temp variable could be used.

- 0of 0 votes
What is MVC model.

- 0of 0 votes
How is Java different from javascript.

- 0of 0 votes
Divide a trapezium in 4 equal parts

- 0of 0 votes
There are two person A with Lock L1 and B with Lock L2 and a messenger M two send the box from one end to another. How to send the box so that M can never open the box.

- 0of 0 votes
What is the difference between a programming and scripting language.

- 0of 0 votes
There is an ant in a cube placed at one corner and you need to find the shortest path to the diagonally opposite corner. The ant can not fly tht is obvious.

- 0of 0 votes
Questions on Unions and its initialization and its memory usage.

- 0of 0 votes
How to implement classes in C

- 0of 0 votes
There is a channel which can send and receive signals and there is a sender and receiver. Sender can only send and receiver can only receive the message. Design classes for all three with the restrictions.

- 0of 0 votes
Design a base class that is uncopyable(need to take care of the = operator)

- 0of 0 votes
Questions on virtual methods and inheritence and C++

- 0of 0 votes
A stream of bits is passing, at any instance tell whether it is divisible by 3 or not.

- 0of 0 votes
atoi() implementation.

- 0of 0 votes
There are coins of 25 10 5 and 1 Rs. You got to tell in how many ways you can make change for an amount X. A working code was required,

- 0of 0 votes
Find the first character in the given string that is non repeating --- O(n) solution expected

- 0of 0 votes
Delete a node in Lined List

- 0of 0 votes
Level Order traversal in BST

- 0of 0 votes
Print the path whose some is S

- 0of 0 votes
Depth of BST.

- 0of 0 votes
Will this piece of Java code work:

class T {

public static void main(String args[]){

Object myObject = new Object();

synchronized(myObject){

myObject = new Object();

} //end sync

}

}

- 0of 0 votes
How do you identify which process has crashed in customer env, if there are multiple process crash at same time.

- 0of 0 votes
Lunatic server solution got a project in which they have to make a intranet web campus.

so entry for software developer , company make this problem.

solution must be in java.

Consider a university having a very big campus spread in acres of land. The university is undergoing

computerization. All the departments (at-most 50) are to be connected to form the intranet of the university.

You have to write a program, implementing Prims algorithm, which will suggest the network topology and

also minimise the total length of cable for connecting all the departments. Input to the program will be

names of all the departments and straight line distances between the departments (Only those pairs of

departments between which cable can be laid will be given). Output of the program should be the minimum

length of the cable required.

Input specifications

The first line will contain 2 natural numbers, N and M, separated by a blank space. N indicated the number

of departments in the university and M indicates the number of pairs of departments where the cables can be

laid. The following M lines will specify the distances between M pairs of departments as

dept1 dept2 distance

Where dept1 and dept2 are names of the departments (maximum 20 characters) and distance is a positive

integer (>0). Assume that the given distances between each pairs of departments will be unique and these M

lines will contain atleast one pair for each department.

Output specifications

The first line of the output will be names of the departments as they are included in the solution separated by

blank space. If two or more departments are included at a time then their names should be printed in the

alphabetic order. The next line will be the minimum length of cable required to form the intranet, terminated

with a new line character.

Sample Input/Output

input

7 10

physics chemistry 8

biology physics 9

biology office 15

chemistry office 4

chemistry sanskrit 5

sanskrit office 7

english office 16

english sanskrit 19

english cs 12

sanskrit cs 6

output

chemistry office sanskrit cs physics biology english

44

Hint : a simple prim's algorithm is implemented.

- 0of 0 votes
lunatic server solution is monitoring the wrong file entry in the server.

so company made another a problem for it to monitor AVL tree violation.

The problem should be solved in java...

problem states that...

This problem requires you to monitor a tree for violation of the AVL balance criteria as the tree is being

constructed.

The input to the program consists of a sequence of numbers. As you read in each number, check where the

node is going to be inserted into the current tree. [At the start, the tree is empty.] If that insertion can cause

the balance of any of the nodes in the tree to go beyond what is allowed by the AVL criteria, DO NOT add

the number into the tree. Instead, print out the number into the standard output. Numbers which retain the

AVL property of the tree should be added to the tree at the appropriate place as per the method discussed in

class. Continue with the remaining numbers. Please note that you do not have to do any balancing of the

tree! The input is terminated by –1.

The output from the program consists of the numbers rejected by the program. At the end, you should also

print out the count of such numbers rejected.

Hint: It would help to keep the height of the left and right subtrees of each node along with the node. Also

note that the process of checking for violation and actually inserting are quite similar; in the former case you

do not update anything but do everything else. This observation can be used to write the code.

Sample Input/Output

Input

3 5 1 6 2 4 9 7 -1

Output

7 1

(This means rejected key(s) are: key 7, totally 1 rejected key)