ExploreNeedy
@ Your Choice
Share with -
Home
Fun Corner
Interesting
Inspirational
Quotes
Miscellaneous
Games
Questions
Technical
Logical
Puzzles
Lectures
Spiritual
Photos
Audio
Facts
Ramayanam
Bhagavatam
BhajaGovindam
SoundaryaLahar
VivahaVybhavam
Photo Gallery
Free SMS
Recipes
Music
Feeds
Technical
Logical
Puzzles
Lectures
Guestbook
HITS
C/C++ Interview Algorithms
Counting set bits in an unsigned number.
Given two sets, Write a function to provide the union of them.
Given four points in two dimentional pane, find is these points form a rectangle or not.
Write a C function that will print 1 to N one per each line on the stdout where N is a int parameter to the function. The function should not use while, for, do-while loops, goto statement, recursion, and switch statement.
Write program to implement the atoi() function?
Counting set bits in an unsigned number.
First solution:
int NoOfSetBits(int num) {
int count = 0;
while (num != 0) {
if (num & 1)
count++;
n = n>>1;
}
return count;
}
Second Solution (Optimized version):
short int CountSetBits(unsigned int num) {
short int count = 0;
while(num != 0) {
num = num & (num -1);
count++;
}
return count;
}
How would you detect a repeated element in an integer array.
Given two sets, Write a function to provide the union of them.
Given four points in two dimentional pane, find is these points form a rectangle or not.
Write an algorithm and write code to find two numbers in an array whose sum equals a given value
Question - 6
If you think that an important C/C++ interview questions or some answers are wrong in the site please contribute it to
SiteAdmin@ExploreNeedy.com
Mail Us Your Valuable Feedback-
SiteAdmin@ExploreNeedy.com
AboutUs
-
Photos
-
FreeSMS
-
Ramayanam
-
Puzzles
-
Disclaimer