C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Question
Chapter 10.1, Problem 12E
Program Plan Intro
To find the number of bytes that the computer uses for storing the address of different variables such as characters, integers, and a double-precision number using the sizeof() operator. Also, find whether the size of all is the same or not and provide the reasons for it.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
( C PROGRAMMING ONLY)
7. Adding Them All Upby CodeChum Admin
Being the business-minded I am, I have a lot of sources of income. My money is getting out of hand and I don't know how much is the total now.
Can you please help me add them all up?
Instructions:
In the code editor, you are provided with a main() function that asks the user for 3 integers.Your task is to create 3 pointers and name them: a_ptr, b_ptr, and c_ptr. Then, assign the address of a to a_ptr, b to b_ptr, c to c_ptr. Make sure to do this before the printf statement found at line 16.Input
1. First integer
2. Second integer
3. Third integer
Output
Enter·a:·1Enter·b:·6Enter·c:·3Total·=·10
(B+C) x (D+E)
F
1. Write code to implement the expression: A =
on 3-, 2-, 1- and 0-address
machines. In accordance with programming language practice, computing the expression should
not change the values of its operands.
2. Solve the following:
a) In a computer instruction format, the instruction length is 11 bits and the size of an address
field is 4 bits. Is it possible to have:
5 2-address instructions, 45 1-address instructions and 32 0-address instructions using the spec-
ified format? Justify your answer.
3. Suppose a computer using direct mapped cache has 232 bytes of byte-addressable main memory
and a cache size of 512 bytes, and each cache block contains 128 bytes.
a) How many blocks of main memory are there?
b) What is the format of a memory address as seen by cache, i.e., what are the sizes of the tag,
block, and offset fields?
c) To which cache block will the memory address 0x13A4498A map?
(C PROGRAMMING ONLY)
5. Adding Them All Upby CodeChum Admin
Being the business-minded I am, I have a lot of sources of income. My money is getting out of hand and I don't know how much is the total now.
Can you please help me add them all up?
Instructions:
In the code editor, you are provided with a main() function that asks the user for 3 integers.Your task is to create 3 pointers and name them: a_ptr, b_ptr, and c_ptr. Then, assign the address of a to a_ptr, b to b_ptr, c to c_ptr. Make sure to do this before the printf statement found at line 16.Input
1. First integer
2. Second integer
3. Third integer
Output
Enter a: 1Enter b: 6Enter c: 3Total = 10
Chapter 10 Solutions
C++ for Engineers and Scientists
Knowledge Booster
Similar questions
- [1] ( Show your work. Show hoe you compute memory address by using the effective memory address computation. Assume the following values are stored at the indicated memory addresses and registers: Address Value 0x100 OxFF 0x104 OxAB 0x108 0x13 0x10c 0x11 $0x108 (Zrax) Fill in the following table showing the values for the indicated operands: Operand Value Zrax 0x104 4(%rax) 9(%rax, Xrdx) Register Zrax Zrcx %rdx 260(Xrcx,Xrdx) OxFC(Zrcx, 4) (Zrax, Xrdx, 4) Value 0x100 0x1 0x3arrow_forward4. (16 pts.) Pseudoinstructions are not part of the MIPS instruction set but often appear in MIPS programs. For each pseudoinstruction in the following table, produce a minimal sequence of actual MIPS instructions to accomplish the same thing. You may need to use Sat for some of the sequences. In the following table, "imm" refers to a specific number that requires 32 bits to represent. Pseoduinstructions move $t1, $12 clear Sto beq St1, imm, L bge $15, $13, L What it accomplishes $t1 = $12 $t0=0 == If ($t1 big) go to L If ($t5 >= $13) go to Larrow_forwardI need the correct answer. Don't give wrong.arrow_forward
- )Choose the statement which is incorrect with respect to dynamic memory allocation.a. Memory is allocated in a less structured area of memory, known as heapb. Used for unpredictable memory requirementsc. Execution of the program is faster than that of static memory allocationd. Allocated memory can be changed during the run time of the program based on the requirement of the programarrow_forward(CP) Write a program that reads in an m by n matrix (m row by n column), then reads in an n by p matrix (n row by p column), and then computes the product matrix and displays the two matrices as well as their product matrix on the screen.arrow_forward(Subject: MATLAB) Hello dear, l need to answer in a short time, less than an hour.arrow_forward
- (JAVA Programme) 1) Take two 3*2 matrix from user input. Then find the sum and average of column1, row1 of both matrix. 1st matrix: sum of col1,row1 2nd matrix: sum of col1,row1 result: sum average of col1 both matrix sum average of row1 both matrix 2) Take two 4*3 matrix from user input. Then find and print each sum of column0,column1,row0, row2 of first matrix Then find and print each sum of row 1,row3,column1,column2 of second matrixarrow_forward(C++) PLEASE INCLUDE COMMENTS AND OUTPUT SCREEN Write a program that will do the following: In main, declare an array of size 20 and name it "randomArray." Use the function in step 2 to fill the array. Use the function in step 3 to print the array. Create a function that generates 20 random integers with a range of 1 to 10 and places them into an array. Re-cycle the functions from Lab 10 where appropriate. Make this a function. There will be two arguments in the parameter list of this function: an array and the size of the array. Within the function and the function prototype name the array: intArray. Within the function and the function prototype name the size of the array: size. The data type of the function will be void since the array will be sent back through the parameter list. Bring in the function that generates and returns a random number that you created from the previous module. Call that function from this within the loop that adds random numbers to the…arrow_forward(Don't copy ) Explain pleasearrow_forward
- (C PROGRAMMING ONLY) 1. Point Me Thereby CodeChum Admin I was supposed to be your tour guide but I don’t know where our destination is. I have a list here that contains all the destinations where we are going to go. Each destination is basically represented with an integer. But it seems that I'm confused. Please help me by pointing me to the correct address. Instructions: In the code editor, you are provided with a main() code that asks for an integer input from the user and stores this to the variable n.Your task is to set the value of the destination_ptr found at line 9 to the address of the variable n.Aside from this, do not edit anything else.Input 1. An integer value Output Enter the destination number: 2Found it!arrow_forward(C Language) Topic: Pointersarrow_forward[no. 21] What does the // operator in Python allow you to do? a. Perform floating point division b. Perform operations on exponents c. Find the remainder of a division operation d. Perform integer divisionarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education