logo

CuriousTab

CuriousTab

Discussion


Home C Programming Bitwise Operators Comments

  • Question
  • Bitwise & can be used in conjunction with ~ operator to turn off 1 or more bits in a number.


  • Options
  • A. Yes
  • B. No

  • Correct Answer
  • Yes 


  • Bitwise Operators problems


    Search Results


    • 1. Bitwise | can be used to set multiple bits in number.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 2. Bitwise can be used to perform addition and subtraction.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 3. On left shifting, the bits from the left are rotated and brought to the right and accommodated where there is empty space on the right?

    • Options
    • A. True
    • B. False
    • Discuss
    • 4. Left shifting an unsigned int or char by 1 is always equivalent to multiplying it by 2.

    • Options
    • A. True
    • B. False
    • Discuss
    • 5. Bitwise & can be used to check if a bit in number is set or not.

    • Options
    • A. True
    • B. False
    • Discuss
    • 6. Bitwise | can be used to multiply a number by powers of 2.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 7. Bitwise can be used to reverse a sign of a number.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 8. Bitwise can be used to generate a random number.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 9. Bitwise | can be used to set a bit in number.

    • Options
    • A. Yes
    • B. No
    • Discuss
    • 10. Point out the error in the program.
      #include<stdio.h>
      #include<stdlib.h>
      
      union employee
      {
          char name[15];
          int age;
          float salary;
      };
      const union employee e1;
      
      int main()
      {
          strcpy(e1.name, "K");
          printf("%s", e1.name);    
          e1.age=85;
          printf("%d", e1.age);
          printf("%f", e1.salary);
          return 0;
      }
      

    • Options
    • A. Error: RValue required
    • B. Error: cannot modify const object
    • C. Error: LValue required in strcpy
    • D. No error
    • Discuss


    Comments

    There are no comments.

Enter a new Comment