Question 4 In the initialization code below, both function foo() and bar() return a random int type number. int x = foo(

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
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(

Post by answerhappygod »

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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply