Question
Asked Sep 1, 2019
87 views

Given the following snippet of C++ code:

int int1 = -125;
unsigned int uInt1 = int1;
float float1 = int1;

What format are each of the following variables stored in and what are the binary values:

int1, uInt1, float1
check_circle

Expert Answer

star
star
star
star
star
1 Rating
Step 1

The variables are stored in the following format:

int1 is a signed int type variable and 32 bits long and hence the variable is a signed integer and stored in 2’s complement format. The binary value of int1 is hence 11111111 11111111 11111111 10000011.

 

uInt1 is an unsigned int and it is 32 bits long. Since it has now been assigned the value stored in int1 it refers to the same memory l...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Design a Turing machine that computes the function f(w) = 1 if w is even   = 0 if w ...

A: To discover whether a string is even or odd, just examine the LSB (least significant bit).If LSB is ...

question_answer

Q: Design a program that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit...

A: Program plan:Use “for” loop to print a table of the Celsius temperatures 0 through 20 and their Fahr...

question_answer

Q: How to use ProstgreSQL in my local Java IDE using SSH tunneling?

A: So here we have to do three things,1) first we need to create a SSH tunnel to the postgreSQL db but ...

question_answer

Q: 1) Create a array of Fahrenheit temperatures, as follows int fahr []= {0,1,2,3,4,5,6,7,8,9,10,32,33,...

A: Program Instructions:Define the given array in code and calculate the size of the array.Use for loop...

question_answer

Q: Write a class in java with the name AgeMessages , which does the following:a. Ask the user to enter...

A: The algorithm for the program would be as below:Declare one float variable for accepting user inputP...

question_answer

Q: Financial Application:• Write a program that computes future investment value at a given interest ra...

A: Program plan:Import necessary packages.Define a class named “Main”.Define a method named “computeFut...

question_answer

Q: Create a new file in C++ and save it as lab12_XYZ.cpp  Consider rolling two six-sided dice. Whil...

A: Program Instructions:Declare the header files, constants, and prototypes.In main() call functions di...

question_answer

Q: Hello. I am having trouble with an assignment. When I run the program, it says: TypeError: can't mul...

A: To remove this “TypeError: can't multiply sequence by non-int of type 'float' “, we can use NumPy. N...

question_answer

Q: Rainfall StatisticsWrite a program that lets the user enter the total rainfall for each of 12 months...

A: The following program is in C++ language and it is compiled in the “repl.it” compiler.Program plan:I...