Question 4
In the initialization code below, both
function foo() and bar() return a
random int type number.
int x = foo();
int y = bar();
unsigned ux = x;
unsigned uy = y;
Assume on a 32-bit architecture,
please justify whether the following claim is always true:
(Hints: x and y are
both signed integers. ux and uy are unsigned integers
cast from x and y.)
If x >= 0, then -x <= 0. Is this
true?
Select one:
True
False
Question 5
In the initialization code below, both
function foo() and bar() return a
random int type number.
int x = foo();
int y = bar();
unsigned ux = x;
unsigned uy = y;
Assume on a 32-bit architecture, please justify whether the
following claim is always true:
(Hints: x and y are
both signed integers. ux and uy are unsigned integers
cast from x and y.)
if x < 0, then we will always have (x * 2)
< 0. Is this true?
Select one:
True
False
Question 6
In the initialization code below, both
function foo() and bar() return a
random int type number.
int x = foo();
int y = bar();
unsigned ux = x;
unsigned uy = y;
Assume on a 32-bit architecture,
please justify whether the following claim is always true:
(Hints: x and y are
both signed integers. ux and uy are unsigned integers
cast from x and y.)
x & (x - 1) != 0. Is this true?
Select one:
True
False
Question 4 In the initialization code below, both function foo() and bar() return a random int type number. int x = foo(
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Question 4 In the initialization code below, both function foo() and bar() return a random int type number. int x = foo(
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!