Code Snippets Interview Questions

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.

35874

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

19318

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

14847

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

17381

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.

7782

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)

24729

program to Reverse a linked list

50883

write a program to Insert in a sorted list

11395

Program to Delete an element from a doubly linked list.

29634

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

78901

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

14620

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

27915

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)

11129

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

15470

How to swap two variables, without using third variable ?

190365

Un-Answered Questions { Code Snippets }

Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

2885

write a program that can LOCATE and INSERT elements in array using c++ programming languages.

2937

hai, i want to know how the connectionpool manager work in the java or netbeans.Anybody having the exact code plz give to me i have no idea about that so help me plz

2125

I have a file which contains so many lines and variable number of lines are treated as a record. For example *first ooooo xxxxx ttttt mmmm vvvvvvv *end uuu bbbb *first kkkkvvvvvv nnnn mmmmm kkkkk fffff gggg ffff kkkk lllll *end. Here the lines from *first to *end are treated as a record. The number of lines between *first and *end is not same for all the records. Suppose there are 100 records (or number of records are not predefined)like the format given in the above example. Now the entire file needs to split into two files, first having 40 and remaining in the second file. Can we split using sort utility? If possible then what is the sort card?

1366

How to print sum of the numbers starting from 1 to 100?

103

How to Bind Nested XML to a Repeater Control with Container.DataItem?

2726

Write a program to reverse a number in python?

110

Write a function that takes as input a binary tree, and prints out each level of the tree on a newline. For example: a / b c / / d e f will output: a b c d e f

955

What is the functionality of SetForegroundWindow?

511

Hi, I want the code to fetch multiple rows in REXX using RLX and CURSOR. Can anyone help me?

1627

write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

2739

plz send code for Ecorps in j2ee frontend:J2EE Backend: DB2 Express

1952

Write a function to efficiently convert a floating point number to a rational number. For example, given 0.125 return "1/8"

828

Code for Method of Handling Factorials of Any Size?

1528

Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37

1484