Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) (5 points) The following program is used to check if a given number is the power of 2 using bitwise operator 1 #include #de
1) (5 points) The following program is used to check if a given number is the power of 2 using bitwise operator 1 #include #de fine BITS NUM INT (8*sizeof(double)) - 4int power2 (unsigned int x) int i, count=0, result, shift-num; for (i=0;i > i; result shift num && 1; if (result) 12 13 14 15 16 17 18 19 20 21 22 int main ) 23 I counttt printf ("YES") printf("NO"): unsigned int num; 25 26 27 28 printf (nEnter Number") scanf("%d", num); this.power2 (num) return 0 30 Which line(s) is(are) incorrect? And how to correct it(them)? Please write down your correction for that line (those lines) 2) (6 points) The following shell script is used to check if the numbers from command line are even or 1 bin/bash count 4 Eor ^num in [se 5 do if [ expr $num% 2-0 ] then echo snum is an even number count= expr scount+l 10 else echo snum is an odd number fi 12 13 14 15 echo There are count even numbers in total Which line(s) is(are) incorrect? And how to correct it(them)? Please write down your correction for that line (those lines)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started