From Software Engineers Wiki
Revision as of 15:48, 12 January 2018 by Kai
- What is Position Independent Code?
- Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz"
- You have a function f1() that generates 0 or 1 with the equal probability. Write a function f200() that generates a number between 1 and 200 with equal probability.
- Write a program calculating Fibonacci series. Fibonacci(0) = 0, Fibonacci(1) = 1, Fibonacci(n) = Fibonacci(n - 2) + Fibonacci(n - 1) if n >= 2.
- How to detect overflow during arithmetic operations?
- Write align_test(addr, align), align_floor(addr, align) and align_ceil(addr, align). align is 2^n. align_test() is testing whether the address is on power of 2.
- Write a function that counts number of bits with bit value 1.
- Write a function that counts number of bits with bit value 0.
- Swap every two bits in an unsigned char. Swap bits at 0 and 1st position, swap 2nd and 3rd position, and so on.
- Swap two integer variables without using a temporary variable.
- Write a function that finds first and last bit set in 32-bit value; bit_find_first_set() and bit_find_last_set()
- Swap byte order of 32-bit data.
- A set of integer has all integer values in certain range but one. Find which number is missing.
- What is the sum of the digits of all the numbers from 1 to 2016?
- Two regular polygons have a total of 17 sides and 53 diagonals. How many sides do they each have?
- Write a program that checks whether the given number is a prime number.
- Calculate square root of a number.
- Reverse a number.
- Given an array find any pair that sums up into a number.
- Reverse a string.
- Reverse the ordering of words in a string.
- Convert an integer to a string.
- Convert a string to an integer.
- Check if a string has all unique characters.
- Check if a string is a permutation of the other.
- Find first occurrence of any character of str2 in str1.
- Convert a string containing roman numerals to integer.
- Convert an integer value to a string in Roman numerals.
- Find all possible palindromes.
- Find longest palindromes.
- Find a string in word boundary.
- Write multi-threaded code in C++ so that one thread prints all even numbers and other all odd numbers with the output always in sequence.
- Given set of N threads generate sum of all numbers in an array of known size M.
- Implement spinlocks using atomic_flag.
- Implement tail program that shows last part of files.
- Implement uniq program that omits repeated lines.
- Implement diff program that compares two text files.