Intel Corporation

  www.intel.com
Work in HR? Unlock Free Profile

Intel Corporation Mtech Interview Question (student candidate)

I interviewed in Bangalore (India) and was asked:
"flip the 5th bit of register in c"
Add Tags [?]
Answer

Part of a Mtech Interview Review - one of 1,359 Intel Corporation Interview Reviews

Answers & Comments

0
of 0
votes

just read bitwise operators

- Interview Candidate on Jun 7, 2012
0
of 0
votes

#include<stdio.h>
#define NUM 10
int main()
{
        register int n=NUM;
        n=(1<<4)&n?(~(1<<4))&n:(1<<4)|n;
        printf("%d ",n);
        return 0;
}

- Anonymous on Sep 17, 2012
0
of 0
votes

#include<stdio.h>
#define NUM 10
int main()
{
        register int n=NUM;
        n^=(1<<4);
        printf("%d ",n);
        return 0;
}

- Dinesh T on Apr 15, 2014

To comment on this question, Sign In with Facebook or Sign Up

Tags are like keywords that help categorize interview questions that have something in common.