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,

20 25666

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 16075

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

Fusion Systems GmbH,

6 11133




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

Microsoft,

9 12139

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.

Wipro,

2 5580

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)

Microsoft,

7 19966

program to Reverse a linked list

Microsoft, Aricent, Ness Technologies,

12 45875

write a program to Insert in a sorted list

Microsoft,

4 9045

Program to Delete an element from a doubly linked list.

Infosys, College School Exams Tests,

4 25220

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

Amazon, Adobe, EFI, Imagination Technologies,

13 72732

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

Microsoft,

3 12307

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 21824

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 8597

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

2 12649

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 168619







Un-Answered Questions { Code Snippets }

What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

2212


How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?

1115


How to encode and decode URL strings?

1018


Code for using a Hot Key in an ActiveX Control?

1198


Can we run Applet in Web browser with security policy files

1204


i have some csv files in a directory which have sub-directories also. now how can i merge all .csv files in to one with a single header. for example: have some 4 files. 1.csv--------name,age,sal abc,25,4000 2.csv--------name,age,sal vgd,32,3500 3.csv--------name,age,sal hfg,20,5000 4.csv--------name,age,sal asd,15,2000 now my output file should be like 5.csv----------name,age,sal abc,25,4000 vgd,32,3500 hfg,20,5000 asd,15,2000 and please explain the code for me. as i am new to scripting. thank you in advance

676


Discuss an algorithm to traverse a tree, depth first.

448


how to track links visited in google using iframes

1284


Code for Using Keyboard Events?

1267


how to determine which Mouse Button was pressed

1015


code to sorting an array of objects

1171


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

3352


Is it possible to write JAVA program without including any of the packages,such as "import java.io.*"; bcoz I instantly wrote a code without "import..." statement and runned the program on command Line & it worked. the code is: class Person { String name; int age; Person(String s,int a) { name = s; age = a; } accept() { System.out.println(name+"Hi!!!!!"); System.out.println(age); } } class Demo { public static void main(Strings args[])throws IOException { String name = args[0]; int age = Integer.parseInt(args[1]); Person p = new Person(name,age); p.accept(); } }

914


Write a function that takes an array of integers and returns that array rotated by N positions. For example, if N=2, given the input array [1, 2, 3, 4, 5, 6] the function should return [5, 6, 1, 2, 3, 4]

622


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

3311