Author Archives
Aditya Prakash is a Sr. Software Engineer having 8+ yrs of experience with a strong emphasis on programming languages like C, C++, and Python on a Linux platform and worked on multiple products on Network Security and Telecom Domain.
He holds a degree in Computer Science Engineering and Diploma in Software System Development from CDAC, Bangalore and
also is a Cisco Certified Network Associate(CCNA) Certified Network Engineer.
LinkedIn :https://www.linkedin.com/in/aditya-prakash-2a84b140/
-
Operating system interview questions
Q.1) What is an operating system? A computer system has many resources which may be software or a hardware. A few of the common resources are CPU, files, different processes, memory etc. All these resources are managed by a low… Read More ›
-
Extract k bits from p position
This program extracts k bits from given position say p Logic:1) right shift the number by p-12)set k bits Do and of 1 & 2 Same question can be asked to extract from say p to kthen p =p but… Read More ›
-
To find max and min of two number
This program is to find max and min of a given two numbers. Logic:result = b ^ ((a ^ b) & -(a < b)); // min(a, b) In above expression,if a < b, then -( a < b) become -1,… Read More ›
-
Swap odd-odd and even-even
This program is for swapping odd bits with its next odd bits and even bits with its next even bits LOGIC:If the two bits are different, just toggle them odd bit condition : i %2 ==0even bit condition : i… Read More ›
-
Swap even-odd bits of a number
This program is to swap Even and Odd position of a number. Logic: Get all the bits at the even position. And the number with 10 as 10 = 1 0 1 0 Get all the bits at odd position… Read More ›
-
Number power of 2
This program is to find out whether the given number is power of 2. Any number is power of 2 if (num & num -1) =0 Implementation: Output:
-
Check given number is power of 4
This program is to check whether a given number is power of 4 Condition for a number to be power of 4: If the number of bit set is 1 The number of unset bit before the first set is… Read More ›
-
Rotation of a number
This Program is to perform Right and Left rotate Operation What is rotation of a number by a bit? Rotation of a number by a particular bit can be: Left Rotation Right Rotation Left Rotation:This means shifting all the bits… Read More ›
-
Change the endianess of a number
This program is to change the endianess of a number along with swapping the nibble of a byte Logic:1) data & 0x000000FF — This picks the first byte from a given number2) data & 0x0F) — This picks the first… Read More ›
-
Reverse of a number
This program is to reverse a number Logic: Loop through all the bits of an integer.If a bit at ith position is set in the i/p no.then set the bit at (NO_OF_BITS – 1) – i in o/p.Where NO_OF_BITS is… Read More ›