Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago

Question

=+8. Why is productivity important?

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago

Question

=+6. What does the invisible hand of the marketplace do?

Answered: 1 week ago