Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the output from the following code segment? int i1 = 27; int i2 = 29; if (i1++ >= --i2) { i1++; printf(%d %d

What is the output from the following code segment?

int i1 = 27; int i2 = 29; if (i1++ >= --i2) { i1++; printf("%d %d ",i1++,i2--); } else { i2++; printf("%d %d ",--i1,++i2); } printf("%d %d ",i1,i2); 

Assuming that the bits in an integer are numbered from 0, from right (least significant) to left (most significant), write an expression using bitwise logical operators to extract the 4 bits numbered 6 to 3 from an integer i1, and shift them all down so that bit numbered 3 ends up in position number 1.

Explain how a conditional expression may be rewritten using an if-then-else statement.

Rewrite the following for loop as a while loop.i

for (Index = 1;Index < MAX;Index++) { printf("%d ",Index); Total += Index; } 

Rewrite the following while loop as a for loop.

Index = 1; while (Index < MAX) { printf("%d ",Index); Total += Index; Index++; } 

Explain the difference between continue and break statements.

What is the output from the following code segment?

 Index = 1; while (Index < 30) { if (Index % 2 == 0) { Index = Index < 10 ? ++Index : Index +3; continue; } Index = (Index << 1) + 1; if (Index % 6 == 0) { break; } printf("%d ",Index); } 

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

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

What is the formula to calculate the mth Fibonacci number?

Answered: 1 week ago