Sunteți pe pagina 1din 10

Interview Questions : 1.

Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can?t pass the value k to any function also. 2. What are the 4 basics of OOP? 3. Define Data Abstraction. What is its importance? 4. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers. 5. Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren?t present. 6. Given a string,find the first un-repeated character in it? Give some test cases 7. You are given a dictionary of all valid words. You have the following 3 operations permitted on a word: delete a character, insert a character, replace a character. Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.) 8. Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension. 9. What is a C array and illustrate the how is it different from a list. 10. What is the time and space complexities of merge sort and when is it preferred over quick sort? 11. Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression. 12. Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that. 13. Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same. 14. Given an array of size n, containing every element from 1 to n+1, except one. Find the missing element. 15. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same 16. Explain polymorphism. Provide an example. 17. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array. So 3 2 7 10 should return 13 (sum of 3 and 10) or 3 2 5 10 7 should return 15 (sum of 3, 5 and 7) 18. You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

19. Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number

1.Two tables emp (empid,name,deptid,sal) and dept(deptid,deptname) are there.write a query which displays empname,corresponding deptname also display those employee names who donot belong to any dept. 2.Display the employees whose salary is less than average salary. 3.what is the output of the program main() { int c=5; printf("%d\n%d\n%d",c,c<<2,c>> 2); } 4. main() { int a[8][10],c=0,i,j; for(i=0;i<10; i++) for(j=0; j<8;j++) a[j][i]=c++; printf("%d",a[3][6]); } 5.What is the wrong in this program main() { char *p,*q; p=(char *)malloc(25); q=(char*) malloc(25); strcpy(p,"amazon" ); strcpy(q,"hyd"); strcat(p,q); printf("%s",p); } 6.write prefix and post fix notation for (a+b)*c-(d+e)^(f-g) 7.what is the output of the program main() { int i=5; printf("%d",fun(fun(fun(fun( fun(i)))))); } void fun (int i) { if(i%2) return (i+(7*4)-(5/2)+(2*2)); else return (i+(17/5)-(34/15)+(5/2)); } 8.When it is always true boolean fun (node *p) {

return ((p==null)||(p->next==null)|| (p->info<=p->next->info)&&( fun(p->next))); } a) when list is empty or has one node b) when the ele are sorted in non decreasing order c) when the ele are sorted in non increasing order 9.what is x here (x&&!(x&(x-1))==1) a) x is always a prime b) x is a power of 2 c) x is even d)x is odd 10 .What is the difference between deep copy and shallow copy 11.In java what is the difference between sleep() and wait() . 12.What happens when the parent process of a child process exits before the child ? 13.There are three persons A,B,C .A shots the target 6 times out of 7 shots .B shots 4 out of 5 shots .Then what is the probability of hitting the target twice when 2 persons are selected at random. 14.what is valid in cpp char *cp; const char *cpp; 1) cpp=cp; 2) cp=cpp; 15.write program to swap 2 variables without using extra memory. 16.write a shell command to find all java files present in nested directories. 17.There are 6 pairs of black socks and 6 pairs of white socks.What is the probability to pick a pair of black or white socks when 2 socks are selected randomly in darkness. 18.A string of alphanumeric is there.Find a string that starts with b and ends with 3 characters. section B (we have to write programs) time:30 min 1. There is a sorted array which is of very large size.In that all except one no. are repeated once.How to find that non repeated no. 2. There are 2 linked lists.Those 2 lists are meeting at a point.How to find that meeting point.

Amazon India latest placement paper for 2007 :


[ Amazon - US major internet based seller of books, CDs, DVDs and lots other stuff ] See 2008 sample placement papers and technical / hr interview questions in future here for freshers / walkins, BPO, call centre, back office function job exam.

Written test.
They concentrate on every field of computer science. They asked c, data structure, TOC(context free and context sensitive grammar, regular languages. DBMS unix was not there. There were two subjective questions. 1. The first one was "given two lists write a function which returns a list which is the intersection of the two lists.the original lists should remain same. (Intersection - if first list is say,1,20 3,45 and second list is 3,24 ,45,90,68 then intersection should be 3,45 ) 2. The second was given two nodes of a binary tree find the closest ancestor of the two nodes. Note:consider binary tree and binary search tree also.

In short answer type questions, the questions were 1.There was an aptitude's question in which P(A) and P(B) were given and we had to find P(B/A) and P(A/B) when A and B are independent events. 2.What is the probability that the the 4 digit's no. which is formed by using the digits 1,2,3,4,5,6 is divisible by 4. 3.What tree traversal gives the no. in sorted order.Inorder,preorder or postorder ? 4.Preorder and inorder traversal was given and we had to find the tree. 5. Which sorting algorithm takes best and worst time complexity as O(nlogn)? 6.A dbms query was asked to find the second largest no. of book sold.(i don't remember the question exactly) What is Your Opinion? What do you think about the Expereince ? Any tips/suggestions ? They emphasised especially on Data Structures specially trees and sorting. Basically study the Amazon profile and prove that you can be a good web programmer or perfect for back office technical problem handling job. Good Luck for your exam. General Information about Amazon: Amazon is one of the largest internet based sellers. Amazon.com has a very popular affiliate program using which people can sell amazon's goods on thier stores using just automatic targeting codes from amazon. Many people run and advertise their specific categories Amazon powered stores where everything is handled by amazon and the people handle on the promotion / getting customers part. Sales and checkout is handled by amazon itself. This was a little about amazon's affiliate set up. But Amazon is the most popular place about buying books, cds, dvds online in US, UK, Europe and even india.

Some Important Linux Commands


Quick Reference to Frequently Used Commands 1. alias - To create an alias (nickname) for a command or show which aliases already exist. 2. at - To schedule a command to run at a particular time. Great for running time-consuming commands later, such as in the middle of the night. 3. apt - A package management tool used by the Debian Linux distribution.

4. banner - To display text in huge, ugle letters. 5. bash - To run the BASH shell, optionally running a script 6. bc - A handy-dandy desk calculator 7. bg - To background a process or job. 8. cal - To print a calender for a month or a year 9. cat - To display a file on-screen 10. cd - To change to another directory, that is, to change the current working directory to the directory you indicate 11. chgrp - To change the group that has access to a file or directory 12. chmod - To chane the permissions for a file 13. chown - To change the ownership of a file 14. cmp - To compare two files and tell you the line numbers where they differ. 15. comm - To compare two text files, each of which is sorted in alphabetical order. Ther program shows you lines that are in both files versus lines that are in just one of them. 16. compress - To shrink a file into a compressed file so that it takes up less space on your disk 17. cp - to copy one or more files 18. cron - This will run scheduled jobs, its similar to the 'at' command above do 'man crontab' or Man Pages for all of its capabilities. 19. csh - To run the C shell, optionally running a script of stored commands 20. date - To tell you the current date and time, taking into account your time zone and, if appropriate, daylight savings time. 21. df - To display how much space is free on your disk 22. diff - To compare two files and print the lines in which the files differ. 23. dpkg - A package management tool used by the Debian Linux distribution. 24. dselect - A package management tool used by the Debian Linux distribution. 25. echo - To echo back whatever you type on the command line after echo, expanding any wildcards using *, ?, or [ ] 26. ed - To run one of the world's ugliest line-oriented text editors 27. elm - To read and send e-mail 28. emacs - To run a powerful, screen-oriented text editor. 29. exit - To logout. When used in a terminal window, closes the window. If exit doesn't work try typing logout. Pressing Ctrl-D can also log you out. 30. fg - To continue a job that you have running in the background.

31. file - To tell you whether something is a file, a direcotry, or something else entirely. If the thing is a file, the file command tries to guess what type of information it contains. 32. find - To find one or more files, assuming that you know their approximate filenames, and do something to them. Use this command when you can't figure out the directory where you put one or more files, but you know the filename(s). When you use the find command, you tell it where to start looking, usually either . (which means "right here") or / (which means "search the entire disk"). Then give the name of the file (type -name, a space and the filename, possibly using wilcard characters), and then you tell find what to do when it finds the files, usually -print (to mean "display the full filenames, including the names of the directories that they are in") 33. ftp - To transfer files from one computer to another over a network 34. getty - sets terminal mode, speed, and line discipline 35. grep - To find lines in one or more files that contain a particular word or phrase. There are two similar commands, egrep and fgrep, that you will probably never use. 36. gs - To print PostScript files, even if you don't have a PostScript printer. 37. gunzip - To unzip gzipped files. Replaces a .gz file with the orginal file. 38. gzip - To compress a file, replaces the orginal file with a GNU ZIP file with a name ending in .gz 39. head - To display just the first few lines of a file (usually the first ten). 40. history - To list the last 20 or so commands you typed. Works only with the BASH, Korn and C shells. 41. id - To tell you your numeric user and group ID, and on BSD, what groups you are in. 42. ifconfig - By typing ifconfig you will see your lo (local), eth0(ethernet), and ppp0(dialup) ip addresses and configurations. do "man ifconfig" or Man Pages for more information. 43. inittab - format of the inittab file used by the sysv-com-patible init process 44. kibitz - A way for two users to share a shell. This is good for teaching purpose's so one user can watch and learn as the other user does things on the system. Both users can send text to the shell screen. 45. kill - To cancel a job that you don't want to continue 46. ksh - To run the Korn shell 47. ln - To create a link to a file so that the file has more than one name or lives in more than one directory. If you use a file all the time and are tired of moving to the directory where it lives, link the file to your home direcotry or to another convenient place. When you use ln, you tell it the current pathname of the file and the new filename you want in the current working directory. 48. logout - To tell unix you are done using it

49. lpr - To print a file 50. lpq - To list the status of al the available printers 51. ls - To list the files in a direcotry. If you don't tell it otherwise, the ls command lists all the files in the working directory. You can tell it the name of antoher directory to list, and you can specify the files you want listed by using a filename(which can include wildcards) Go back to Section One for some other good uses for ls. 52. mail - To read and send e-mail. We suggest using elm or pine instead, if they are available, or any of the GUI e-mail programs found in X. 53. man - To display reference manual page about Unix/Linux commands 54. minicom - friendly serial communication program 55. mkdir - To create a new directory 56. more - To display information a screen at a time, so you have time to read it. When the screen is full, more pauses. To tell it to show you more, press the spacebar. To make more stop, press q. 57. mv - To rename a file or move it from one directory to another. 58. nice - To run a command with lower priority so that it doesn't hog the computer 59. netconfig - To configure your local network settings 60. nslookup - query Internet name servers interactively 61. pack - To shrink a file into one "packed" file so that it takes up less space on you disk. The command is obsolete; compress and gzip shrink alot better 62. passwd - To change your password 63. pcat - To display the contents of a packed file. Packes files have names that end in .z (That's a small z) 64. pico - To run a simple, screen-oriented text editor. 65. pine - To run a nicely designed e-mail program 66. pkgtool - To install and uninstall packages in Slackware 67. pr - To format a text file with page numbers, line numbers, or other options so that it looks nice when you print it. 68. ps - To display information about your process table (jobs) There are several switches you can use with this command do 'man ps' or Man Pages to see them all. 69. pwd - To display the name of the current working directory 70. rcp - To copy files to or from another computer. 71. rlogin - To log in to another UNIX computer on a network. See also telnet. 72. rm - To delete (remove) a file permanently. If there are other links to the file, the file continues to

exist, just not under the name you removed. The rm command delete just one name (link) to the file. Be very careful with this command as there is no recycle bin in Unix/Linux and you can not easily get the file back. 73. rmdir - To delete (remove) a directory. Before you delete a directory, delete the files and subdirectories that it contains. The -r option does this for you, but make sure that this is what you really want to do. 74. RPM - RPM is the RedHat Package Manager. It is used to maintain a database of installed packages and the files beloging to each package to allow easy installation, upgrades and removal of packages. The RPM home is http://www.rpm.org. Many packages are at http://rufus.w3.org/linux/RPM/. To install or upgrade an rpm use rpm -U package.rpm (for upgrade and install) and to remove use rpm -e package (for erase). 75. rsh - To run a command on another UNIX computer. NOTE: called remsh on some systems. 76. set - To set a shell variable to the value you specify, or to display the value of the shell variable. In any shell, typing set by itself lists the variables that are defined, and their values. 77. sh - To run the Bourne shell 78. shutdown - To stop Unix/Linux and prepare a workstation to be turned off. Do 'man shutdown' or Man Pages for required switches 79. sleep - To wait a little while. 80. sort - To sort the lines in a text file. 81. spell - To look through a text file for words not int he UNIX dictionary 82. stty - To set the options for your terminal 83. tail - To display the last few lines of a file 84. talk - To talk to another computer user by typing messages to each other on-screen 85. tar - To copy a file to or from an archieve file or backup tape or diskette. This command has several usages do 'man tar' or Man Pages too see all of them. 86. tee - To copy text from a pipe into a file. tee is most useful for making a log of the output of a slow or long-running program while still seeing its output on-scree. It's also good for debugging scripts so that you can see what's coming out of one program and going into another. 87. telnet - To log in to a remote computer, even one that doesn't run unix. 88. troff - To format text files for output on a high-quality printer or typsetter unsing a complex formatting language. 89. updatedb - This command will update the internal database of the filesystem. 90. unpack - To restore a packed files to irs orginal size A .z at the end of the filename confirms that

this is a packed tile. If a filename ends with .Z (uppercase) instead it is compressed and you must use the uncompress command. 91. uucp - To copy a file to another computer 92. uudecode - To convert a uuencoded file back into its orginal form 93. uuencode - To disguise a program as a text file so that you can send it through electronic mail 94. vi - To run a powerful, but yucky, screen-oriented text editor. 95. vim - Is vi improved and is a much better and more powerful screen-oriented text editor than vi 96. wall - To display a message on-screnn to every single user on your entire computer. Use with care. 97. who - To tell you who else is using this computer. 98. whoami - Tells you the user you are currently using 99. write - To display a message on the screen of another user. 100. zcat - To uncompress a compressed file and send the results to standard output (usually the screen). Compressed files have names ending in .Z (uppercase)

3. tell me 3 advantages and disadvantages about social networking sites? Answer: 1. helps to establish social relationship in community. 2. we can communicate effectively with peers groups effectively at times like now with across wide range of people. 3. facebook point of view, it is helps them in marketing prodcuts in the form of advt and which guides us in choosing right product. we spend too much time at time ....we happen to share our personal info , which can lead to problems 4. how will you ensure ur are perfect person (some thing of this kind was asked)? Answer: if we plan well and then we can implement it perfectly. so in order to ensure that. i plan ahead. (i exactly cannot remember what i said there)

LINUX:-

Ubuntu for you


Super-fast, easy to use and free, the Ubuntu operating system powers millions of desktops, netbooks and servers around the world. Ubuntu does everything you need it to. It'll work with your existing PC files, printers, cameras and MP3 players. And it comes with thousands of free apps.

What is an operating system?


An operating system is what makes your computer work. The core program of any computer, it's designed to run all your programs and manage all your hardware and software. Other examples of operating systems include Microsoft Windows, Mac OS X and Android.

Ubuntu is easy to use


And it comes with thousands of free applications. Ubuntu does everything you need it to. It'll work with your existing PC files, printers, cameras and MP3 players.
Perfect for business use, Ubuntu is safe, intuitive and stable. Easy to integrate, you'll be able to create documents, spreadsheets and presentations and share them with Windows users stress-free. Ubuntu cloud computing puts you in control of your IT infrastructure. It helps you optimise resources and reduce costs while you access computing power as and when you need it.