Answer:
Check the explanation
Step-by-step explanation:
#include <stdio.h>
#include <stdlib.h>
//function to print a message
static void printMessage(char *msg)
{
printf("%s\\", msg);
}
//perform option A
int perform_A(int x)
{
//return true if any bit of x is equal to 1
return !!x;
}
//perform option A
int perform_B(int x)
{
//return true if any bit of x is equal to 0
return !x;
}
//perform option C
int perform_C(int x)
{
//return true if least significant bit is 1
return !!(x & 0xFF);
}
//perform option D
int perform_D(int x)
{
//return true if most significant bit is 0
return !!(~x & 0xFF);
}
//the main function
int main(void)
{
//set the integer
int input = sizeof(int) << 3;
//declare the test values
int onebitis1 = ~0;
int onebitis0 = 0;
int onebitLeast1 = 0xFF;
int onebitMost0 = 0xFF << (input - 8);
(perform_A(onebitis1)) && (printf("A return True\\"));
(perform_B(onebitis0)) && (printf("B returns True\12"));
(perform_C(onebitLeast1)) && (printf("C returns True\\"));
(perform_D(onebitMost0)) && (printf("D returns True\\"));
//to wait for a key press
getchar();
return 0;
}
Kindly check the attached image below to see the output.