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 30717

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 18012

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

Fusion Systems GmbH,

6 12997

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


10 14863

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 6820

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 22624

program to Reverse a linked list

Microsoft, Aricent, Ness Technologies,

12 48347

write a program to Insert in a sorted list


4 10229

Program to Delete an element from a doubly linked list.

Infosys, College School Exams Tests,

4 28051

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

Amazon, Adobe, EFI, Imagination Technologies,

13 76118

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


3 13587

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 24912

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 9957

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

2 14256

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 178047

Un-Answered Questions { Code Snippets }

how to write a program that opens a file and display in reverse order?


iam getting keyword or delimiter error while executing ICETOOL,provide me solution.


write a c program which takes 20 numbers in an array as input from user and rearrange them in two different array defining even or odd


What is used of serialize and unserialize in php?


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.


How to get Dynamically Linked Comboboxes Set?


I am attempting to work on a game panel with multi-server support, so in one of the pages there is a dropdown menu with servers on it, this is the part i am having issues with is server 1 is chosen i need access to the username running a script to server 1 chosen i need a script that will realize its been chosen and pop up below with a username thats associated with it because the users differ on each server so i choose server 1 i need a code to pull from the db and choose the user associated with the said server please help..


Financial: credit card number validation) Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits. It must start with: ■ 4 for Visa cards ■ 5 for Master cards ■ 37 for American Express cards ■ 6 for Discover cards In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. The algorithm is useful to determine whether a card number is entered correctly or whether a credit card is scanned correctly by a scanner. All credit card numbers are generated following this validity check, commonly known as the Luhn check or the Mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626): 1. Double every second digit from right to left. If doubling of a digit results in a two-digit number, add up the two digits to get a single-digit number. 2 * 2 = 4 2 * 2 = 4 4 * 2 = 8 1 * 2 = 2 6 * 2 = 12 (1 + 2 = 3) 5 * 2 = 10 (1 + 0 = 1) 8 * 2 = 16 (1 + 6 = 7) 4 * 2 = 8 2. Now add all single-digit numbers from Step 1. 4 + 4 + 8 + 2 + 3 + 1 + 7 + 8 = 37 3. Add all digits in the odd places from right to left in the card number. 6 + 6 + 0 + 8 + 0 + 7 + 8 + 3 = 38 4. Sum the results from Step 2 and Step 3. 37 + 38 = 75 5. If the result from Step 4 is divisible by 10, the card number is valid; otherwise, it is invalid. For example, the number 4388576018402626 is invalid, but the number 4388576018410707 is valid. Write a program that prompts the user to enter a credit card number as a long integer. Display whether the number is valid or invalid. Design your program to use the following methods: /** Return true if the card number is valid */ public static boolean isValid(long number) /** Get the result from Step 2 */ public static int sumOfDoubleEvenPlace(long number) /** Return this number if it is a single digit, otherwise, return * the sum of the two digits */ public static int getDigit(int number) /** Return sum of odd place digits in number */ public static int sumOfOddPlace(long number) /** Return true if the digit d is a prefix for number */ public static boolean prefixMatched(long number, int d) /** Return the number of digits in d */ public static int getSize(long d) /** Return the first k number of digits from number. If the * number of digits in number is less than k, return


how to test the orientation of the layout in note any changes in the ui design when change orientation


Give me some tips in c#?


Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.


plz send code for feature rich resume builder in j2ee frontend:J2EE Backend: DB2 Express


Pls provide basic funtionality Winrunner scripts for Health care domain and Phishing


how to remove or delete multiple selected items from listbox in on button click in asp?


write a program for area of circumference of shapes