First page Next page

Q509: Two brothers named vinay and pavan went to their grand mothers house to spend some valuable time during their summer vacation. They decide to play each day either tennis in the morning or cricket in the evening but not both on a particular day. Even they either take rest without playing none. So finally they played for 22 days and at the end of the vacation grand ma send the report to their parents saying they did nothing for 24 mornings and 12 evenings. So how many days they spend their time at grand ma house?
tags: GoldmanSachs puzzle goldmansachs

Q213: How do you represnt a directed graph in a relational table?
tags: google microsoft software programming algorithm database sql

Q582: Assume your computer is reading characters one by one from a stream (you don't know the length of the stream before ending). Note that you have only one character of storage space (so you cann't save the characters you've read to a something like a strong). When you've finished reading you should return a character out of the stream with equal probability
tags: amazon sw

Q154: What are different pipelining hazards and how are they eliminated.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q80: An array of integers of size n. Generate a random permutation of the array, given a function rand_n() that returns an integer between 1 and n, both inclusive, with equal probability. What is the expected time of your algorithm?
tags: microsoft sw programming math

Q71: Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.
tags: microsoft sw programming

Q247: Describe oneway replication vs multimaster replication. How do you deal with the following in a multimaster replication? 1) Update conflicts 2) Delete conflicts 3) Unique conflicts
tags: microsoft database

Q165: About hardware and software interrupts.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q96: In UNIX, are the files allocated contiguous blocks of data
tags: microsoft sw os unix

Q191: Implement a queue in an array.
tags: Microsoft software c c++ programming

Q150: What are superscalar machines and vliw machines?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q519: Implement division (without using the divide operator, obviously).
tags: google sw

Q219: Given a set of KEY->VALUE pairs such that each KEY is unique, describe a method of storing these pairs on disk, and a method for accessing the corresponding VALUE given a KEY. Assume that RAM is fixed at 1gb and the set of pairs requires 40gb. HINT: we are trying to minimize page-transfers
tags: google software programming algorithm database

Q19: (from Tara Hovel) A helicopter drops two trains, each on a parachute, onto a straight infinite railway line. There is an undefined distance between the two trains. Each faces the same direction, and upon landing, the parachute attached to each train falls to the ground next to the train and detaches. Each train has a microchip that controls its motion. The chips are identical. There is no way for the trains to know where they are. You need to write the code in the chip to make the trains bump into each other. Each line of code takes a single clock cycle to execute. You can use the following commands (and only these); MF - moves the train forward MB - moves the train backward IF (P) - conditional that is satisfied if the train is next to a parachute. There is no "then" to this IF statement. GOTO
tags: microsoft sw programming puzzle

Q169: What is the race around condition? How can it be overcome?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q56: Write a routine that prints out a 2-D array in spiral order!
tags: microsoft sw programming

Q337: Given a string s1 and a string s2, write code to say whether s2 is a rotation of s1 using only one call to strstr routine?
tags: microsoft sw

Q104: int *a; char *c; *(a) = 20; *c = *a; printf("%c",*c); what is the output?
tags: microsoft sw programming

Q499: The problem is to write a set of functions to manage a variable number of byte queues, each with variable length, in a small, fixed amount of memory. You should provide implementations of the following four functions: Q * create_queue(); //Creates a FIFO byte queue, returning a handle to it. void destroy_queue(Q * q); //Destroy an earlier created byte queue. void enqueue_byte(Q * q, unsigned char b); //Adds a new byte to a queue. unsigned char dequeue_byte(Q * q); //Pops the next byte off the FIFO queue. So, the output from the following set of calls: Q * q0 = create_queue(); enqueue_byte(q0, 0); enqueue_byte(q0, 1); Q * q1 = create_queue(); enqueue_byte(q1, 3); enqueue_byte(q0, 2); enqueue_byte(q1, 4); printf("%d", dequeue_byte(q0)); printf("%d\n", dequeue_byte(q0)); enqueue_byte(q0, 5); enqueue_byte(q1, 6); printf("%d", dequeue_byte(q0)); printf("%d\n", dequeue_byte(q0)); destroy_queue(q0); printf("%d", dequeue_byte(q1)); printf("%d", dequeue_byte(q1)); printf("%d\n", dequeue_byte(q1)); destroy_queue(q1); should be: 0 1 2 5 3 4 6 You can define the type Q to be whatever you want. Your code is not allowed to call malloc() or other heap management routines. Instead, all storage (other than local variables in your functions) must be within a provided array: unsigned char data[2048]; Memory efficiency is important. On average while your system is running, there will be about 15 queues with an average of 80 or so bytes in each queue. Your functions may be asked to create a larger number of queues with less bytes in each. Your functions may be asked to create a smaller number of queues with more bytes in each. Execution speed is important. Worst-case performance when adding and removing bytes is more important than average-case performance. If you are unable to satisfy a request due to lack of memory, your code should call a provided failure function, which will not return: void on_out_of_memory(); If the caller makes an illegal request, like attempting to dequeue a byte from an empty queue, your code should call a provided failure function, which will not return: void on_illegal_operation(); There may be spikes in the number of queues allocated, or in the size of an individual queue. Your code should not assume a maximum number of bytes in a queue (other than that imposed by the total amount of memory available, of course!) You can assume that no more than 64 queues will be created at once.
tags: microsoft programming c

Q8: One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?
tags: microsoft math puzzle

Q182: An 8bit ADC with parallel output converts input signal into digital numbers. You have to come up with the idea of a circuit, that finds the maxomum of every 10 numbers at the output of the ADC.
tags: Intel AMD nVidia ATI Sun HP hardware hw design circuit logic

Q30: You are given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above.
tags: microsoft sw programming c

Q126: How do you represent an n-ary tree? Write a program to print the nodes of such a tree in breadth first order.
tags: microsoft sw programming algorithms

Q193: (Attributed to the Monty Hall show) You are presented with three doors (door 1, door 2, door 3). One door has a million dollars behind it. The other two have goats behind them. You do not know ahead of time what is behind any of the doors. Monty asks you to choose a door. you pick one of the doors and announce it. Monty then counters by showing you one of the doors with a goat behind it and asks you if you would like to keep the door you chose, or switch to the other unknown door. Should you switch? Why or Why not?
tags:

Q34: Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it is a simple test.]
tags: microsoft sw programming

Q547: You have N threads and M resources. What protocol do you use to ensure no deadlocks occur?
tags: google sw

Q52: Assuming that locks are the only reason due to which deadlocks can occur in a system. What would be a foolproof method of avoiding deadlocks in the system.
tags: microsoft sw programming os

Q139: Why is multiple inheritance not provided in Java?
tags: microsoft sw programming java

Q18: There are four dogs/ants/people at four corners of a square of unit distance. At the same instant all of them start running with unit speed towards the person on their clockwise direction and will always run towards that target. How long does it take for them to meet and where?
tags: microsoft math puzzle

Q339: Given an array in which elements are unsorted. Write an algorithm that gives two indices n1,n2 such that if you sort just the elements of the array from n1 to n2, then the whole array will be sorted.
tags: Microsoft programming

Next page


b(ond)log