C program and output
/* CodeBhavya | PPS AR25 | Learning example */
#include <stdio.h>
int main(void)
{
unsigned int a = 12U, b = 10U;
printf("AND = %u\n", a & b);
printf("OR = %u\n", a | b);
printf("XOR = %u\n", a ^ b);
printf("left shift = %u\n", a << 1);
printf("right shift = %u\n", a >> 1);
return 0;
}
Sample input and output
This example uses values already written in the program.
Output
AND = 8
OR = 14
XOR = 6
left shift = 24
right shift = 6
Related exam questions
Topic matches from the supplied JNTUH papers. Marks below are the printed allocations for those questions.
- March/April 2023 · Q3(b) · 6 marks
List bitwise operators and explain each with its precedence and associativity.
Paper P05 · page 1 - March/April 2023 · Q2(a) · 5 marks
Explain bitwise operators in detail.
Paper P07 · page 1 - January/February 2024 · Q1(a) · 1 marks
List bitwise operators in C.
Paper P08 · page 1
View all matching exam references →