Code Snippets Interview Questions
Questions Answers Views Company eMail

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.

Google, Goldman Sachs, eBay, ABC, Microsoft, HUP, TATA,

21 31599

Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.

Microsoft, Mentor Graphics,

2 18292

Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.

Fusion Systems GmbH,

6 13347

Give a one-line C expression to test whether a number is a power of 2.


10 15331

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.


2 7012

Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)


7 23041

program to Reverse a linked list

Microsoft, Aricent, Ness Technologies,

12 48741

write a program to Insert in a sorted list


4 10433

Program to Delete an element from a doubly linked list.

Infosys, College School Exams Tests,

4 28424

Write a function to find the depth of a binary tree.

Amazon, Adobe, EFI, Imagination Technologies,

13 76575

Write a routine that prints out a 2-D array in spiral order


3 13761

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).

TCS, Intel, Microsoft,

12 25417

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)

Disney, Google, ZS Associates,

3 10217

Print an integer using only putchar. Try doing it without using extra storage.

2 14511

How to swap two variables, without using third variable ?

Manhattan, TCS, BirlaSoft, ADP, IBM, Hewitt, Infosys, Cisco, Wipro, HP, Satyam, Microsoft, Honeywell, HCL, Yamaha, Cygnet Infotech, Mobius, Percept, SofTMware, AB,

104 179825

Un-Answered Questions { Code Snippets }

How to Check if File Exists?


What is GUID anyway?


1.Why does only one copy of a servlet object get created? What happens if you want to remove an old servlet object currently running but do not want to stop the entire servlet engine? 2.How does one servlet object deal with interactions from many browser? (e.g. if your servlet ran an email site, how can it keep track of hundreds of users logging in, reading their mail, etc.)


Hi All, Do anyone have a solution/script for Uploading the Excel file in Local drive to QC Resources folder..?? TIA Dwaraka.


find out the list of users who have access to all t-codes starts with 'SU'? thanks in advance all.


In java, why do we set thread priority, when we know that there is no guarantee by which a thread should be execute?


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file


How to get the version(major,minor,revision ) of VB6.0 delphi code .I am able to fetch dll file of vb6.0 but not vba file .Can u send me the code snippet in delphi to get the value for vb6.0.


How can manage theme in php?


Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }


I'm calling a JS fcn that fires AJAX to a webmethod and returns a boolean. How do I retrieve the return value in the codebehind? (VB) I can set a hiddenfield value in the JS, but if it's async how can my VB know when it's changed?


Design a timer circuit using VHDL which has the following: input : start_timer(ST) output: long_time(LT) short_time(ST) when the timer is triggered by the ST(either 0 or 1) signal the timer should generate two timing signals accordingly.While the long time is going ON the other should be OFF and vice versa.


I am trying to pass the string firstName from a Servlet called SampleServet. I am running this on eclipse and it tells me that "the value for annotation attribute must be a constant expression. I don't understand why it is giving me this error. @PersonAnnotation(name = SampleServlet.firstName) public class AnnotationClass{


how exactly is the lngColour used?


i have a gird with columns all are coming from database,this will bind in item templete in gridview as textboxex.and i have button below named Update.i want to update all the records in the grid,but if user change the value of one textbox,what is the easy way 2 do this