GeeksforGeeks » Interview Questions

Microsoft Interview Question for Software Engineer/Developer about Bit Magic

(2 posts)
  • Started 8 months ago by learner
  • Latest reply from Abhimanyu Vohra

Tags:

  1. learner
    guest
    Posted 8 months ago #

    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

  2. Abhimanyu Vohra
    Member
    Posted 5 months ago #

    m = (((n>>5)&(2^(l-k+1) -1))<<i)||m


Reply

You must log in to post.

RSS feed for this topic