Interview questions
Algorithm interview questions – page 26
811 questions. Tap “Show answer” to check yourself.
-
Void main(){int i=20;j=35,x,y;x= y++ + x++;y= ++y + ++x;printf("%d %d" , x,y);}/* please tell me the value of x and y at each and every moment. i dont need the answer but the explanation of the anamolus behavior of increment expression.*/
-
What are the types of cookies are there?
-
Given a number, multiple it by 8 without using multiplication or addition. Do the same for 7.
-
Prove that in a graph, sum of degrees = twice the number of edges.
-
Bit palindrome: Write a function to check if the bit-wise representation of an integer is a palindrome.
-
Write a Complete program check whether Graph is Connected or Not & also for whether Graph is Tree or not.
-
For any string s (0 + 1)*, let d(s) denote the decimal value of s (eg: d(101) = 5, d(011) = 3). Let L = {s (0+1)* | d(s) mod 5 = 2 and d(s) mod 7 = 4}. Which of the following statements is true? a) L is recursively ...
-
Why do most hardware testers use stacks in their programs to store data?
-
Two 32bit integers m,n are given.replace all the bits in m from i to j locations with all the bits in n from k to l locations... eg. m = 110000000000 n = 10101010 i=3 j=5 k=5 l=7 o/p:110000101000
-
How we can declare & initialize more than two variable of same name & print their different values?
-
Which of the following languages over {0, 1} is regular? a) 0i1j such that i j b) 0iw1j such that w {0, 1} and i 0 c) All strings of 0s and 1s such that every pth character is 0 where p is prime d) None...
-
Given a byte, write code to swap every two bits in pair.
-
What is the function pointer? In which situation we need to use function pointer?
-
Set the highest significant bit of an unsigned integer to zero
-
How to count number of 0 bits in a given integer? write C code
-
How to find whether a machine is 32bit or 64 bit? Write code for this
-
What is a trap and trapdoor?
-
Given any number say 12, find the next multiple of 8 eg 16 using bit-wise manipulations.?
-
Belady's anomaly and scheduling algorithms (from OS)
-
Floating point representation: Simple one If 23 bits are used for IEEE representation then whats the range of normalized nos. which can be represented?
-
How to check if binary representation of a number is a palindrome or not? For eg. binary representation of 5 is 101 and is a palindrome.
-
Write a function int findn(int n, int x); The function must return the nth number in the sequence of binary numbers with exactly x ones.
-
Program to flip all odd bits of an integer
-
Life cycle of thread
-
Write a function F(x, p, n, y) such that it returns x with the n bits that begin at position p (from LSB) set to the rightmost n bits of y.
-
What is busy waiting?
-
Find the value of n the following code: int F(int n) if( n!=0& !(n&(n-1))) printf("%d",n) n is i. Even no ii. Odd nos iii. Non zero numbers iv. Number with power 2
-
Reverse bits of an integer
-
Set nth bit of an integer
-
There is an array of size 'n' containing 0s and 1s. Find in O(n) and constant space the maximum sub sequence which has equal number of 1s and 0s.