Q1: Classic: If a bear walks one mile south, turns left and walks one mile to the east and then turns left again and walks one mile north and arrives at its original position, what is the color of the bear.
tags: microsoft puzzle

Q2: Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife?
tags: microsoft puzzle

Q3: There are 3 boxes. One of them has red balls, one has blue balls only and the other has mixture of red and blue balls. The labels on their boxes always lie. (i.e. if the label says red, you are sure that it doesn't have red balls only,it could be a mixture) The task is to pick one box and pick only one ball from it and then correctly label all the three boxes.
tags: microsoft puzzle

Q4: You have 8 balls. One of them is defective and weighs less than others. You have a balance to measure balls against each other. In 2 weighings how do you find the defective one?
tags: microsoft puzzle

Q5: Why is a manhole cover round?
tags: microsoft puzzle

Q6: How many cars are there in the USA? (or how many gas stations or how many houses)
tags: microsoft puzzle

Q7: You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?
tags: microsoft puzzle

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

Q9: You have two jars, 50 red marbles and 50 blue marbles. A jar will be picked at random, and then a marble will be picked from the jar. Placing all of the marbles in the jars, how can you maximize the chances of a red marble being picked? What are the exact odds of getting a red marble using your scheme?
tags: microsoft math puzzle

Q10: Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down?
tags: microsoft puzzle

Q11: You have 5 jars of pills. Each pill weighs 10 gram, except for contaminated pills contained in one jar, where each pill weighs 9 gm. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?
tags: microsoft puzzle

Q12: If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?
tags: microsoft puzzle

Q13: Implement a multiple-reader-single-writer lock given a compare-and-swap instruction. Readers cannot overtake waiting writers.
tags: microsoft sw programming

Q14: Given a makefile, design the data structure that a parser would create and then write code that iterates over that data structure executing commands as needed.
tags: microsoft sw programming

Q15: You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
tags: microsoft math puzzle

Q16: Which way should the key turn in a car door to unlock it?
tags: microsoft puzzle

Q17: If you could remove any of the 50 states, which state would it be and why?
tags: microsoft puzzle

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

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

Q20: Tell me the courses you liked and why did you like them.
tags: microsoft sw general

Q21: Give an instance in your life in which you were faced with a problem and you tackled it successfully.
tags: microsoft general

Q22: What is your ideal working environment.
tags: microsoft general

Q23: Why do you think you are smart.
tags: microsoft general

Q24: Questions on the projects listed on the Resume.
tags: microsoft general

Q25: Do you want to know any thing about the company.( Try to ask some relevant and interesting question).
tags: microsoft general

Q26: How long do you want to stay in USA and why (I guess non-citizens get this)?
tags: microsoft general

Q27: What is your geographical preference?
tags: microsoft general

Q28: What are your expectations from the job.
tags: microsoft general

Q29: Given a rectangular (cuboidal for the puritans) cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife ?
tags: microsoft math puzzle

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

Q31: Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
tags: microsoft sw programming

Q32: Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all. [ This one had me stuck for quite some time and I first gave a solution that did have floating point computations ].
tags: microsoft sw programming

Q33: Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
tags: microsoft sw programming

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

Q35: Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
tags: microsoft sw programming

Q36: How many points are there on the globe where by walking one mile south, one mile east and one mile north you reach the place where you started.
tags: microsoft puzzle

Q37: Give a very good method to count the number of ones in a "n" (e.g. 32) bit number.
tags: microsoft sw programming

Q38: What are the different ways to implement a condition where the value of x can be either a 0 or a 1. Apparently the if then else solution has a jump when written out in assembly. if (x == 0) y=a else y=b There is a logical, arithmetic and a data structure solution to the above problem.
tags: microsoft sw programming hw

Q39: Reverse a linked list.
tags: microsoft sw programming

Q40: Insert in a sorted list
tags: microsoft sw programming

Q41: In a Xs and 0s game (i.e. TIC TAC TOE) if you write a program for this give a fast way to generate the moves by the computer. I mean this should be the fastest way possible.
tags: microsoft sw programming

Q42: I was given two lines of assembly code which found the absolute value of a number stored in twos complement form. I had to recognize what the code was doing. Pretty simple if you know some assembly and some fundamentals on number representation.
tags: microsoft sw programming hw

Q43: Give a fast way to multiply a number by 7.
tags: microsoft sw programming

Q44: How would go about finding out where to find a book in a library. (You do not know how exactly the books are organized beforehand).
tags: microsoft sw programming puzzle

Q45: Linked list manipulation.
tags: microsoft sw programming

Q46: Tradeoff between time spent in testing a product and getting into the market first.
tags: microsoft sw general

Q47: What to test for given that there is not enough time to test everything you want to.
tags: microsoft sw general testing

Q48: First some definitions for this problem: a) An ASCII character is one byte long and the most significant bit in the byte is always 0. b) A Kanji character is two bytes long. The only characteristic of a Kanji character is that in its first byte the most significant bit is 1. Now you are given an array of a characters (both ASCII and Kanji) and, an index into the array. The index points to the start of some character. Now you need to write a function to do a backspace (i.e. delete the character before the given index).
tags: microsoft sw programming

Q49: Delete an element from a doubly linked list.
tags: microsoft sw programming

Q50: Write a function to find the depth of a binary tree.
tags: microsoft sw programming

Q51: Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
tags: microsoft sw programming

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

Q53: Reverse a linked list.
tags: microsoft sw programming

Q54: Write a small lexical analyzer - interviewer gave tokens. expressions like "a*b" etc.
tags: microsoft sw programming

Q55: Besides communication cost, what is the other source of inefficiency in RPC? How can you optimize the communication?
tags: microsoft sw programming os

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

Q57: How is the readers-writers problem solved? - using semaphores/ada .. etc.
tags: microsoft sw programming os

Q58: Ways of optimizing symbol table storage in compilers.
tags: microsoft sw programming

Q59: A walk-through through the symbol table functions, lookup() implementation etc. - The interviewer was on the Microsoft Compiler team.
tags: microsoft sw programming

Q60: A version of the "There are three persons X Y Z, one of which always lies".. etc..
tags: microsoft puzzle

Q61: There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner.. what is the probability that they do not collide.
tags: microsoft sw math puzzle

Q62: Write an efficient algorithm and C code to shuffle a pack of cards. This one was a feedback process until we came up with one with no extra storage.
tags: microsoft sw programming

Q63: There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace. Woman 1: 1 minute to cross Woman 2: 2 minutes to cross Woman 3: 5 minutes to cross Woman 4: 10 minutes to cross For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?
tags: microsoft puzzle

Q64: Implement an algorithm to do string matching with wildcards.
tags: microsoft sw programming algorithms

Q65: Some general questions on Lex, Yacc etc.
tags: microsoft sw

Q66: Given an array t[100] which contains numbers between 1..99. Return the duplicated value. Try both O(n) and O(n-square).
tags: microsoft sw programming algorithms

Q67: Given an array of characters. How would you reverse it. ? How would you reverse it without using indexing in the array.
tags: microsoft sw programming

Q68: Given a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - solutions given in the C lib -typec.h)
tags: microsoft sw programming

Q69: Fundamentals of RPC.
tags: microsoft sw os

Q70: Given a linked list which is sorted. How will you insert in sorted way.
tags: microsoft sw programming

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

Q72: Give a good data structure for having n queues ( n not fixed) in a finite memory segment. You can have some data-structure separate for each queue. Try to use at least 90% of the memory space.
tags: microsoft sw programming

Q73: Do a breadth first traversal of a tree.
tags: microsoft sw programming algorithms

Q74: What is the difference between an Ethernet Address and an IP address?
tags: microsoft networking

Q75: Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
tags: microsoft sw programming algorithms

Q76: Given an array of integers, find the contiguous sub-array with the largest sum.
tags: microsoft sw programming algorithms

Q77: Given an array of length N containing integers between 1 and N, determine if it contains any duplicates.
tags: microsoft sw programming algorithms

Q78: Sort an array of size n containing integers between 1 and K, given a temporary scratch integer array of size K.
tags: microsoft sw programming algorithms

Q79: An array of integers. The sum of the array is known not to overflow an integer. Compute the sum. What if we know that integers are in 2s complement form?
tags: microsoft sw programming

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

Q81: An array of pointers to (very long) strings. Find pointers to the (lexicographically) smallest and largest strings.
tags: microsoft sw programming algorithms

Q82: Write a program to remove duplicates from a sorted array.
tags: microsoft sw programming

Q83: What is a virtual function ? What happens if an error occurs in constructor or destructor. Discussion on error handling, templates, unique features of C++. What is different in C++? ( compare with unix).
tags: microsoft sw programming C++ C

Q84: Given a list of numbers ( fixed list) Now given any other list, how can you efficiently find out if there is any element in the second list that is an element of the first list (fixed list).
tags: microsoft sw programming algorithms

Q85: Given 3 lines of assembly code : Find what it is doing. cwd xor ax, dx sub ax, dx
tags: microsoft sw programming assembly hw

Q86: If you are in a boat on a lake and you throw out a suitcase, Will the level of water increase in the lake?
tags: microsoft puzzle

Q87: Print an integer using only putchar. Try doing it without using extra storage.
tags: microsoft sw programming

Q88: Write C code for (a) deleting an element from a linked list (b) traversing a linked list
tags: microsoft sw programming C

Q89: What are various problems unique to distributed databases
tags: microsoft sw database

Q90: Declare a void pointer
tags: microsoft sw programming

Q91: Make the pointer aligned to a 4 byte boundary in a efficient manner
tags: microsoft sw programming

Q92: What is a far pointer (in DOS)
tags: microsoft sw programming

Q93: What is a balanced tree
tags: microsoft sw programming algorithms

Q94: Given a linked list with the following property node2 is left child of node1, if node2 < node1 else, it is the right child.
tags: microsoft sw programming

Q95: Describe the file system layout in the UNIX OS
tags: microsoft sw os unix

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

Q97: Write an efficient C code for tr program. tr has two command line arguments. They both are strings of same length. tr reads an input file, replaces each character in the first string with the corresponding character in the second string. eg. tr abc xyz replaces all a by x, b by y and so on.
tags: microsoft sw programming

Q98: what is disk interleaving
tags: microsoft database

Q99: why is disk interleaving adopted
tags: microsoft database

Q100: Given a new disk, how do you determine which interleaving is the best a) give 1000 read operations with each kind of interleaving determine the best interleaving from the statistics
tags: microsoft sw database

Q101: Draw the graph with performance on one axis and n on another, where n in the n in n-way disk interleaving. (a tricky question, should be answered carefully)
tags: microsoft sw database

Q102: I was given c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
tags: microsoft sw programming C++

Q103: A real life problem - A square picture is cut into 16 squares and they are shuffled. Write a program to rearrange the 16 squares to get the original big square.
tags: microsoft sw programming puzzle algorithms

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

Q105: Write a program to find whether a given m/c is big-endian or little-endian!
tags: microsoft sw programming hw

Q106: What is a volatile variable?
tags: microsoft sw programming

Q107: What is the scope of a static function in C ?
tags: microsoft sw programming C

Q108: What is the difference between "malloc" and "calloc"?
tags: microsoft sw programming

Q109: struct n { int data; struct n* next}node; node *c,*t; c->data = 10; t->next = null; *c = *t; what is the effect of the last statement?
tags: microsoft sw programming

Q110: If you are familiar with the ? operator x ? y : z, you want to implement that in a function: int cond(int x, int y, int z); using only ~, !, ^, &, +, |, <<, >> no if statements, or loops or anything else, just those operators, and the function should correctly return y or z based on the value of x. You may use constants, but only 8 bit constants. You can cast all you want. You are not supposed to use extra variables, but in the end, it will not really matter, using vars just makes things cleaner. You should be able to reduce your solution to a single line in the end though that requires no extra vars.
tags: microsoft sw programming puzzle

Q111: You have an abstract computer, so just forget everything you know about computers, this one only does what I am about to tell you it does. You can use as many variables as you need, there are no negative numbers, all numbers are integers. You do not know the size of the integers, they could be infinitely large, so you cannot count on truncating at any point. There are NO comparisons allowed, no if statements or anything like that. There are only four operations you can do on a variable. 1) You can set a variable to 0. 2) You can set a variable = another variable. 3) You can increment a variable (only by 1), and it is a post increment. 4) You can loop. So, if you were to say loop(v1) and v1 = 10, your loop would execute 10 times, but the value in v1 would not change so the first line in the loop can change value of v1 without changing the number of times you loop. You need to do 3 things. 1) Write a function that decrements by 1. 2) Write a function that subtracts one variable from another. 3) Write a function that divides one variable by another. 4) See if you can implement all 3 using at most 4 variables. Meaning, you are not making function calls now, you are making macros. And at most you can have 4 variables. The restriction really only applies to divide, the other 2 are easy to do with 4 vars or less. Division on the other hand is dependent on the other 2 functions, so, if subtract requires 3 variables, then divide only has 1 variable left unchanged after a call to subtract. Basically, just make your function calls to decrement and subtract so you pass your vars in by reference, and you cannot declare any new variables in a function, what you pass in is all it gets. Linked lists
tags: microsoft sw programming puzzle

Q112: Under what circumstances can one delete an element from a singly linked list in constant time?
tags: microsoft sw programming

Q113: Given a singly linked list, determine whether it contains a loop or not.
tags: microsoft sw programming

Q114: Given a singly linked list, print out its contents in reverse order. Can you do it without using any extra space?
tags: microsoft sw programming

Q115: Given a binary tree with nodes, print out the values in pre-order/in-order/post-order without using any extra space.
tags: microsoft sw programming algorithms

Q116: Reverse a singly linked list recursively. The function prototype is node * reverse (node *) ;
tags: microsoft sw programming

Q117: Given a singly linked list, find the middle of the list.
tags: microsoft sw programming

Q118: Reverse the bits of an unsigned integer.
tags: microsoft sw programming

Q119: Compute the number of ones in an unsigned integer.
tags: microsoft sw programming

Q120: Compute the discrete log of an unsigned integer.
tags: microsoft sw programming

Q121: How do we test most simply if an unsigned integer is a power of two?
tags: microsoft sw programming

Q122: Set the highest significant bit of an unsigned integer to zero.
tags: microsoft sw programming

Q123: Let f(k) = y where k is the y-th number in the increasing sequence of non-negative integers with the same number of ones in its binary representation as y, e.g. f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6) = 3 and so on. Given k >= 0, compute f(k).
tags: microsoft sw programming algorithms

Q124: A character set has 1 and 2 byte characters. One byte characters have 0 as the first bit. You just keep accumulating the characters in a buffer. Suppose at some point the user types a backspace, how can you remove the character efficiently. (Note: You cant store the last character typed because the user can type in arbitrarily many backspaces)
tags: microsoft sw programming

Q125: What is the simples way to check if the sum of two unsigned integers has resulted in an overflow.
tags: microsoft sw programming

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

Q127: Write the tr program of UNIX. Invoked as tr -str1 -str2. It reads stdin and prints it out to stdout, replacing every occurance of str1[i] with str2[i]. e.g. tr -abc -xyz to be and not to be <- input to ye xnd not to ye <- output
tags: microsoft sw programming algorithms

Q128: How do you use RSA for both authentication and secrecy?
tags: microsoft sw security

Q129: What is ARP and how does it work?
tags: cisco microsoft networking

Q130: What is the difference between a switch and a router?
tags: microsoft cisco networking

Q131: Name some routing protocols? (RIP,OSPF etc..)
tags: microsoft cisco networking

Q132: How do you do authentication with message digest(MD5)? (Usually MD is used for finding tampering of data)
tags: microsoft security networking

Q133: How do you implement a packet filter that distinguishes following cases and selects first case and rejects second case. i) A host inside the corporate n/w makes a ftp request to outside host and the outside host sends reply. ii) A host outside the network sends a ftp request to host inside. for the packet filter in both cases the source and destination fields will look the same.
tags: cisco microsoft networking

Q134: How does traceroute work? Now how does traceroute make sure that the packet follows the same path that a previous (with ttl - 1) probe packet went in?
tags: microsoft cisco juniper networking

Q135: Explain Kerberos Protocol ?
tags: microsoft sun cisco security networking

Q136: What are digital signatures and smart cards?
tags: microsoft sun cisco security networking

Q137: Difference between discretionary access control and mandatory access control?
tags: microsoft sun security networking

Q138: How do you find the size of a java object (not the primitive type) ?
tags: microsoft sw java programming

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

Q140: Thread t = new Thread(); t.start(); t = null; now what will happen to the created thread?
tags: microsoft sw programming java

Q141: How is garbage collection done in java?
tags: microsoft sw programming java

Q142: How do you write a "ping" routine in java?
tags: microsoft sw programming java networking

Q143: What are the security restrictions on applets?
tags: microsoft sw programming java

Q144: Write a function to check if two rectangles defined as below overlap or not. struct rect { int top, bot, left, right; } r1, r2;
tags: microsoft sw programming puzzle

Q145: Write a SetPixel(x, y) function, given a pointer to the bitmap. Each pixel is represented by 1 bit. There are 640 pixels per row. In each byte, while the bits are numbered right to left, pixels are numbered left to right. Avoid multiplications and divisions to improve performance.
tags: microsoft sw programming

Q146: You, a designer want to measure disk traffic i.e. get a histogram showing the relative frequency of I/O/second for each disk block. The buffer pool has b buffers and uses LRU replacement policy. The disk block size and buffer pool block sizes are the same. You are given a routine int lru_block_in_position (int i) which returns the block_id of the block in the i-th position in the list of blocks managed by LRU. Assume position 0 is the hottest. You can repeatedly call this routine. How would you get the histogram you desire?
tags: microsoft sw programming database

Q147: What does the following code do? xor eax,eax mov ebx,data ; your input data mov cl,bits ; number of bits loop: ror ebx,1 rcl eax,1 dec cl jnz loop
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q148: Explain what is DMA?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q149: What is pipelining?
tags: microsoft intel amd nvidia hw comparch architecture hardware

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

Q151: What is cache?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q152: What is cache coherency and how is it eliminated?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q153: What is write back and write through caches?
tags: microsoft intel amd nvidia hw comparch architecture hardware

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

Q155: What are different stages of a pipe?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q156: Explain more about branch prediction in controlling the control hazards
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q157: Give examples of data hazards with pseudo codes.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q158: How do you calculate the number of sets given its way and size in a cache?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q159: How is a block found in a cache?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q160: Scoreboard analysis.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q161: What is miss penalty and give your own ideas to eliminate it.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q162: How do you improve the cache performance.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q163: Different addressing modes.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q164: Computer arithmetic with twos complements.
tags: microsoft intel amd nvidia hw comparch architecture hardware

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

Q166: What is bus contention and how do you eliminate it.
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q167: What is aliasing?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q168: What is the difference between a latch and a flip flop?
tags: microsoft intel amd nvidia hw comparch architecture hardware

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

Q170: What is the purpose of cache? How is it used?
tags: microsoft intel amd nvidia hw comparch architecture hardware

Q171: What are the main issues associated with multiprocessor caches and how might you address them?
tags: Intel AMD nVidia ATI Sun HP hw architecture design

Q172: In what cases do you need to double clock a signal before presenting it to a synchronous state machine?
tags: Intel AMD Sun hardware architecture design

Q173: You have a driver that drives a long signal & connects to an input device. At the input device there is either overshoot, undershoot or signal threshold violations, what can be done to correct this problem?
tags: Intel AMD Sun circuit hardware design logic

Q174: You have 2 candles. Every candle lights for 60 minutes. You have to find the way to measure 45 minutes.
tags: microsoft google ebay puzzle

Q175: A band is going in the street with a constant speed. Someone in the last row has a dog. The dog runs ahead, reaches the front row of the band and gets back to it's owner. The dog's speed was constant all the way and while it was running the band passed 50 feet. Find the length of the dog's path,if the distance between the front and the rear row of the band is 50 feet.
tags: microsoft puzzle

Q176: A chess board has 64 squares. Two squares in the diagonal corners are erased. Is it possible to cover the remaining 62 squares with 31 dominos? (One domino covers two squares.) Why or How?
tags: microsoft puzzle

Q177: A man is running across a bridge.When he is 3/8 of the way accross, he heard a train coming behind him. If he keeps running he will reach the end of the bridge at the same time with the train. If he turns around and runs back, he will get to the beginning of the bridge at the same time as the train. The man runs at a speed of 5mph. What is the speed of the train?
tags: microsoft puzzle math

Q178: What is the purpose of the preprocessor directive #error?
tags: WindRiver software programming embedded

Q179: What does the following code output? <pre> void foo(void) { unsigned int a=6; int b=-20; (a+b >6) ? puts(">6") : puts("<=6"); } </pre>
tags: microsoft WindRiver software programming embedded

Q180: Write a progam to print a binary tree such that the root is printed in the middle of its left and right sub-trees.
tags: microsoft software programming C

Q181: What is the difference in memory management between Java and C++? Is it possible to create a memory leak in Java?
tags: ebay microsoft amazon software programming C java c++

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

Q183: You have two counters to 16, built from negedge D- FF . First circuit is synchronous and second is "ripple" (cascading). Which circuit has a less propagation delay?
tags: Intel NationalSemi AMD Sun hardware hw design circuit logic

Q184: Design a divide-by-3 counter with equal duty cycle ?
tags: Intel AMD nVidia ATI Sun HP NationalSemi hardware hw design circuit logic

Q185: When will you use a latch and a flipflop in a sequential design?
tags: Intel AMD nVidia ATI Sun HP NationalSemi hardware hw design circuit logic

Q186: FIFO Design: We have a fifo which clocks data in at 10mhz and clocks data out at 8mhz. On the input there is only 8 data samples in any order during each 10 clocks. In other words, a 10 input clock window will carry only 8 data samples and the other 2 clocks carry no data (data is scattered in any order). How big does the fifo need to be to avoid data over/under-run.
tags: Intel AMD nVidia ATI Sun HP NationalSemi hardware hw design circuit logic

Q187: We have a circular wheel with half painted black and the other half painted white. There are 2 censors mounted 45 degree apart at the surface of this wheel( not touching the wheel) which give a "1" for black and "0" for white passing under them. Design a circuit to detect which way the wheel is moving. Do not assume any fixed position for start.
tags: Intel AMD nVidia ATI Sun HP NationalSemi hardware hw design circuit logic

Q188: The silicon of a new device has memory leak. When all "0" are written into memory, it reads back all "0" without any problem. When all "1" are written, only 80% of memory cells are read back correctly. What can be possibly the problem with the memory?
tags: Intel AMD nVidia ATI Sun HP NationalSemi hardware hw design circuit logic

Q189: There are 100 doors in a row that are all initially closed. You make 100 passes by the doors starting with the first door every time. The first time through you visit every door and toggle the door (if the door is closed, you open it, if its open, you close it). The second time you only visit every 2nd door (door #2, #4, #6). the third time, every 3rd door (door #3, #6, #9), etc, until you only visit the 100th door. What is the state of each door after the last pass?
tags: microsoft puzzle

Q190: There are four ants on a square, one at each corner. At the same time, they all set off for a different corner at random. What is the probability that they don't collide?
tags: microsoft puzzle math

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

Q192: A man has two paper cubes on his desk. Every day he arranges both cubes so that the front faces show the current day of the month. What numbers are required on the faces of the cubes to allow this for all possible days in the calendar?
tags: microsoft ebay puzzle

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:

Q200: Design and describe a system/application that will most efficiently produce a report of the top 1 million Google search requests.These are the particulars. * You are given 12 servers to work with. They are all dual-processor machines with 4Gb of RAM, 4x400GB hard drives and networked together.(Basically, nothing more than high-end PC's) * The log data has already been cleaned for you. It consists of 100 Billion log lines, broken down into 12 320 GB files of 40-byte search terms per line. * You can use only custom written applications or available free open-source software.
tags: google sw software programming design algorithms

Q194: You have a normal six sided cube. How many different cubes can you make by painting each side using one of siz colors? If you can rotate two cubes to make them look identical in color then they are the same cube!
tags: microsoft puzzle

Q199: You have been shrunk down to the size of a nickel and tossed into a blender. You are told that the blender blades will start in 60 seconds.What would you do to save your life?
tags: google behavioral general

Q195: Create an XOR gate using only NAND gates. What is the minimum number of gates you need for doing it?
tags:

Q196: What is the effective way of Device Independent Bitmap files management?
tags: microsoft hp programming sw windows

Q198: what is the volume of a rectangular prism
tags: microsoft sw

Q197: The Dutch National Flag Problem (The following problem was proposed by W.H.J. Feijen and made famous by Edsger W.Dijkstra, both of Dutch origin.) You are given a row of n buckets, each containing one ball, which may be either red, white, or blue. Your goal is to rearrange the balls in the buckets such that they appear in the order of the colors on the Dutch national flag: red balls should be grouped on the left, the order of the colors on the Dutch national flag: red balls should be grouped on the left, move balls is swap(i,j), which swaps the contents of the i and j buckets. Give pseudocode for a linear-time algorithm for sorting an array B[1..n] of balls in the Dutch national flag order. Your algorithm should use only constant space in addition to the given array.
tags: microsoft ebay hp yahoo programming algorithms sw

Q201: What is the difference between deep copy and shallow copy? Which of the two does Object.clone() implement?
tags: ebay sw java

Q202: You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
tags: MICROSOFT Puzzle

Q203: You are at a party with a friend and 10 people are present including you and the friend. Your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. Would you accept the wager?
tags: google microsoft puzzle

Q204: Given a string, with spaces, replace spaces with %20. You have extra space on the end of the string. (No additional memory and do it as close to O(n) as possible).
tags: microsoft software programming algorithm string

Q205: Write the 'grow' function for a C++ vector class
tags: microsoft software programming algorithm C++

Q206: How would you determine if someone has won a game of tic-tac-toe on a board of any size?
tags: microsoft puzzle algorithm

Q207: The government wants cars to keep track of whether or not they are speeding. The part to determine this is already able to determine the speed of the vehicle, how would you design the rest of the system.
tags: microsoft puzzle algorithm

Q208: Write a function to find the 2 biggest numbers in an array, and return the sum. How about the K biggest elements in the array, and return the sum. Do both in linear time.
tags: microsoft software programming algorithm

Q209: Write a function to find the next prime number after a given number.
tags: google microsoft software programming algorithm

Q210: From K sorted arrays, each of size N, how would you construct one big array, and what would the big-O of the procedure be? What if you only had memory of size 2N.
tags: google microsoft software programming algorithm

Q211: Find the nth node in an in-order search of a tree.
tags: google microsoft software programming algorithm

Q212: Find the intersection of 2 sorted integer arrays. What if one of them is huge? What if one of them is so huge, it can't fit in memory. How do you minimize the number of disk seeks?
tags: google microsoft software programming algorithm

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

Q214: Given 2 strings (as character arrays) A and B, how would you determine if the characters in B were a subset of the characters in A.
tags: google microsoft software programming algorithm

Q215: Given that there are about 4 billion pages indexed by Google, how would you keep from indexing the same page twice?
tags: google microsoft software programming algorithm

Q216: How would you find out if a machine's stack grows up or down in memory?
tags: google software programming architecture

Q217: Implementation unbounded precision multiplication in C++.
tags: google software programming algorithm C++

Q218: Write Java vector add() by using C++ Templates
tags: google software programming algorithm C++ java

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

Q220: Given N computers networked together, with each computer storing N integers, describe a procedure for finding the median of all of the numbers. Assume that a computer can only hold O(N) integers (i.e. no computer can store all N^2 integers). Also assume that there exists a computer on the network without integers, that we can use to interface with the computers storing the integers.
tags: google software programming algorithm

Q221: Given the sequence S1 = {a,b,c,d,...,x,y,z,aa,ab,ac.... } and given that this sequence corresponds (term for term) to the sequence S2 = {1,2,3,4,....} Write code to convert an element of S1 to the corresponding element of S2. Write code to convert an element of S2 to the corresponding element of S1.
tags: google software programming algorithm

Q222: Given a binary tree with the following constraints: a) A node has either both a left and right child OR no children b) The right child of a node is either a leaf or NULL write code to invert this tree.
tags: google software programming algorithm

Q223: Given a square with side length = 1, describe all points inside square that are closer to the center of the square than to the edge of the square.
tags: google software programming algorithm

Q224: How many 0's are at the end of N!
tags: google puzzle algorithm math

Q225: Given an array A[string], an array of strings where each string represents a word in a text document. Also given 3 search terms T1, T2, and T3 and 3 corresponding sorted sequences of integers S1, S2, and S3 where each integer in Si represents an index in A where search term Ti occured (i.e. S1, S2, and S3 contain the locations of the search terms in our array of words). Now find a minimal subarray of A that contains all of the search terms T1, T2, and T3. Extend this algorithm for an arbitrary number of search terms.
tags: google software programming algorithm

Q226: Design a data structure that supports push(), pop(), and min() all in O(1) timeDesign a data structure that supports push(), pop(), and min() all in O(1) time
tags: google software programming algorithm

Q227: There are a set of 'n' integers. Describe an algorithm to find for each of all its subsets of n-1 integers the product of its integers. For example, let consider (6, 3, 1, 2). We need to find these products : 6 * 3 * 1 = 18 6 * 3 * 2 = 36 3 * 1 * 2 = 6 6 * 1 * 2 = 12
tags: google math puzzle programming algorithm

Q228: What are the variable types in perl, how can you visually identify them in code?
tags: google software programming perl

Q229: What is the difference between a single-quote, a quote, and a back-tick in the shell?
tags: microsoft programming shell

Q230: What is the difference between hard links and symlinks? Where might you find a hard link commonly used?
tags: google unix

Q231: What do the variables $* and $@ do in bash
tags: google shell programming

Q232: What do you do if postfix displays an error about use when you try to start it?
tags: google shell programming unix

Q233: Where are the common ports listed?
tags: google unix networking

Q234: How can you check the exit status of a process?
tags: google unix

Q235: How do you view the routing table?
tags: google unix networking

Q236: What does the sticky bit do on a directory?
tags: google unix

Q237: Name the three packets exchanged in the setup of a TCP connection. Followup: name the three packets exchanged when a client closes a TCP connection.
tags: google networking

Q238: How many computers can you put on a /17 network?
tags: google networking

Q239: Rank the functions in order of their asymptotic behaviour ( which is the greatest) 1. 2^n 2. n! 3. n^googol ( googol=10^100) 4. n^n
tags: google software math

Q240: you have n resources and n threads .. what protocol do you use to ensure there is no deadlocking?
tags: google software

Q241: Implement a String class. What do you do when you initialize a string? Now implement an 'equals' operation. What are the best and worst running times of this function? Now how do you improve this ?
tags: google sw

Q243: How do you reverse a single linked list?
tags: ebay software

Q244: What is the difference between ArrayList and Vector
tags: microsoft java

Q245: How do you delete duplicates in a table?
tags: Yahoo database

Q246: What is the difference between online backup and standby backup?
tags: microsoft database

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

Q373: a guard has to take a wolf, a sheep and cabbage across a stream in a boat. the boat has room for the guard and one of the above. how would he do it, without leaving alone two of the passengers that might eat each other?
tags: qualitest puzzle

Q254: Given an array of integers, find the contiguous sub-array with the largest sum.
tags: microsoft sw

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

Q340: Given an array of n elements, how do you randomly select m elements (m<=n), such that the sum of n elements does not exceed some x ?
tags: Microsoft 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

Q494: Assume a set-associative cache. Describe how the bits of an address (e.g. 32 but address) are used to check for the presence of that address in the cache.
tags: intel nvidia architecture logic comparch

Q497: Given four points in the XY co-ordinate system, write a function to check if it will form a rectangle or not.
tags: microsoft C

Q521: You have to get from point A to point B. You don’t know if you can get there. What would you do
tags: google sw

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

Q500: Given an N x M two dimensional array of integers where all rows and columns are sorted in ascending order, write a function that can determine if a certain value exists in the array.
tags: microsoft programming data structures

Q501: Implement a breadth first traversal of a binary tree
tags: microsoft programming C++

Q518: Write some code to reverse a string
tags: google sw

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

Q520: Write some code to find all permutations of the letters in a particular string.
tags: google sw

Q517: Suppose you have an NxN matrix of positive and negative integers. Write some code that finds the sub-matrix with the maximum sum of its elements.
tags: google sw

Q393: Write a C function to print the link list in reverse order.
tags: Microsoft C software sw programming

Q397: Given n, find the number of trailing zeroes in n!
tags: Google sw

Q480: Get the width of a binary tree
tags: google Algorithm

Q508: 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: microsoft aptitude

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

Q516: There are a set of 'n' integers. Describe an algorithm to find for each of all its subsets of n-1 integers the product of its integers.
tags: google sw

Q511: How can you convert number nine to number six with a single stroke of pen.
tags: microsoft Puzzle

Q512: How do I change my default e-mail program from Outlook to Outlook Express?
tags: microsoft sw

Q513: Given a 2-d int array in which the values WILL ALWAYS increase in both directions ie. a[i][n+1]>a[i][n] & a[z+1][y] > a[z][y]. Write a function to find whether a value is within this 2-d array in the fastest way possible.
tags: Microsoft software/sw C

Q514: Given a number, describe an algorithm to find the next number which is prime.
tags: google sw

Q515: Order the functions in order of their asymptotic performance * 2^n * n^Googol ( 10^100) * n! * n^n
tags: google

Q522: What method would you use to look up a word in a dictionary
tags: google sw

Q523: Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval
tags: google sw

Q524: Describe the data structure that is used to manage memory.
tags: google sw

Q525: What is the difference between local and global variables
tags: google sw

Q541: You are given a list of numbers. When you reach the end of the list you will come back to the beginning of the list (a circular list). Write the most efficient algorithm to find the minimum # in this list. Find any given # in the list. The numbers in the list are always increasing but you don’t know where the circular list begins, ie: 38, 40, 55, 89, 6, 13, 20, 23, 36.
tags: google sw

Q542: Given a list of numbers and a target sum, how would you efficiently determine whether a pair of numbers from the list can add up to the target sum? (list based approach is O(n^2) while hash-table based approach is O(n) )
tags: google sw

Q540: Tree search algorithms. Write BFS and DFS code, explain run time and space requirements. Modify the code to handle trees with weighted edges and loops with BFS and DFS, make the code print out path to goal state
tags: google sw

Q539: You have a stream of infinite queries (ie: real time Google search queries that people are entering). Describe how you would go about finding a good estimate of 1000 samples from this never ending set of data and then write code for it.
tags: google sw

Q538: Write a function (with helper functions if needed) called toExcel that takes an excel column value (A,B,C,D…AA,AB,AC,… AAA..) and returns a corresponding integer value (A=1,B=2,… AA=26..)
tags: google sw

Q537: In Java, what is the difference between final, finally, and finalize
tags: google sw java

Q536: In Java, what is the difference between static, final, and const
tags: google sw java

Q543: Design an algorithm which can find all the dictionary words correspond to a n-digit telephone number, assuming each digit maps to several alphabet letter.
tags: google sw

Q544: There are N stars in the sky, how do you find the closest pair
tags: google sw

Q545: Write a program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.
tags: google sw

Q546: Given two sequences of items, find the items whose absolute number increases or decreases the most when comparing one sequence with the other by reading the sequence only once.
tags: google sw

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

Q548: Lets say you have to construct Google maps from scratch and guide a person standing on Gateway of India (Mumbai) to India Gate (Delhi). How do you do the same
tags: google sw

Q549: You are given a small sorted list of numbers, and a very very long sorted list of numbers - so long that it had to be put on a disk in different blocks. How would you find those short list numbers in the bigger one
tags: google sw

Q550: Given a set of coin denominators, find the minimum number of coins to give a certain amount of change.
tags: google sw

Q551: How many golf balls can fit in a school bus
tags: google puzzle

Q552: How many times a day does a clock’s hands overlap
tags: google puzzle

Q553: Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens
tags: google puzzle

Q554: In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country
tags: google puzzle

Q555: If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)
tags: google math puzzle

Q556: If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands?
tags: google puzzle

Q557: You have five pirates, ranked from 5 to 1 in descending order. The top pirate has the right to propose how 100 gold coins should be divided among them. But the others get to vote on his plan, and if fewer than half agree with him, he gets killed. How should he allocate the gold in order to maximize his share but live to enjoy it
tags: google microsoft puzzle

Q558: Calculate the Resistance in ohm's that a knights move would require on an infinite plane of resistors of unit resistance.
tags: google puzzle

Q559: Write a C program which measures the the speed of a context switch on a UNIX/Linux system
tags: google sw unix os

Q560: Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7
tags: microsoft google math sw puzzle

Q561: You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write a the question on a card which and give it to Eve who will take the card to Bob and return the answer to you. What must you write on the card, besides the question, to ensure Bob can encode the message so that Eve cannot read your phone number
tags: microsft google sw security

Q562: How are cookies passed in the HTTP protocol
tags: microsoft google sw html web

Q563: What is the size of the C structure below on a 32-bit system? On a 64-bit? struct foo { char a; char* b; };
tags: google microsoft sw

Q564: Write a regular expression which matches a email address
tags: microsoft google sw

Q565: You are given a the source to a application which is crashing when run. After running it 10 times in a debugger, you find it never crashes in the same place. The application is single threaded, and uses only the C standard library. What programming errors could be causing this crash? How would you test each one
tags: microsoft google sw

Q566: Explain how congestion control works in the TCP protocol.
tags: microsoft google sw networking

Q567: Design and describe a system/application that will most efficiently produce a report of the top 1 million Google search requests. You are given: 1. You are given 12 servers to work with. They are all dual-processor machines with 4Gb of RAM, 4x400GB hard drives and networked together.(Basically, nothing more than high-end PCs) 2. The log data has already been cleaned for you. It consists of 100 Billion log lines, broken down into 12 320 GB files of 40-byte search terms per line. 3. You can use only custom written applications or available free open-source software.
tags: google sw hw os

Q568: You are given a game of Tic Tac Toe. You have to write a function in which you pass the whole game and name of a player. The function will return whether the player has won the game or not. First you to decide which data structure you will use for the game.You need to tell the algorithm first and then need to write the code
tags: google puzzle

Q569: How do you put a Binary Search Tree in an array in a efficient manner?
tags: google sw

Q570: Given a Data Structure having first n integers and next n chars. A = i1 i2 i3 ... iN c1 c2 c3 ... cN. Write an in-place algorithm to rearrange the elements of the array as A = i1 c1 i2 c2 ... in cn
tags: google sw

Q571: How many lines can be drawn in a 2D plane such that they are equidistant from 3 non-collinear points
tags: google puzzle math

Q572: Given a Binary Tree, how do you check it is a Binary Search Tree
tags: google sw

Q573: Write a function to find the middle node of a single link list
tags: google sw

Q574: You are given 2 eggs. You have access to a 100-storey building. Eggs can be very hard or very fragile, meaning it may break if dropped from the first floor or will not even break if dropped from 100 th floor. Both eggs are identical. You need to figure out the highest floor of a 100-storey building an egg can be dropped without breaking. Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process.
tags: google puzzle

Q575: Given two binary trees, write a compare function to check if they are equal or not. Being equal means that they have the same values and same structure
tags: microsoft google sw

Q576: Implement put/get methods of a fixed size cache with LRU replacement algorithm
tags: google sw

Q577: What work have you done on full chip Clock and Power distribution? What process technology and budgets were used
tags: intel nvidia hw

Q578: What types of I/O have you designed? What were their size? Speed? Configuration? Voltage requirements
tags: intel amd nvidia hw

Q579: You have a driver that drives a long signal & connects to an input device. At the input device there is either overshoot, undershoot or signal threshold violations, what can be done to correct this problem
tags: intel amd hw

Q580: Write a function that given a list of items and weights return a random item in the list taking the weights into account
tags: amazon sw

Q581: You have 50,000 html files, some of which contain phone numbers. How would you create a list of all the files which contain phone numbers
tags: amazon sw

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

Q583: How are requests handled in Resin (or a Java servlet container in general)
tags: amazon sw

Q584: How does dynamic recompilation work in Resin (or any other Java servlet container)
tags: amazon sw

Q585: Write a function that returns a node in a tree given two parameters: pointer to the root node and the inorder traversal number of the node we want to return. The only information stored in the tree is the number of children for each node
tags: amazon sw

Q586: Write a function that returns the angle between the hour and the minute hands of a clock, given input of the time.
tags: microsoft google sw puzzle

Q587: You are given with three sorted arrays (in ascending order), you are required to find a triplet (one element from each array) such that difference between their positions is minimum
tags: google sw

Q589: Given a file with 4 billion 32bit integers, how do you find an missing integer from the file? In other words, which integer didn't show up in this file? You are given only 16MB memory.( not using external sorting)
tags: google sw math