## Algorithms

• What's the difference between a linked list and an array?
• Implement a linked list. Why did you pick the method you did?
• Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.
• Implement an algorithm to reverse a linked list. Now do it without recursion.
• Implement an algorithm to insert a node into a circular linked list without traversing it.
• Implement an algorithm to sort an array. Why did you pick the method you did?
• Implement an algorithm to do wild card string matching.
• Implement strstr() (or some other string library function).
• Reverse a string. Optimize for speed. Optimize for space.
• Reverse the words in a sentence, i.e. "My name is Chris" becomes "Chris is name My." Optimize for speed. Optimize for space.
• Find a substring. Optimize for speed. Optimize for space.
• Compare two strings using O(n) time with constant space.
• Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?
• Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
• Multiple by 8 without using multiplication or addition. Now do the same with 7.
• Add numbers in base n (not any of the popular ones like 10, 16, 8 or 2 -- I hear that Charles Simonyi, the inventor of Hungarian Notation, favors -2 when asking this question).
• Write routines to read and write a bounded buffer.
• Write routines to manage a heap using an existing array.
• Implement an algorithm to take an array and return one with only unique elements in it.
• Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it.
• Implement an algorithm to print out all files below a given root node.
• Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date.
• How would you find a cycle in a linked list?
• Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints.
• The following asm block performs a common math function, what is it?
·                cwd xor ax, dx
sub ax, dx
• Imagine this scenario:
I/O completion ports are communictaions ports which take handles to files, sockets, or any other I/O. When a Read or Write is submitted to them, they cache the data (if necessary), and attempt to take the request to completion. Upon error or completion, they call a user-supplied function to let the users application know that that particular request has completed. They work asynchronously, and can process an unlimited number of simultaneous requests.
Design the implementation and thread models for I/O completion ports. Remember to take into account multi-processor machines.
• 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.
• Write a function to print all of the permutations of a string.
• Implement malloc.
• Write a function to print the Fibonacci numbers.
• Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B.
• How would you write qsort?
• How would you print out the data in a binary tree, level by level, starting at the top?

## Applications

• How can computer technology be integrated in an elevator system for a hundred story office building? How do you optimize for availability? How would variation of traffic over a typical work week or floor or time of day affect this?
• How would you implement copy-protection on a control which can be embedded in a document and duplicated readily via the Internet?
• Define a user interface for indenting selected text in a Word document. Consider selections ranging from a single sentence up through selections of several pages. Consider selections not currently visible or only partially visible. What are the states of the new UI controls? How will the user know what the controls are for and when to use them?
• How would you redesign an ATM?
• Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
• What is the difference between an Ethernet Address and an IP address?
• How would you design a coffee-machine for an automobile.
• If you could add any feature to Microsoft Word, what would it be?
• How would you go about building a keyboard for 1-handed users?
• How would you build an alarm clock for deaf people?

## Thinkers

• If you had a clock with lots of moving mechanical parts, you took it apart piece by piece without keeping track of the method of how it was disassembled, then you put it back together and discovered that 3 important parts were not included; how would you go about reassembling the clock?
• If you had to learn a new computer language, how would you go about doing it?
• You have been assigned to design Bill Gates bathroom. Naturally, cost is not a consideration. You may not speak to Bill.
• What was the hardest question asked of you so far today?
• If MS told you we were willing to invest $5 million in a start up of your choice, what business would you start? Why? • If you could gather all of the computer manufacturers in the world together into one room and then tell them one thing that they would be compelled to do, what would it be? • Explain a scenario for testing a salt shaker. • If you are going to receive an award in 5 years, what is it for and who is the audience? • How would you explain how to use Microsoft Excel to your grandma? • Why is it that when you turn on the hot water in any hotel, for example, the hot water comes pouring out almost instantaneously? • Why do you want to work at Microsoft? • Suppose you go home, enter your house/apartment, hit the light switch, and nothing happens - no light floods the room. What exactly, in order, are the steps you would take in determining what the problem was? • Interviewer hands you a black pen and says nothing but "This pen is red." 1. For Realising EX-OR gate how many NAND gates are required 2. The time required for the data to setting, before the triggering edge of the clock. Ans. Setup Time. 3. How can we change DFF to TFF 4. How can we change SRFF to JKFF 5. Minimum Number of 2:1 MUX required for 16:1 MUX 6. A 12 address lines maps to the memory of > > [a] 1k bytes [b] 0.5k bytes [c] 2k bytes [d] none > > Ans: b 7. In a processor these are 120 instructions . Bits needed to impliment > this instructions > [a] 6 [b] 7 [c] 10 [d] none > > Ans: b 8. n=7623 > { > temp=n/10; > result=temp*10+ result; > n=n/10 > } > > Ans : 3267 9. C program code > > int zap(int n) > { > if(n<=1)then zap=1; > else zap=zap(n-3)+zap(n-1); > } > then the call zap(6) gives the values of zap > [a] 8 [b] 9 [c] 6 [d] 12 [e] 15 > > Ans: b 10. Virtual memory size depends on > [a] address lines [b] data bus > [c] disc space [d] a & c [e] none > > Ans : a 11. load a > mul a > store t1 > load b > mul b > store t2 > mul t2 > add t1 > > then the content in accumulator is > > Ans : a**2+b**4 12. E=I*I*R what is the effect of E when I becomes I/2 ans:1/4E(E decreses by 4 times) 13. out of 55 eggs 5 are defective. what is % of defective eggs ans:9/11% 14. A>B,B>C,C=D,D>E,then which is greatest a)A/B b) A/C c) A/E d)none ans: c 15. section 2. letter series ------------------------- 1. a c b d f e g i __ ans: h 2. x y z u v w r s t __ ans: o 3. a c f j o __ ans:u 16. section 3. numerical ability ------------------------------- 1. 10099+99=10198 2. 31 - 29+2/33=__ ans:64/33 3. 2.904+0.0006=___ ans: 2.9046 4. 55/1000=___ ans:.005 5. 0.799*0.254= 0.202946 6. 200/7*5.04=144 7. 842.8 +602=1444.8 8. 5.72% of 418= 23.9096 9. 625% of 7.71=48.1875 10. 25% of 592=148.00 11. 665+22.9=687.9 12. 15% of 86.04=12.906 17. what is the direction of motion of an electron kept in an electromagnetic field. 18. in a transistor, the saturation current can be controlled by changing a)anode potential b)grid potential c)cathod potential d)non of the above 19. probability for speaking truth for A ->75% for B ->80% what is the probability that both of them will tell lie for a given fact 20. what will be order of SURITI in the dictionary if the letters of the word is arranged in lexicographical order 21. two persons are select any number from 1 to 25. they win if they select the same one.whatis the probability that they will win . 22. f(x)=(1-cos(x)(1-cos(x)))/(x*x*x) What is the value of f(x) at x=0, so that it is continious 23. Same atomic no. & atomic mass (a) isotone (b) isomer (c) isobar (d) isomar. 1. Optimize the below 1,2,3,4 questions for time:1)int i;if i=0 then i:=1;if i=1 then i:=0;2)int i;if i=0 then i:=1;if i=1 then i:=0;(given that i can take only two values (1,0))3)int i;if i=0 then i:=1;else if i=1 then i:=0;(given that i can take only two values (1,0))4)int m,j,i,n;for i:=1 to n dom:=m+j*n 2. Expand the followinga) ISDNb) CASEc) CSMA/CDd) OOPSe) MIMD 3. n the following questions, answer A,B,C,D depending on whenthe errors are detected?A if no error is detectedB if semantic and syntactic checkingC if during Code genration & Symbol allocationD run timea) Array overboundb) Undeclared identifierc) stack underflowd) Accessing an illegal memory location 4. If a CPU has 20 address lines but MMU does'nt use two of them. OS occupies 20K. No virtual memory is supported. What is the maximum memory available for a user program? 5.  For a binary tree with n nodes, How many nodes are there whichhas got both a parent and a child? 6. Which of the following can be zero? (only one) a) swap space b) physical memory c) virtual memory 7. What is a must for multitasking? a) Process preemption b) Paging c) Virtual memory d) None of the above 8. Using the following instructions and two registers , A&B. find out A XOR B and put the result in A PUSH POP NOR These instructions operates with A & B and puts the result in AND A(question basically to get XOR in terms of NOR and AND) 9. int i=0;int j=0;loop:if(i = 0) i++;i++;j++;if(j<= 25) goto loop xxx: question1 : how many times is the loop entered  10. For which of following is it not possible to write an algorithm.a) To find out 1026th prime numberb) To write program for NP-complete problemc) To write program which generates true Random numbers. 11. what is the essential requirement for an real-time systemsa) pre-emptionb) virtual memoryc) paging etc... 12. a cube has colors blue,red ,yellow each on two opposite sides.cube isdivided into "32 small cubes and 4 large cubes".question:how many cubes (on 36 cubes) have blue at leat one side. how many cubes have colors on two sides. 13. aa person sold two articles for 80 /- each.with 20% profit on onearticle and 20% loss on another article, what is the loss / prifit hewill gain on both. 14. main(){int a,b;int *p,*q;a=10;b=19;p=&(a+b);q=&max;} Q a)error in p=&(a+b) b)error in p=&max c)error in both d) no error  Aptitude:- 1. What is the area covered in in 14 minutes by the minute hand of a clock of length 15 cm ? 2. What is the diameter of a wheel if it covers 440 m in 1000 revolutions? 3. There are 1 Re, 50 p, 25 p coins in the ratio 3:3:4 respectively. if the total amount is Rs.550, how many 1 Re coins are there? ans: 300 4. if A can do 1/3rd of work in 4 days and B can do 1/6th of work in 3 days, then in how many days can both A and B complete the work. ans: 7 1/7 days 5. if a number is divided by 935 remainder is 69. if same no. is divided by 38, what will be the remainder? ans: 29 6. if a tank is filled by 10 pumps, it takes 12 hours. if the same tank is filled by 15 pumps, then it will take 6 hours. how much time will it take to fill the tank if 25 pumps are used? 7. what is the probability of having b'days of 2 persons on the same day in a gathering of 50 persons? 8. how many words can be formed by the letters of the word DELCIOUS starting with D and ending with E? ans: 6! = 720 9. if a man works for 3 hours he gets Rs.15 + 1 meal. if he works for 12 hours he gets Rs.90 + 2 meals. what is the cost of a meal? ans: Rs.15/- 10. if a tank can be filled by pipe A in 24 mins and by pipe B in 32 mins. if A and B both are open, when should B be stopped to fill the tank in 18 mins. C Programming 1. typedef struct{char *;nodeptr next;} * nodeptr;what does nodeptr stand for?2. supposing thaty each integer occupies 4 bytes and each charactrer1 byte , what is the output of the following programme?#includemain(){int a[] ={ 1,2,3,4,5,6,7};char c[] = {' a','x','h','o','k'};printf("%d\t %d ", (&a[3]-&amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;a[0]),(&c[3]-&c[0]));}ans : 3 33. what is the output of the program?#includemain(){struct s1 {int i; };struct s2 {int i; };struct s1 st1;struct s2 st2;st1.i =5;st2 = st1;printf(" %d " , st2.i);}ans: nothing (error)expl: diff struct variables should not assigned using "=" operator.4.what is the output of the program?#includemain(){int i,j;int mat[3][3] ={1,2,3,4,5,6,7,8,9};for (i=2;i>=0;i--)for ( j=2;j>=0;j--)printf("%d" , *(*(mat+j)+i));}ans : 9 6 3 8 5 2 7 4 1 Aptitude:- 1. ONE RECTANGULAR PLATE WITH LENGTH 8INCHES,BREADTH 11 INCHES AND 2 INCHES THICKNESS IS THERE.WHAT IS THE LENGTH OF THE CIRCULAR ROD WITH DIAMETER 8 INCHES AND EQUAL TO VOLUME OF RECTANGULAR PLATE? ANS: 3.5INCHES 2. WHAT IS THE NUMBER OF ZEROS AT THE END OF THE PRODUCT OF THE NUMBERS FROM 1 TO 100 3. in some game 139 members have participated every time one fellow will get bye what is the number of matches to choose the champion to be held? ans: 138 4. one fast typist type some matter in 2hr and another slow typist type the same matter in 3hr. if both do combinely in how much time they will finish. ans: 1hr 12min 5. in 8*8 chess board what is the total number of squares refer odel ans:204 6. falling height is proportional to square of the time. one object falls 64cm in 2sec than in 6sec from how much height the object will fall. 7. gavaskar average in first 50 innings was 50 . after the 51st innings his average was 51 how many runs he made in the 51st innings 8. 2 oranges,3 bananas and 4 apples cost Rs.15 . 3 ornages 2 bananas 1 apple costs Rs 10. what is the cost of 3 oranges, 3 bananas and 3 apples ans Rs 15. 9. in 80 coins one coin is counterfiet what is minimum number of weighings to find out counterfiet coin 10. in a company 30% are supervisors and 40% employees are male if 60% of supervisors are male. what is the probability that a randomly choosen employee is a male or female? 11. THERE WERE 750 PEOPLE WHEN THE FIRST SONG WAS SUNG. AFTER EACHSONG 50 PEOPLE ARE LEAVING THE HALL. HOWMANY SONGS ARE SUNG TO MAKETHEM ZERO?ANS:16 12. A PERSON IS CLIMBING OF 60 MTS . FOR EVERY MINUTE HE IS CLIMBING 6 MTSAND SLIPPING 4 MTS . AFTER HOWMANY MINUTES HE MAY REACH THE TOP?ANS: (60-6)/2 +1 :28 13. SALARY IS INCREASED BY 1200 ,TAX IS DECREASED FROM 12% TO 10% BUT PAYINGSAME AMOUNT AS TAX . WHAT IS THE PREVISIOUS SALARY?ANS:6000 14. THE LEAST NO. WHICH IS WHEN DEVIDED BY 4,6,7 LEAVES A REMAINDER OF 2 ?ANS: 86 15. A MAN DRIVING THE CAR AT TWICE THE SPEED OF AUTO ONEDAY HE WAS DRIVENCAR FOR 10 MIN. AND CAR IS FAILED. HE LEFT THE CAR AND TOOK AUTO TO GOTOTHE OFFICE . HE SPENT 30 MIN. IN THE AUTO. WHAT WILL BE THE TIME TAKE BYCAR TO GO OFFICE?ANS:25 MIN 16. OUT OF 100 FAMILIES IN NEIGHBOUR HOOD , 55 OWN RADIO, 75 OWN T.VAND 25 OWN VCR. ONLY 10 FAMILIES HAVE ALLOF THESE, AND EACH VCR OWNERHAS TV . IF 25 FAMILIES HAVE THE RADIO ONLY, THE NO. OF FAMILIES HAVEONLY TV ARE?ANS: 30 17. KYA KYA IS AN ISLAND IN THE SOUTH PACIFI . THE INHABITANTS OF KYA KYAALWAYS ANSWER ANY QUESTION WITH TWO SENTENCES, ONE OR WHICH IS ALWAYSTRUE AND OTHER IS ALWAYS FALSE.1. YOU ARE WALKING ON THE ROAD AND COME TO A FORK. YOU ASK ,THE INHABITANTSRAM.LAXMAN, AND LILA AS" WHICH ROAD WILL TAKE ME TO THE VILAGE?RAM SAYS: I NEVER SPEAK TO STRANGERS. IAM NEW TO THIS PLACELAXMAN SAYS: IAM MARRIED TO.LILA. TAKE THE LEFT ROADLILA SAYS: IAM MARRIED TO RAM. HE IS NOT NEW TO THIS PLACEANS: LEFT ROAD TAKE YU TO THE VILLAGE2. YOU FIND THAT YOUR BOAT IS STOLLEN. U QUESTIONED THREE INHABITANTS OTISLANDS AND THEIR REPLIES AREJOHN : I DIDNOT DO IT. MATHEW DIDNOT DO ITMATHEW : I DIDNOT DO IT. KRISHNA DIDNOT DO ITKRISHNA: I DID NOT DO IT; I DONOT KNOW WHO DID ITANS: MATHEW STOLEN THE BOAT3. YOU WANT TO SPEAK TO THE CHIEF OF VILLAGE , U ASK THREE FELLOWS AMARBOBBY, CHARLES AND BOBBY IS WEARING RED SHIRTAMAR : IAM NOT BOBBYS SON ; THE CHIEF WEARS RED SHIRTBOBBY : IAM AMARS FATHER ; CHARLES IS THE CHIEFCHARLES : THE CHIEF IS ONE AMONG US; IAM THE CHIEFANS: BOBBY IS THE CHIEF4. THERE IS ONLY OPNE POLOT IN THE VILLAGE(ISLAND). YOU INTERVIEWED THREEM MANKOISK ,LORRY AND MISHRAU ALSO NOTICE THAT KOISK IS WEARING CAP.M SAYS : LARRY IS FATHER IN THE PILOT .LARRY IS NOT THE PRIESTS SONKOISK : IAM THE PRIEST ON THEIS ISLAND ONLY PRISTS CAN WEAR THE CAPSLARRY : IAM THE PRIEST SON . KOISK IS NOT THE PRESTANS : KOISK IS THE PILOT 18. LCM OF 3 PRIME NO.S IS 1729. THE HIGHEST NUMBERAMONG THEM IS ? A 13 B 19 C 23 D 11. ANS 19 19. A SHIP LEFT THE YARD AND TRAVELLED 180 MILES. NOWANOTHER FLIGHT WITH 10 TIMES THE SPEED OF THE SHIPSTARTED . WHEN BOTH WILL MEET?ANS 200 MILES 20. THE PRBABILITY OF HITTING A TARGET BY X IS 0.9 ANDTHAT OF B IS 0.8, THEN IF BOTH TRY WHAT IS THEPROBABILITY OF HITTING THE TARGET.ANS 0.98.  21. THE LENGTH OF THE ROPE IS 660M. WHAT IS THE MAXIMUMAREA COVERED BY THIS ROPE?ANS 34650 22. a MAN IS INCREASING HIS SPEED 5% EVRY hr ANOTHERINCREASES 1% IN 1ST AND 3% IN SECOND AND SO.ON WHENTHY MEET? 23. A TAP CAN FILL THE TANK IN 10hrS,10 HOLES CANEMPTY WITHIN 6hr, OF SAME CAPACITY 15 HOLES WHITH IN6hr.if ALL OPERATE THEN THE TIME OF FILLING THE TANK. Programming:- 1. Swapping two variables x,y without using a temporary variable. 2. Write a program for reversing the given string. 3. The integers from 1 to n are stored in an array in a randomfashion. but one integer is missing. write a program to find themissing integer. ans. idea. the sum of n natural numbers is = n(n+1)/2. if we subtract the above sum from the sum of all the numbers in the array , the result is nothing but the missing number. 4. Write a c program to find whether a stack is progressing in forward or reverse direction. 5. Write a c program that reverses the linked list. C/C++:- 1. typedef struct{ char *; nodeptr next; } * nodeptr;what does nodeptr stand for? 2. int *x[](); meansexpl: Elments of an array can't be functions. 3. o/p=?int i;i=1;i=i+2*i++;printf(%d,i); ans: 4 4. #includechar *f(){char *s=malloc(8);strcpy(s,"goodbye")}main(){char *f();printf("%c",*f()='A');o/p=? 5. FILE *fp1,*fp2;fp1=fopen("one","w")fp2=fopen("one","w")fputc('A',fp1)fputc('B',fp2)fclose(fp1)fclose(fp2)}ans: no error. But It will over writes on samefile. 6. #define MAN(x,y) (x)>(y)?(x):(y){ int i=10;j=5;k=0;k= MAX(i++,++j)printf(%d %d %d %d,i,j,k)} 7. a=10;b=5; c=3;d=3;if(a 8. what is o/p> #include> show(int t,va_list ptr1)> {> int a,x,i;> a=va_arg(ptr1,int)> printf("\n %d",a)> }> display(char)> {int x;> listptr;> va_star(otr,s);> n=va_arg(ptr,int);> show(x,ptr);> }> main()> {> display("hello",4,12,13,14,44);> }> a) 13 b) 12 c) 44 d) 14 9. main()> {> printf("hello");> fork();> } 10. main()> {> int i = 10;> printf(" %d %d %d \n", ++i, i++, ++i);> } 11. #include> main()> {> int *p, *c, i;> i = 5;> p = (int*) (malloc(sizeof(i)));> printf("\n%d",*p);> *p = 10;> printf("\n%d %d",i,*p);> c = (int*) calloc(2);> printf("\n%d\n",*c);> } 12. #define MAX(x,y) (x) >(y)?(x):(y)> main()> {> int i=10,j=5,k=0;> k= MAX(i++,++j);> printf("%d..%d..%d",i,j,k);> } 13. #include > main()> {> enum _tag{ left=10, right, front=100, back};> printf("left is %d, right is %d, front is> %d, back is> %d",left,right,front,back);> } 14. main()> {> int a=10,b=20;> a>=5?b=100:b=200;> printf("%d\n",b);> } 15. #define PRINT(int) printf("int = %d ",int)> main()> {> int x,y,z;> x=03;y=02;z=01;> PRINT(x^x);> z<<=3;PRINT(x); > y>>=3;PRINT(y);> } 16. what is the o/p of the programmain(){ int rows=3,colums=4; int a[rows][colums]={1,2,3,4,5,6,7,8,9,10,11,12}; i=j=k=99; for(i=0;i 17. what is o/pmain(){int i=3;while(i--){int i=100i--;printf("%d..",i);}}a) infinite loopb) errorc) 99..99..99..99d) 3..22..1.. 18. '-'=45 '/'=47printfr(%d/n,'-','-','-','-','/','/','/');o/p =? 19. { ch='A';while(ch<='F'){ switch(ch){ case'A':case'B':case'C':case'D':ch++;continue; case'E':case'F':ch++; } putchar(ch); } } a)ABCDEF b.EFG c.FG d.error Analytical 1. One number of five digit is given if we append 9 before the numberit will become 4 times when append 9 at end . WHAT IS NUMBER? 2. 6 MONKS 6 cannible( can eat monks if C> M any timeany where) One boat . boat can sustain at most 3 persons. Trivialquestion.... 3. Two inputs in a block are going (N1 and N2) two outputs (Max andmin of that). If U have 4 numbers than how u use this as a buildingblock to sort 4 numbers.  Technical 1. 1) static (wrt dynamic circuits)2) Electromigration3) Hot electron4) Tr in Saturation5) Latch-up6) Seq. Ckt.7) CLM8) FIR filter. 2. 1) Dynamic circuits.......with feedback called HALF LATCH.2) inv with PMOS and NMOS exchanged3) which circuit is having smallest fall delay . options 1) NAND bothinput connected 2) NOR both input connected 3) NAND with one inputat VDD 4) nor with one input at GND4) question on microprocessor6) question on DMA7) Network simple question on charge sharing8) Implement following statement with logic gates if(a==b) {y=p} else{y=q}9) One complicated ckt with two inputs and one output and VDD andno GND and is XNOR.10) Current mirror simple question current is I2 = 2I1 answer.11) NAND and NOR equivalent to the inverter with same rise andfall time. 3. 1) Layout routing2) Capacitance from layout3) Fringing and area capacitance calculation4) Sheet resistance is given u have to calculate total resistance.5) Microprocessor question with 3-stage pipeline instruction.Easy question6) Simple circuit with glitch in that how to remove it and drawthe waveforms. K map has given.7) Implemet ckt with AND/OR/INV . ## Object Oriented Programming Concepts • Generally, which is the stronger relationship, containment or composition? • What is coupling? • What is "cohesion and coupling"? • What is abstract coupling? • What is Parmetric polymorphism? • Why will you need multiple inheritence? • What is the Liskov's Substitution Principle? • Describe these design methodologies: Booch, OMT, Use cases. • Differentiate between subtyping and subclassing. ## Design Patterns • What does Design mean to you? (Factor 5) • What is Pimpl and what is it used for? • What is an adapter? Is it different from a wrapper? C/C++ 1. Grade ur knowledge in c and c++ from 0 to 100 2. What is virtuval distrcuctor. 3. Are there any default concstructors in c++? what are they? 4. What is the difference between copy constructor and Overkloading =. Why language is provided two of these? 5. What are inline functions, what is the difference between #define and inline 6. What is the difference between inline and normal function. will the compiler take inline functions always inline ,if not on which basis it will decide to ignore inline. 7. Prog which illustrates difference between extern and static 8. Virtual and Friend Function in C++ 9. The sequence in which constructors of classes A, B and C are called when class A is inherited from class B which is inherited from class C. 10. Steps in the compilation of a C program. or steps in preprocessing in sequence. 11. Differences between a reference and a pointer in C++. 12. Differences between typedef and #define 13. If we have a union with three variables int i, char c, float f; and we store a value in say the variable c now. and we forget what is the variable of the union that holds a value currently, after some time. for this is there any mechanism provided by the language using which we can find out whether it is i or c or f that currently holds a value. 14. padding bytes for structures: suppose there is structure struct x{int x, char c}; and the compiler is a four byte compiler. then what is memory allocated to variable of this struct type. if the structure definition is struct y{char x; int y;}; then what is the memory allocated for a variableof this type. 15. Prototype definition of the printf() function. 16. How do you dynamically allocate a two dimensional array of size a by b. ans: int **x; x = (int**)malloc(sizeof(int*)*a); for(int i=0;i 17. Then what if it is assigned as: int *y = (int*)x; 18. Questions on declarations of function pointers in C. 19. Differences between Java and C++. 20. Inorder, preorder, and post order traversals. 21. how do you find out if a loop(cycle) exists in a linked list,efficiently 22. name the oo concepts. OS/Compiler/AI/Networking 1. What is the light weight process ? 2. Why thread is lightweight? 3. What is the best Scheduling algo that will give best throughput? 4. Semaphores and mutexes. 5. What is that we can't do with boolean variables that can be done with semaphores? 6. Question about UNIX file system. 7. Inode number 0 corresponds to what? 8. Name few compiler optimizations (little more about compiler optimizations) 9. What is LALR parser. 10. What is hill climbing? 11. What is simulated annealing? 12. What is piggybacking? 13. Tell some differences between congestion control and flow control? 14. Theory of computations 1) about various complexity classes; 2). NP-hard and NP-copmleteness, examples; 3). what is universal Turing machine? Aptitude 1. There are 100 gates with doors ( 1.... 100).Intially they are open. Switching the gates ( if open then close , if closed then open ) can be done. First they will switch the multiples of 1's then they will switch the multiple's of 2's and soooo on multiple's of 100's. Now, at the end how many doors are closed and what are they? 2. 10 58 ____ Ans: 3^n+7^n --> 3^3+7^3 Ans: ( 1,4,9,16,25,36,49,64,81,100) 1. #include#includeint main(){ int p,q; clrscr(); p=5 - - - - 3* 6; printf("%d \n",p);}#include#includeint main(){ int p,q; clrscr(); p=5 + + + + 3* 6; printf("%d \n",p);}ans : 23 23 2. postfix expression was given622+-382/*+2^3+solve itans : 199 3. A tree was given , find the postorder 4. what do you mean by operator overloadingans : assigning user defined meaning to an existing operator by an operator function 5.  ______________________________________________________|___ ___|___ ___|___ || | | | | | || |__ | |___ | |___ ||_______| | |_______| |______ |_______| | | not | | | |_____________________|_____________|____and_|___ans : modulo 6 counter 6. 1001000 is the initial state of ring counter after how many clockpulses initial state is again achieved.ans. 7 7. minm. no. of flip flop required for mod 33ans. 6 8. a no. is given in base 21 which is the extension of hex. i.e.10,11,12......20 A, B, C,......KWHAT IS the value of KA in octal 9. DMA IS:ans. i/o to memory without intereferene of cpu 10. no. of 0's in 15*1024+7*32+3ans. 5 11. A man while going dowm in a escalator(which is moving down) takes50steps to reach down and while going up takes 125 steps. If he goes 5timesfaster upwards than downwards. What will be the total no of steps iftheescalator werent moving. 12. 2/3 of corckery(plates) are broken, 1/2 have someother thing(handle)broken , 1/4 are both broken and handle broken. Ultimately only 2piecesof corckery were without any defect. How many crockery were there intotal. 13. odd one out a) person b) time c) object d) reason ans : d) reason 14. a) owcb)hepesc)rosehd)gunenipans : d)penguin 15. insert three letter words so that it makes 2 wordsring(_ _ _)ter 16. Insert 4 letter word that has exact meaning as given outside thebracketWILLING (_ _ _ _)SPORT  Here are soem Microsoft Interview Questions form http://alien.dowling.edu/%7Erohit/wiki/index.php/Microsoft_Interview_Questions • If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts? • If you are on a boat and you throw out a suitcase, will the level of water increase? • On an average, how many times would you have to open the Seattle phone book to find a specific name? • There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they don't collide? • If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? ( The answer to this is not zero!) • What new feature would you add to MSWORD if you were hired? • Why did you pick the school you graduated from? • Why do you want to work for Microsoft? • How many Gas stations are there in the US? • How would you weigh a plane without using scales? • How would you move Mt. Everest? • Two math graduates bump into each other at Fairway on the upper west side. They hadn't seen each other in over 20 years. The first grad says to the second: "how have you been?" Second: "Great! I got married and I have three daughters now" First: "Really? how old are they?" Second: "Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there.." First: "Right, ok.. oh wait.. hmmmm.., I still don't know" second: "Oh sorry, the oldest one just started to play the piano" First: "Wonderful! my oldest is the same age!" Problem: How old are the daughters? • Why are beer cans tapered at the top and bottom? • Why is it that hot water in a hotel comes out instantly but at home it takes time? • How many times a day a clock's hands overlap? • Mike has$20 more than Todd. How much does each have given that combined they have $21 between them. You can't use fractions in the answer.(Hint: This is a trick question, pay close attention to the condition) • There are four dogs, each at the counter of a large square. Each of the dogs begins chasing the dog clockwise from it. All of the dogs run at the same spd. All continously adjust their direction so that they are always heading straight towards their clockwise neighbor. How long does it take for the dogs to catch each other? Where does this happen? (Hint: Dog's are moving in a symmetrical fashion, not along the edges of the square). Here are soem Microsoft Interview Questions form http://alien.dowling.edu/%7Erohit/wiki/index.php/Microsoft_Interview_Questions • If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts? • If you are on a boat and you throw out a suitcase, will the level of water increase? • On an average, how many times would you have to open the Seattle phone book to find a specific name? • There are 3 ants at 3 corners of a triangle, they randomly start moving towards another corner. What is the probability that they don't collide? • If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? ( The answer to this is not zero!) • What new feature would you add to MSWORD if you were hired? • Why did you pick the school you graduated from? • Why do you want to work for Microsoft? • How many Gas stations are there in the US? • How would you weigh a plane without using scales? • How would you move Mt. Everest? • Two math graduates bump into each other at Fairway on the upper west side. They hadn't seen each other in over 20 years. The first grad says to the second: "how have you been?" Second: "Great! I got married and I have three daughters now" First: "Really? how old are they?" Second: "Well, the product of their ages is 72, and the sum of their ages is the same as the number on that building over there.." First: "Right, ok.. oh wait.. hmmmm.., I still don't know" second: "Oh sorry, the oldest one just started to play the piano" First: "Wonderful! my oldest is the same age!" Problem: How old are the daughters? • Why are beer cans tapered at the top and bottom? • Why is it that hot water in a hotel comes out instantly but at home it takes time? • How many times a day a clock's hands overlap? • Mike has$20 more than Todd. How much does each have given that combined they have \$21 between them. You can't use fractions in the answer.(Hint: This is a trick question, pay close attention to the condition)
• There are four dogs, each at the counter of a large square. Each of the dogs begins chasing the dog clockwise from it. All of the dogs run at the same spd. All continously adjust their direction so that they are always heading straight towards their clockwise neighbor. How long does it take for the dogs to catch each other? Where does this happen? (Hint: Dog's are moving in a symmetrical fashion, not along the edges of the square).
1. Given a number, describe an algorithm to find the next number which is prime.
2. There are 8 stones which are similar except one which is heavier than the others. To find it, you are given a pan balance. What is the minimal number of weighing needed to find out the heaviest stone ?
3. 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
4. Given two sorted postive integer arrays A[n] and B[n] (W.L.O.G, let'ssay they are decreasingly sorted), we define a set S = {(a,b) | a \in Aand b \in B}. Obviously there are n^2 elements in S. The value of sucha pair is defined as Val(a,b) = a + b. Now we want to get the n pairsfrom S with largest values. The tricky part is that we need an O(n)algorithm. 
5. Solve this cryptic equation, realizing of course that values for M and E could be interchanged. No leading zeros are allowed.

6. Write a haiku describing possible methods for predicting search traffic seasonality
7. 1
1 1
2 1
1 2 1 1
1 1 1 2 2 1
What's the next line?

312211. This is the "look and say" sequence in which each term after the first describes the previous term: one 1 (11); two 1s (21); one 2 and one 1 (1211); one 1, one 2, and two 1's (111221); and so on. See the look and say sequence entry on MathWorld for a complete write-up and the algebraic form of a fascinating related quantity known as Conway's constant.

8. You are in a maze of twisty little passages, all alike. There is a dusty laptop here with a weak wireless connection. There are dull, lifeless gnomes strolling around. What dost thou do?

A) Wander aimlessly, bumping into obstacles until you are eaten by a grue.
B) Use the laptop as a digging device to tunnel to the next level.
C) Play MPoRPG until the battery dies along with your hopes.
D) Use the computer to map the nodes of the maze and discover an exit path.
E) Email your resume to Google, tell the lead gnome you quit and find yourself in whole different world [sic].

In general, make a state diagram . However, this method would not work in certain pathological cases such as, say, a fractal maze. For an example of this and commentary, see Ed Pegg's column about state diagrams and mazes .

9. What's broken with Unix?

Their reproductive capabilities.

How would you fix it?

10. On your first day at Google, you discover that your cubicle mate wrote the textbook you used as a primary resource in your first year of graduate school. Do you:

A) Fawn obsequiously and ask if you can have an autograph.
B) Sit perfectly still and use only soft keystrokes to avoid disturbing her concentration
C) Leave her daily offerings of granola and English toffee from the food bins.
D) Quote your favorite formula from the textbook and explain how it's now your mantra.
E) Show her how example 17b could have been solved with 34 fewer lines of code.

11. Which of the following expresses Google's over-arching philosophy?

A) "I'm feeling lucky"
B) "Don't be evil"
C) "Oh, I already fixed that"
D) "You should never be more than 50 feet from food"
E) All of the above

12. How many different ways can you color an icosahedron with one of three colors on each face?
13. On an infinite, two-dimensional, rectangular lattice of 1-ohm resistors, what is the resistance between two nodes that are a knight's move away
14. In your opinion, what is the most beautiful math equation ever derived?

There are obviously many candidates. The following list gives ten of the authors' favorites:

1. Archimedes' recurrence formula : , , ,
2. Euler formula :
3. Euler-Mascheroni constant :
4. Riemann hypothesis: and implies
5. Gaussian integral :
6. Ramanujan's prime product formula:
7. Zeta-regularized product :
8. Mandelbrot set recursion:
9. BBP formula :
10. Cauchy integral formula:

15. Which of the following is NOT an actual interest group formed by Google employees?

B. Buffy fans
C. Cricketeers
D. Nobel winners
E. Wine club

16. What will be the next great improvement in search technology?
17. What is the optimal size of a project team, above which additional members do not contribute productivity equivalent to the percentage increase in the staff size?

A) 1
B) 3
C) 5
D) 11
E) 24

18. Given a triangle ABC, how would you use only a compass and straight edge to find a point P such that triangles ABP, ACP and BCP have equal perimeters? (Assume that ABC is constructed so that a solution does exist.)
19. Consider a function which, for a given whole number n, returns the number of ones required when writing out all numbers between 0 and n. For example, f(13)=6. Notice that f(1)=1. What is the next largest n such that f(n)=n?
20. What is the coolest hack you've ever written?
21. What number comes next in the sequence: 10, 9, 60, 90, 70, 66, ?

A) 96
B) 1000000000000000000000000000000000 0000000000000000000000000000000000 000000000000000000000000000000000
C) Either of the above
D) None of the above

22. In 29 words or fewer, describe what you would strive to accomplish if you worked at Google Labs.

## General C# Questions

• Does C# support multiple-inheritance?
• Who is a protected class-level variable available to?
• Are private class-level variables inherited?
• Describe the accessibility modifier “protected internal”.
• What’s the top ._NET class that everything is derived from?
• What does the term immutable mean?
• What’s the difference between System.String and System.Text.StringBuilder classes?
• What’s the advantage of using System.Text.StringBuilder over System.String?
• Can you store multiple data types in System.Array?
• What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
• How can you sort the elements of the array in descending order?
• What’s the ._NET collection class that allows an element to be accessed using a unique key?
• What class is underneath the SortedList class?
• Will the finally block get executed if an exception has not occurred?
• What’s the C# syntax to catch any possible exception?
• Can multiple catch blocks be executed for a single try statement?
• Explain the three services model commonly know as a three-tier application.

## C# OOP

• What is the syntax to inherit from a class in C#?
• Can you prevent your class from being inherited by another class?
• Can you allow a class to be inherited, but prevent the method from being over-ridden?
• What’s an abstract class?
• When do you absolutely have to declare a class as abstract?
• What is an interface class?
• Why can’t you specify the accessibility modifier for methods inside the interface?
• Can you inherit multiple interfaces?
• What happens if you inherit multiple interfaces and they have conflicting method names?
• What’s the difference between an interface and abstract class?
• What is the difference between a Struct and a Class?
1. Inorder and preorder trees (expressions) are given and postorder tree (expression) is to be found out
2. int v,u; while(v != 0){  t = v % u;  v = u;u = t;}find the time complexity of the above program.
3. x is passed by reference, y passed by value.x = 3, y = 2;foo(x, y)var integer x, y;{ x = x + 2; y = y + 3;}main(){x = 5;y = 5;foo(x, y);print (x, y);}output of the above pseudo code.
4. how many flip flops you require for modulo 19 counter.
5. ring counter's initial state is 01000. after how many clock cylces willit return to the initial state.
6. given 6 bit mantissa in 2s complement form and 4 bit exponent is inexcess-4 form in a floating point representation, find the number
7. A signed no is stored in 10-bit register, what is the max and minpossible value of the number.
8. A room is 30 X 12 X 12. a spider is ont the middle of the samllerwall, 1 feet from the top, and a fly is ont he middle of the opposite wall1 feet from the bottom. what is the min distance reqd for the spider tocrawl to the fly.
9. A man while going dowm in a escalator(which is miving down) takes 50steps to reach down and while going up takes 125 steps. If he goes 5 timesfaster upwards than downwards. What will be the total no of steps if theescalator werent moving.
10. 2/3 of corckery(plates) are broken, 1/2 have someother thing(handle)broken , 1/4 are both broken and handle broken. Ultimately only 2 piecesof corckery were without any defect. How many crockery were there intotal.
11.      ______________________________________________________|___       ___|___              ___|___             ||       |     |       |            |       |            ||       |__   |       |___         |       |___         ||_______|  |  |_______|   |__not_  |_______|   |        |         |                     |             |        |         |_____________________|_____________|____and_|___boxes are negative edge triggered flip flops and 'not' and 'and' aregates. What is this figure.ans-  modulo-5
12. There is six letter word VGANDA . How many ways you can arrange the letters in the word in such a way that both the A's are together.  Ans : 120    (5x4!)
13. If two cards are taken one after another without replacing from   a pack of 52 cards what is the probability  for the two cards be      queen.
14. 51 x 53 x ... x 59 ; symbols ! - factorial                           ^ - power of 2(a) 99!/49! (b)  (c)   (d) (99! x 25!)/(2^24 x 49! x 51!)
15. The ratio fo Boys to Girls is 6:4. 60% of the boys and 40% of girls  take lunch in the canteen. What % of class takes lunch in canteen.      Ans : 52%    (60/100)*60 + (40/100)*40
16. Zulus always speak truth and  Hutus always speak lies. There arethree persons A,B&C. A met B and says " I am a Zulu or I am Hutu".We don't know what exactly he said. then B meets C and says to cthat " A is a Zulu ". Then C replied " No, A is a Hutu ".1. How many Zulus are there ?2. Who must be a Zulu ? 
17. What is  int *p(char (*s)[])  Ans : p is a function which is returning a pointer to integer  which takes arguments as pointer to array of characters.
18. what is the o/p  printf(" Hello \o is the world "); Ans : Hello is the world.
19. Find the prototype of sine function.  Ans : extern double sin(double)
20. i=2  printf("%old %old %old %old ",i, i++,i--,i++);
21. what is the value of 'i'? i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green") Ans : 1
22. what does exit() do? Ans : come out of executing programme.
23. what does " calloc" do?  Ans :  A memory allocation and initialising to zero.
24. what does find command do ? Ans : search a file
25. Which of following is used for back-up files?  (a) compress (b) Tar (c) make (d) all the above  Ans : b
26. What does chmod 654 stand for. Ans : _rw_r_xr__

Usually it is usefull to prepare a checklist at the beggining phase of preparation for JOB. It helps by reducing the chance of missing some important topic. Here is a sample checklist for a guy preparing for ECE related JOB.

Basic EE
• Basic circuit analysis
• Kirchov’s laws, Thevenin and Norton equivalents
• IV characteristics of circuit elements (R, L, C, diodes, etc.)
• Transient response of basic circuits, RC delays
• Intuitive operation of PN junctions and MOSFETs
• Circuits with opamps
• Transmission lines
• Power dissipation
VLSI
• CMOS gates, complex gates, Latch and FF design
• Regions of operation of a MOSFET, IV characteristics in different regions, transistor IV curves
• Transistor cross-sections
• Charge storage and how it impacts certain circuits
• Capacitive coupling
• Dynamic logic
• Sources of capacitive load, capacitances between terminals of a MOSFET
• Various kinds of inverters, switching delay, gain, wire delays
• Transistor sizing
Logic / Architecture
• Boolean logic Minimization
• State machine design
• Synchronous circuit timing, races, testability
• Pipelines and hazards
• Processor block diagrams, Cache architecture
• Microarchitecture techniques
Some More Questions:-
1. In a VCO,the capacitance is varied by  using __________.ans: rev biased varactor diode
2. A pnp trans. in active region has  _____________.ans:b-e junction fwd biased & b-c rev biased.
3. in a nmos how is V-threshold affected by increasing doping conc. of substrate ?ans:increases
4. condition for sustained oscillations in a osc is___.ans:A=1 & phase shift = n*pi.
5. if  A?B=C and C?A=B then what is the boolean operator ?ans:xor
6. clk is given with some period T to a logic gate.the same clk is again fed to the gate via a delayelement with a delay of T/4 duration.if the gateacts as a freq.doubler then identify the gate.ans:xor
7. define the setup time & hold time in a f/f.
8. given a D f/f ,construct a T f/f from it.
9. given a 2:1 mux,how will u implement an AND & OR gate ?

Digital
1. simplyfy k map1 x x 01 x 0 1
Programming
1. Implementation of priority queuea. tree b linked list  c doubly linked list.
2. max and avg. height of sorted binary tree.
3. size of integer is  a. 2 bytes  b 4 bytes  c. machine dependant  d compiler dependent.
4. Questions On Pointer to Function
5. main(){int i,*j;i=5;j=&i;printf("\ni= %d",i);f(j);printf("\n i= %d",i);}void f(int*j){int k=10;j= &k;}output isa 5 10b 10 5c 5 5
6. int f(int a){a=+b;//some stuff}main(){x=fn(a);y=&fn; }what are x & y typesa) x is int y is pointer to afunction which takes integer value
7. main(){char a[10]="hello";strcpy(a,'\0');printf("%s",a);}output of the program?a) string is null b) string is not null  c) program error d)
8. void f(int *p){static val=100;val=&p;}main(){int a=10;printf("%d ",a);f(&a);printf("%d ",a);}what will be out put?a)10,10
9. void f(int value){for (i=0;i<16;i++){>>1) printf("1")else printf("0");}}what is printed?a) bineray value of argument b)bcd value c) hex value d) octal value
10. for hashing which is best on terms of bucketsa)100 b)50 c)21 d)32  ans 32
11. size of(int)a) always 2 bytesb) depends on compiler that is being usedc) always 32 bitsd) can't tell
12.     struct a  {  int a;  char b;  int c;  }  union b  {  char a;  int b;  int c;  };  which is correct .  a. size of a is always diff. form size of b.(ans.)  b. size of a is always same  form size of b.  c. we can't say anything because of not-homogeneous (not in ordered)  d. size of a can be same if ...
13. x=x^y; y=x^y; x=x^y;x=?
14. In a link list we want to go from last to first element and viceversa.Which is efficienta. Cirular Listb. Doubly Link Listc. Double Ended Link Listd. Simple List
15. Hash function h(i)=i mod 5, there are 5 buckets 0,1,2,3,4. Rehashing is(h(i)+1)mod 5,(h(i)+2)mod 5......5 numbers are to be enterd, Find the number in a given bucket..
16. To reconstuct a Tree which sequence is enougha. Inoreder sequenceb. Preorder and Post orderc. In, Pre, Post order are requiredd. Any one can be used
17. (i)for(i=0;i
18. convert a inorder string to post order
19. int (*a[5])() what is this declaration?
Again it is too compiled from a group of text file. So maximum number of circuit questions with "ASCII circuit diagram" are not presented here.

Analog
1. Cube each side has r units resistence then the resistence across diagonal of cube
2. y=kx^2. This is transfer function of a block with i/p x & o/p y.if i/p is sum of a & b then o/p is :--
a. AM b.FM c. PM
3. find equivalent C.
-------------------
| |
C1 c2
|-----c3-----|
| |
C1 C2
|-----C3-----|
| |
C1 C2
| |
-------------------
4. one question on Switch closed at t=0 find v at C a t

------R1--------------switch-----
| | |
| R1 |
V | C
| | |
---------------------------------
5.                       |----Res---|                     |          |        in----Res----+--Inv-----+--- out                        CMOS   What is the given circuita) Latch b)Amplifier   c)Schmitt trigger. d)
6.                    o Vdd                  |          --------+          |       |       B  |C      | o------- Tr NPN  |          |E      |-------------o          |       |          |    B  |C          +------ Tr NPN                  |E                  |  o---------------+-------------othe gain of the circuit isa) beta^2 b)beta + 1 c) (beta+1)^2 d)
7. Function of C in the circuit below isa) Improve switching b)dc coupling c) ac coupling d) None                                    o                       C            |                 +------||--+       |                 |          |       |C          o------+----Res---+------Tr NPN                                    |E                                    |                                   _|_                                   __

Digital

1. With 2 i/p AND gates u have to form a 8 i/p AND; Give the fastest Implementation possible
2. With howmany 2:1 MUX u can for 8:1 MUX. answer is 7.
3. There are n states then ffs used are ?? Ans: log n.
4. universal gates can impliment.
a. Digital ckts.
b. Digital logic
c all digital and analog ckts.
d. only combinational ckts.
5. if a 5-stage pipe-line is flushed and then we have to execute 5 and 12instructions respectively then no. of  cycles will bea. 5 and 12b. 6 and 13c. 9 and 16d.none
6. nand gate is
a) associative &cumulative b)cumulative but not
associative
c)not cumulative but associative d)not cumultive
and associative

ANS. b
7. which imp has les delay
a) (a xor b) xor (c xor d)
b) (((a xor b) xor c) xor d)
8. 3 dffs was given with common clk; setup time 3ns; hold time 1ns; clk to q delay 2ns; find the maximum frequency of operation
9. Minimize the K-map        A'B' A'B  AB  AB'       \_________________     c'| 1    X   0   1 |       |----------------|      c| 1    X   0   1 |       |----------------|a) A'B' b) A'+B' c)B' d)A'+B'+C'
Programming
1. CHAR A[10][15] AND INT B[10][15] IS DEFINED
WHAT'S THE ADDRESS OF A[3][4] AND B[3][4]IF ADDRESS OD A IS OX1000 AND B IS 0X2000A. 0X1030 AND 0X20C3B. OX1031 AND OX20C4AND SOME OTHERS..
2. int f(int *a){int b=5;a=&b;}main(){int i;printf("\n %d",i);f(&i);printf("\n %d",i);}what's the output .1.10,52,10,10c.5,5d. none
3. main(){int i;fork();fork();fork();printf("----");}how many times the printf will be executed .a.3b. 6c.5
4. void f(int i){int j;for (j=0;j<16;j++){if (i & (0x8000>>j))printf("1");elseprintf("0");}}what's the purpose of the programa. its output is hex representation of ib. bcdc. binary
5. #define f(a,b) a+b#define g(a,b) a*bmain(){int m;m=2*f(3,g(4,5));printf("\n m is %d",m);}what's the value of ma.70b.50c.26
6. main(){char a[10];strcpy(a,"\0");if (a==NULL)printf("\a is null");elseprintf("\n a is not null");}what happens with it .a. compile time error.b. run-time error.c. a is  null
7. char a[5]="hello"a. in array we can't do the operation .b. size of a is too largec. size of a is too small
8. local variables can be store by compilera. in register or heapb. in register or stackc .in stack or heap .
9. global variable conflicts due to multiple file occuranceis resolved duringa. compile-timeb. run-timec. link-time
10. two program is given of factorial.one  with  recursion and one without recursion .question was which program won't run for very big no. input because ofstack overfow .a. i only  (ans.)b. ii onlyc. i& ii both .
11. struct a{int a;char b;int c;}union b{char a;int b;int c;};which is correct .a. size of a is always diff. form size of b.(ans.)b. size of a is always same  form size of b.c. we can't say anything because of not-homogeneous (not in ordered)
12. d. size of a can be same if ...c. noned. load-timed. global memory.d. nothing wrong with it .d. a is not  null.d. 69d. decimald. 8
13. IF the rate of removal of elements in a queue containing N elements isproportional to the no of  elements already existing in the queue at thatinstant then the no. of elements----a)decrease linearly b)Exponetialy decrease b) Logarithmcally`

Here are a compiled set of questions that have been asked by HCL in various institutions during their campus interview process. I have got these questions from IITKGP LAN. These questions are usually posted in the various job/campus related yahoo groups. I am just coping and pasting from the various text files, not sure about accuracy of the answers, do check urself if you have any doubts.

Section I - C Programming
1. Which of the following about the following two declaration is true
i ) int *F()
ii) int (*F)()
Choice :
a) Both are identical
b) The first is a correct declaration and the second is wrong
c) The first declaraion is a function returning a pointer to an integer and the second is a pointer to function returning int
d) Both are different ways of declarin pointer to a function
Answer : c) The first de...
2. What are the values printed by the following program?
#define dprint(expr) printf(#expr "=%d\n",expr)
main() {
int x=7;
int y=3;
dprintf(x/y);
}
Choice:
a) #2 = 2 b) expr=2 c) x/y=2 d) none
3. output of the following.
main()
{
int i;
char *p;
i=0X89;
p=(char *)i;
p++;
printf("%x\n",p);
}
ans:0X8A
4. When an array is passed as parameter to a function, which of thefollowing statement is correct, choice:
a) The function can change values in the original array
b) In C parameters are passed by value. The funciton cannot change the original value in the array
c) It results in compilation error when the function tries to access the elements in the array
d) Results in a run time error when the funtion tries to access the elements in the array
5. The type of the controlling _expression of a switch statement cannot be of the type
a) int b) char c) short d)float e) none
6. What is the value assigned to the variable X if b is 7 ?
X = b>8 ? b <<3>4 ? b>>1:b;
a) 7 b) 28 c) 3 d) 14 e) None
ans: 3;
7. Which is the output produced by the following program
main()
{
int n=2;
printf("%d %d\n", ++n, n*n);
}
a) 3,6 b) 3,4 c) 2,4 d) cannot determine
8. What is th output of the following program?
int x= 0x65;
main()
{
char x;
printf("%d\n",x)
}
a) compilation error b) 'A' c) 65 d) unidentified
9. What is the output of the following program
main()
{
int a=10;
int b=6;
if(a=3)
b++;
printf("%d %d\n",a,b++);
}
a) 10,6 b)10,7 c) 3,6 d) 3,7 e) none
10. What can be said of the following program?
main()
{
enum Months {JAN =1,FEB,MAR,APR};
Months X = JAN;
if(X==1)
{
printf("Jan is the first month");
}
}
a) Does not print anything
b) Prints : Jan is the first month
c) Generates compilation error
d) Results in runtime error
11. What is the output of the following program?
main()
{
char *src = "Hello World";
char dst[100];
strcpy(src,dst);
printf("%s",dst);
}
strcpy(char *dst,char *src)
{
while(*src) *dst++ = *src++;
}
a) "Hello World" b)"Hello" c)"World" d) NULL e) unidentified
12. What is the output of the following program?
main()
{
int l=6;
switch(l)
{ default : l+=2;
case 4: l=4;
case 5: l++;
break;
}
printf("%d",l);
}
a)8 b)6 c)5 d)4 e)none
13. What is the output of the following program?
main()
{
int x=20;
int y=10;
swap(x,y);
printf("%d %d",y,x+2);
}
swap(int x,int y)
{
int temp;
temp =x;
x=y;
y=temp;
}
a)10,20 b) 20,12 c) 22,10 d)10,22 e)none
14. What is the output of the following problem ?
#define INC(X) X++
main()
{
int X=4;
printf("%d",INC(X++));
}
a)4 b)5 c)6 d)compilation error e) runtime error
15. what can be said of the following
struct Node {
char *word;
int count;
struct Node left;
struct Node right;
}
a) Incorrect definition
b) structures cannot refer to other structure
c) Structures can refer to themselves. Hence the statement is OK
d) Structures can refer to maximum of one other structure
16. What is the size of the following union. Assume that the size of int =2, size of float =4 and size of char =1.
Union Tag{
int a;
flaot b;
char c;
};
a)2 b)4 c)1 d) 7
17. What is printed when this program is executed
main()
{
printf ("%d\n",f(7));
}
f(X)
{
if (x<= 4)
return x;
return f(--x);
}
a) 4
b) 5
c) 6
d) 7
ans: a
18. On a machine where pointers are 4 bytes long, what happens when the following code is executed.
main()
{
int x=0,*p=0;
x++; p++;
printf ("%d and %d\n",x,p);
}
a) 1 and 1 is printed
b) 1 and 4 is printed
c) 4 and 4 is printed
19. Which of the following is the correct code for strcpy, that is used to copy the contents from src to dest?
a) strcpy (char *dst,char *src)
{
while (*src)
*dst++ = *src++;
}
b) strcpy (char *dst,char *src)
{
while(*dst++ = *src++)
}
c) strcpy (char *dst,char *src)
{
while(*src)
{ *dst = *src;
dst++; src++;
}
}
d) strcpy(char *dst, char *src)
{
while(*++dst = *++src);
}
ans:b
20. Consider the following program
main()
{
int i=20,*j=&i;
f1(j);
*j+=10;
f2(j);
printf("%d and %d",i,*j);
}
f1(k)
int *k;
{
*k +=15;
}
f2(x)
int *x;
{
int m=*x,*n=&m;
*n += 10;
}
The values printed by the program will be
a) 20 and 55
b) 20 and 45
c) 45 and 45
d) 45 and 55
e) 35 and 35
21. what is printed when the following program is compiled and
executed?

int
func (int x)
{
if (x<=0)
return(1);
return func(x -1) +x;
}
main()
{
printf("%d\n",func(5));
}
a) 12
b) 16
c) 15
d) 11

Directions: Give the synonyms for the following words

1. Depreciation: deflation, depression, devaluation, fall, slump

2. Depricate : feel and express disapproval,

3. Incentive : thing one encourages one to do (stimulus)

4. Echelon : level of authority or responsibility

5. Innovation : make changes or introduce new things

6. Intermittent : externally stopping and then starting

7. Detrimental: harmful

8. Conciliation : make less angry or more friendly

9. Orthodox: conventional or traditional, superstitious

10. Fallible : liable to error

11. Volatile : ever changing

12. Manifest: clear and obvious

13. Connotation : suggest or implied meaning of expression

14. Reciprocal: reverse or opposite

15. Agrarian : related to agriculture

16. Vacillate : undecided or dilemma

17. Expedient : fitting proper, desirable

18. Simulate : produce artificially resembling an existing one.

19. Access : to approah

20. Compensation: salary

21. Truncate : shorten by cutting

23. Heterogenous: non similar things

24. Surplus : excessive

25. Assess : determine the amount or value

26. Congnizance : knowledge

27. Retrospective : review

28. Naive : innocent,rustic

29. Equivocate : tallying on both sides, lie, mislead

30. Postulate : frame a theory

31. Latent : dormant, secret

32. Fluctuation : wavering,

33. Eliminate : to reduce

34. Affinity : strong liking

35. Expedite : hasten

36. Console : to show sympathy

38. Affable : lovable or approachable

39. Decomposition : rotten

40. Agregious : apart from the crowd, especially bad

41. Conglomaration: group, collection

42. Aberration: deviation

43. Aurgury : prediction

44. Crediability : ability to common belief, quality of being credible

45. Coincident: incidentally

46. Constituent : accompanying

47. Differential : having or showing or making use of

48. Litigation : engaging in a law suit

49. Maratorium: legally or offficiallly determined period of dealy before
fulfillment of the agreement of paying of debts.

50. Negotiate : discuss or bargain

51. Preparation : act of preparing

52. Preponderant : superiority of power or quality

53. Relevance : quality of being relevant

54. Apparatus : appliances

55. Ignorance : blindness, in experience

56. Obsession: complex enthusiasm

57. precipitate : speed,active

Give the output of the programs in each case unless mentioned otherwise

1.
void main()
{
int d=5;
printf("%f",d);
}

Ans: Undefined

2.
void main()
{
int i;
for(i=1;i<4,i++)
switch(i)
case 1: printf("%d",i);break;
{
case 2:printf("%d",i);break;
case 3:printf("%d",i);break;
}
switch(i) case 4:printf("%d",i);
}

Ans: 1,2,3,4

3.
void main()
{
char *s="\12345s\n";
printf("%d",sizeof(s));
}

Ans: 6

4.
void main()
{
unsigned i=1; /* unsigned char k= -1 => k=255; */
signed j=-1; /* char k= -1 => k=65535 */
/* unsigned or signed int k= -1 =>k=65535 */
if(iprintf("less");
else
if(i>j)
printf("greater");
else
if(i==j)
printf("equal");
}

Ans: less

5.
void main()
{
float j;
j=1000*1000;
printf("%f",j);
}

1. 1000000
2. Overflow
3. Error
4. None

Ans: 4

6. How do you declare an array of N pointers to functions returning
pointers to functions returning pointers to characters?

Ans: The first part of this question can be answered in at least
three ways:

1. char *(*(*a[N])())();

2. Build the declaration up incrementally, using typedefs:

typedef char *pc; /* pointer to char */
typedef pc fpc(); /* function returning pointer to char */
typedef fpc *pfpc; /* pointer to above */
typedef pfpc fpfpc(); /* function returning... */
typedef fpfpc *pfpfpc; /* pointer to... */
pfpfpc a[N]; /* array of... */

3. Use the cdecl program, which turns English into C and vice
versa:

cdecl> declare a as array of pointer to function returning
pointer to function returning pointer to char
char *(*(*a[])())()

cdecl can also explain complicated declarations, help with
casts, and indicate which set of parentheses the arguments
go in (for complicated function definitions, like the one
above).
Any good book on C should explain how to read these complicated
C declarations "inside out" to understand them ("declaration
mimics use").
The pointer-to-function declarations in the examples above have
not included parameter type information. When the parameters
have complicated types, declarations can *really* get messy.
(Modern versions of cdecl can help here, too.)

7. A structure pointer is defined of the type time . With 3 fields min,sec hours having pointers to intergers.
Write the way to initialize the 2nd element to 10.

8. In the above question an array of pointers is declared.
Write the statement to initialize the 3rd element of the 2 element to 10;

9.
int f()
void main()
{
f(1);
f(1,2);
f(1,2,3);
}
f(int i,int j,int k)
{
printf("%d %d %d",i,j,k);
}

What are the number of syntax errors in the above?

Ans: None.

10.
void main()
{
int i=7;
printf("%d",i++*i++);
}

Ans: 56

11.
#define one 0
#ifdef one
printf("one is defined ");
#ifndef one
printf("one is not defined ");

Ans: "one is defined"

12.
void main()
{
intcount=10,*temp,sum=0;
temp=&count;
*temp=20;
temp=∑
*temp=count;
printf("%d %d %d ",count,*temp,sum);
}

Ans: 20 20 20

13. There was question in c working only on unix machine with pattern matching.

14. what is alloca()

Ans : It allocates and frees memory after use/after getting out of scope

15.
main()
{
static i=3;
printf("%d",i--);
return i>0 ? main():0;
}

Ans: 321

16.
char *foo()
{
char result[100]);
strcpy(result,"anything is good");
return(result);
}
void main()
{
char *j;
j=foo()
printf("%s",j);
}

Ans: anything is good.

17.
void main()
{
char *s[]={ "dharma","hewlett-packard","siemens","ibm"};
char **p;
p=s;
printf("%s",++*p);
printf("%s",*p++);
printf("%s",++*p);
}