Integer puzzles Check if the statements are always true? 1. x < 0 => ((x*2) < 0) 2. ux >= 0 3. x & 7 == 7 4 ux > -1 Initialization int x = foo (); int y = bar(); => (x<<30) < 0
Integer puzzles Check if the statements are always true? 1. x < 0 => ((x*2) < 0) 2. ux >= 0 3. x & 7 == 7 4 ux > -1 Initialization int x = foo (); int y = bar(); => (x<<30) < 0
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question

Transcribed Image Text:III.
Integer puzzles
Check if the statements are always true?
1. x < 0
2. ux >= 0
3. x & 7 == 7
4. ux>-1
5. x > y
6. xx >= 0
Initialization
int x = foo();
int y = bar();
unsigned ux = x;
unsigned uy = y;
=> ((x+2) < 0)
=>
(x<<30) < 0
=> -x < -Y
7. x > 0 && y > 0 =>
8. x > 0
=>
9. x < 0
=>
10. (x-x) >>31 == -1
11.ux >> 3 == ux/8
12.x >> 3 == x/8
13.x & (x-1) != 0
x + y > 0
-X <= 0
-X >= 0
Expert Solution

Step 1
Since you have posted a question with multiple sub parts, we will provide the solution only to the first three sub parts as per our Q&A guidelines. Please repost the remaining sub parts separately.
The int and unsigned int have a size of 4 bytes. The value of the integer ranges from -2,147,483,648 to 2,147,483,647. The value of an unsigned integer ranges from 0 to 4,294,967,295.
The & operator is used to perform bitwise AND between two values. The AND operator returns 1 if both the operand bits are 1.
The << operator is used to perform the left shift of the bits in a value.
The == operator checks the equality of two values and returns true if they are equal.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education