Question

Question 4 (2 points) Consider the C statements below. Assume x has been assigned a value....

Question 4 (2 points)

Question 4 Unsaved

Consider the C statements below. Assume x has been assigned a value.

int mask = 0xFF000000;

y = x ^ mask;

Which one of the following best describes the value computed for variable y?

Question 4 options:

y contains the most significant byte of x complemented, with the rest of the bits unchanged

y contains the most significant byte of x unchanged, with the rest of the bits 0

y contains the most significant byte of x unchanged, with the rest of the bits 1

y contains the most significant byte of x zeroed, with the rest of the bits unchanged

none of these

Save

Question 5 (2 points)

Question 5 Unsaved

Consider the C statements below. Assume x has been assigned a value.

int mask = 0x000000FF;

y = x & mask;

Which one of the following best describes the value computed for variable y?

Question 5 options:

y contains the least significant byte of x, with all other bits set to 0

y has all bits set to 1

y contains the least significant byte of x, with all other bits set to 1

y has all but the least significant byte zeroed, with the least significant byte complemented

none of these

Save

Question 6 (2 points)

Question 6 Unsaved

Determine x, as a logical value, after the statements below. See the hint for a note about 'logical'.

int a = 4, b = 3, x;

x = !a;

Question 6 options:

True
False

Hide hint for Question 6

logical means we could use x in an if statement: if ( x )   

so would x be considered True or False?

Save

Question 7 (3 points)

Question 7 Unsaved

Determine x, as a logical value, after the statements below. See the hint for a note about 'logical'.

int a = 0, b = 2, x;

x = !( !a  && !b)

Question 7 options:

True
False

Hide hint for Question 7

logical means we could use x in an if statement: if ( x )   

so would x be considered True or False?

Save

Question 8 (2 points)

Question 8 Unsaved

Suppose the variable x has the value shown. Determine the result of the indicated left shiftoperation(s) as a single byte in hexadecimal.

int  x = 0xC5;

     x << 2

Question 8 options:

0x8A

0xD6

none of these

0x62

0x14

Hide hint for Question 8

suggestion: convert to binary, do the shift, convert back to hex

Save

Question 9 (2 points)

Question 9 Unsaved

Suppose the variable x has the value shown. Determine the result of the indicated right logical shift operation(s) as a single byte in hexadecimal.

int  x = 0xF6;

     x >> 2

Question 9 options:

none of these

0xD6

0xD4

0xE5

0x3D

Hide hint for Question 9

suggestion: convert to binary, do the shift, convert back to hex

Save

Question 10 (2 points)

Question 10 Unsaved

Suppose the variable x has the value shown. Determine the result of the indicated right arithmetic shift operation(s) as a single byte in hexadecimal.

int  x = 0xCA;

     x >> 2;

Question 10 options:

0xFE

0x32

0xA8

0x65

none of these

Hide hint for Question 10

suggestion: convert to binary, do the shift, convert back to hex

Save

Question 11 (2 points)

Question 11 Unsaved

The largest unsigned value that may be represented using 6 bits is 63.

Question 11 options:

True
False
0 0
Add a comment Improve this question Transcribed image text
Answer #1

4)y contains the most significant byte of x complemented, with the rest of the bits unchanged

5) y contains the least significant byte of x, with all other bits set to 0

6) !a = 0
FALSE

7)

int a = 0, b = 2, x;

x = !( !a  && !b) => !(1 && 0) => !(0) = True


Answer: True



8) 0xC5 = 1100 0101 << 2 = 0001 0100 = 0x14
Answer: 0x14




9) 0xF6 = 1111 0110 >> 2 = 0011 1101 = 0x3D
Answer: 0x3D

10)  0xCA = 1100 1010 >> 2 = 0011 0010 = 0x32
Answer: 0x32


11) The largest unsigned value that may be represented using 6 bits is 63.

26 - 1 = 63

TRUE



Thanks, PLEASE UPVOTE

Add a comment
Know the answer?
Add Answer to:
Question 4 (2 points) Consider the C statements below. Assume x has been assigned a value....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Systems Question 7 Question 7 options: Consider the code fragment below. What value is pushed onto...

    Systems Question 7 Question 7 options: Consider the code fragment below. What value is pushed onto the stack by the callinstruction? 0x400627 <main+55> callq 0x4004a0 <printf@plt> x 0x40062c <main+60> mov $0x400745,%edi Question 4 (2 points) Given the array declaration below, which one of the following is equivalent to a[4]? int a[10]; Question 4 options: *( a + 4 ) *( a + 1 ) *a + 1 *(a + 16) none of these Question 5 (2 points) Suppose we have...

  • Question 2 [5 points) State if each of the below statements is True or False 1...

    Question 2 [5 points) State if each of the below statements is True or False 1 2 3 The Compiler skips comments. A function can return a value of type array. An array index starts with 1. Pass by value is the default in CH, except when passing arrays as arguments to function The default storage class for local variables is static. A pointer provides an indirect means of accessing the value of a particular data item The logical operators...

  • C and Unix questions QUESTION 8 2 points Saved The default return value of main is...

    C and Unix questions QUESTION 8 2 points Saved The default return value of main is void True o False QUESTION 9 2 points Save Answer What unix command would you use to find out information about the strcat() function? show string o more string o man string string -help None of the above

  • QUESTION 1 What will be displayed as a result of executing the following code? int   x...

    QUESTION 1 What will be displayed as a result of executing the following code? int   x = 5, y = 20; x += 32; y /= 4; cout <<"x = " << x <<"y = " << y; A. x = 32, y = 4 B. x = 9, y = 52 C. x = 37, y = 5 D. x = 160, y = 80 8 points    QUESTION 2 What will be the displayed when the following code...

  • QUESTION 1 Given two double variables named x and y, which of the following statements could...

    QUESTION 1 Given two double variables named x and y, which of the following statements could you use to initialize both variables to a value of 0.0? a. x | y = 0.0; b. x = y = 0.0; c. x, y = 0.0; d. none of the above 1 points    QUESTION 2 When you use a range-based for loop with a vector, you a. can avoid out of bounds access b. must still use a counter variable c....

  • Save Answer QUESTION 4 2 points A researcher has used a one-way analysis of variance model...

    Save Answer QUESTION 4 2 points A researcher has used a one-way analysis of variance model to test whether the average starting salaries differ among recent graduates from the nursing, engineering, business, and education disciplines. She has randomly selected four graduates from each of the four areas. If MSE = 4, and SSTO = 120, complete the following ANOVA table and determine the value of the F statistic. Source SS HDF MS Treatments Errors Total SStr= F= QUESTION 5 2...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

  • Question 17 (2 points) Let A be a 3 x 4 matrix with a column space...

    Question 17 (2 points) Let A be a 3 x 4 matrix with a column space of dimension 2. What is the dimension of the row space of A? Not enough information has been given. O 1/2 3 2. Question 16 (2 points) The rank of the matrix 1 2 - 1 2 4 2 1 2 3 is 02 O none of the given options Question 15 (2 points) Which of the following is not a vector space because...

  • Question 1) Consider a class Point that models a 2-D point with x and y coordinates. Define the c...

    C++ Question 1) Consider a class Point that models a 2-D point with x and y coordinates. Define the class point that should have the following Private data members x and y (of type int), with default values of 0 A constant ID of type int A private static integer data member named numOfPoints This data member should be o Incremented whenever a new point object is created. o Decremented whenever a point object is destructed. A default constructor An...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT