Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

One line of code in C for each problem, where you can only use straight-line code: use all the variables you want and write successive

One line of code in C for each problem, where you can only use straight-line code: use all the variables you want and write successive assignment statements, but no branching, ternary operators (?:), looping, or function calls. each puzzle restricts you to a short list of operators, (legal ops) each puzzle restricts you to maximum number of operator uses. (assignments actually don't count!) (max ops) you may only use one-byte constants. (valid: int x = 0xFF;)

1. returns 1 if x is the maximum, two's complement number, * and 0 otherwise * Legal ops: ! ~ & ^ | + * Max ops: 10 */

2. * return a value of -1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 2 */

3. - return maximum two's complement integer * Legal ops: ! ~ & ^ | + << >> * Max ops: 4

4. - return 1 if all even-numbered bits in word set to 1 * where bits are numbered from 0 (least significant) to 31 (most significant) * Examples allEvenBits(0xFFFFFFFE) = 0, allEvenBits(0x55555555) = 1 * Legal ops: ! ~ & ^ | + << >> * Max ops: 12

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

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions