explain in terms of c++
1. How to calculate the value of a short int and of an int by looking at the values in hexadecimal. Give an example for a short int and an int
2. How the same bytes can represent such different values when read into the different data types
3. Explain in your own words why the hexadecimal values for the chars, short ints and ints aren't in the same order
Solution:
1)
32-bit system short data type occupies the memory of 2 bytes and int 4 bytes. so when we store a hexadecimal
suppose we have a hexadecimal value 0x100D5689
the given value is out of range of short int so only first four-digit will be stored and rest will be overflow
but int will be able to store all the values
short int=> 0x100D
converting: 1*16^3 + 0^16^2 + 0*16^1 + 13 * 16^0
= 4109
int=> 0x100D5689
the values is 269309577
The data in the memory is stored in little-endian or big-endian format.
2)
That is because of data overflow or the type in which data type they are represented.
3)
Because char is only 1 byte and short is 2 bytes whereas int is 4 bytes.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
explain in terms of c++ 1. How to calculate the value of a short int and of...
in C++ 1. Answer the following questions: a) 2 pts] Explain why it is important to indent code. What happens if code is not indented? b) 2 pts) Explain how you can prevent the unintended use of garbage values? c) (2 pts] Give one reason why you should use the keyword const when dealing with constant values. Make sure to explain what could happen if you fail to use this keyword. d) 2 pts) Give an example where simply declaring...
Explain in your own words how the Intermediate Value Theorem tells us that our intuitive idea that a continuous function on [a, b] should have no holes or jumps is correct. Illustrate your explanation with the help of the graph of a function f which is continuous on (-1, 1], and has a single critical point at x = 0. Give an example of a function which illustrates why f must be continuous at x = b in order to...
This week we discuss the properly classified Balance Sheet. Recall that the value of assets is based on historical cost with few exceptions (short-term investments). Liabilities include values based on terms like "likelihood" and "estimatable". So how reliable is the Balance Sheet? Please read this weeks lesson and respond to these questions, in your own words. Do you feel that the balance sheet would be more accurate if accountants were allowed to use fair value when placing asset values on...
java Binary files The binary file data.dat contains characters and numbers- it has 16 characters, followed by numbers of type int alternating with numbers of type double -so after the first 16 characters, there will be an int, followed by a double, followed by an int, followed by a double, and so on. Write a program to open the file and until the end of file is reached, read in the values in the appropriate data types (that is, read...
#include <iostream> #include <climits> Using namespace std; Intmain() { Int I; Int j; Cout << “For this compiler: “ << endl; Cout << “integers are: “ << sizeof(int) << “bytes” << endl; Cout << “largest integers is “ <<INT_MAX << endl; Cout << “smallest integers is “ <<INT_MIN << endl; Cout << “Input two integers values “ << endl; Cin >> i >> j; Cout << endl << “You entered the following values: “ << endl; Cout << “integer “...
In words, define the term force; explain how mass can be used to define the force unit Newton Name and draw all of the significant forces that act on any common object (such as an airplane in flight) Explain what is meant by the normal force, and be able to draw it and calculate it for common objects Explain in your own words all three of Newton's Laws of Motion Use Newton's Laws to explain how any object will behave...
Please, answer the with c++ Module 9: Odds and Ends Questions Question 1 How is the static_cast operator different from the dynamic_cast operator? Question 2 Which of the following are not examples of correct usage (conceptually or syntactically) of auto ptr? (Assume the needed header files have beenincluded.) auto ptr int> pia(new int[20]) auto ptr str> (new string); int ngue = 7; auto_ptr int pr(&rigue): auto ptr dbl (new double) Question 3 Give at least three examples of convenience advantages...
can you explain this quetions for me plz 1. How is area trapped between two curves different than the signed area under a function? 1. There is an essential difference, but they are otherwise the same and quite similar. 2. In the definition of Area of a Region Between Two Curves, the assumption is that g (z) sf(a) on the interval la,b-but what if this is not the case? What can you do? 3. In the remark following example 4,...
How do I set up my read function? here's my code so far: int read_sudoku_board(const char file_name[], int board[9][9]) { FILE * fp = fopen("sudoku.txt", "r"); int a,i,j,c; int count = 0; for(i = 0; i < a; i++){ for(j = 0;j < 9;j++){ c = fgetc(fp); if(c == '-'){ board[i][j] = 0; } else if(c >= 1 && c <= 9) printf(" %d"); else return -2; } count++; } if(count != a-1) return -1; else return 0; }12 Read...
27. How does studying the math in the exercise today help you understand evolution? Explain in your own words. 28. You have a population of mice with in your lab, some have red eyes and some have black eyes. Black is dominant to red. In generation #1 you have 9 red eyed mice and 81 black eyed mice. Given that you only know the phenotypes, estimate the values below. SHOW YOUR WORK! (90) a. q? (the frequency of red eyed...