Skip to main content

Posts

Showing posts with the label BCA

Unix questions asked in aptitude and inteviews for MCA,BCA,ME,BE,M.Tech AND B.Tech

Unix Aptitude Questions 1. Display the first line of a file is using the "head" command. $> head -1 file.txt 2. Display the first 2 records of the file using the "head" command. $> head -2 file.txt 3. Another way can be by using "sed" command. Sed is a very powerful text editor which can be used for various text manipulation purposes like this. $> sed '2,$ d' file.txt The 'd' parameter basically tells "sed" to delete all the records from display from line 2 to last line of the file (last line is represented by $ symbol). It does not actually delete those lines from the file, it just does not display those lines in standard output screen. So you only see the remaining line which is the 1st line. 4. Display the last line of a file using "tail" command. $> tail -1 file.txt 5. Display the last line of a file using "sed" command. $> sed -n '$ p' test '$' stands for the last...

Microsoft Questions asked at B.Tech,.B.E.,MCA,M.Tech,ME,BCA and B.Sc

Microsoft Placement Papers  1. Besides communication cost, what is the other source of inefficiency in RPC? (answer : context switches, excessive buffer copying). How can you optimize the communication? (ans : communicate through shared memory on same machine, bypassing the kernel _ A Univ. of Wash. thesis) 2. Write a routine that prints out a 2-D array in spiral order! 3. How is the readers-writers problem solved? - using semaphores/ada .. etc. 4. Ways of optimizing symbol table storage in compilers. 5. A walk-through through the symbol table functions, lookup() implementation etc. 6. An array of size k contains integers between 1 and n. You are given an additional scratch array of size n. Compress the original array by removing duplicates in it. What if k << n? ANS. Can be done in O(k) time i.e. without initializing the auxiliary array! 7. An array of integers. The sum of the array is known not to overflow an integer. Compute the sum. What if we know that intege...

Microsoft Campus Recruitment Test Questions

                      Microsoft Placement Paper Questions 1. A version of the "There are three persons X Y Z, one of which always lies".. etc.. 2. 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. 3. 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. 4. The if (x == 0) y = 0 etc.. 5. Some more bit wise optimization at assembly level 6. C++ ( what is 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). 7. 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). 8...

Microsoft Placement Papers for B.Tech,.B.E.,MCA,M.Tech,ME and aptitude tests

Microsoft Placement Paper  Questions 1.C++ ( what is 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). 2. 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). 3. Given 3 lines of assembly code : find it is doing. IT was to find absolute value. 4. If you are on a boat and you throw out a suitcase, Will the level of water increase. 5. Print an integer using only putchar. Try doing it without using extra storage. 6. Write C code for (a) deleting an element from a linked list (b) traversing a linked list 7. Compute the number of ones in an unsigned integer. ANS. #define count_ones(x) \ (x=(0xaaaaaaaa&x)>>1+(0x55555555&x), \ x=(0xcccccccc&x)>>2+(0x33333333&x), \ x=(0x...