2. What is word alignment? When is it important? class biff { } short int a;...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
2. What is word alignment? When is it important? class biff { } short int a; long int b; short int c; 3. Looking at the class biff above, how many bytes would it occupy if a short int uses 2 bytes and a long int uses 4 bytes (Assume no word alignment). Now, assuming word alignment comes into play, how bytes would biff need. If possible, rearrange biff so that it occupies less space. 4. In general, what do the "*" and "&" operators do in C/C++ when used for memory addressing? 5. In the following cases, what do the following operators in C/C++ do in regards to memory referencing. ((*)) a. as in: int *myPtr; b. "*" as in: *myPtr = 4; c. "&" as in: myPtr = &x; d. "&" as in: myPtr = &(x[0]); (where x is an array defined as: int x[10];) 6. Write out some code (by hand) that will declare and load an array of integers using conventional array accessing methods. Let the array have 10 elements. 7. Now, using memory pointers, write out some code (by hand) that will declare and load an array of integers. Let the array have 10 elements. 8. Why is the method using memory pointers more computationally efficient? 2. What is word alignment? When is it important? class biff { } short int a; long int b; short int c; 3. Looking at the class biff above, how many bytes would it occupy if a short int uses 2 bytes and a long int uses 4 bytes (Assume no word alignment). Now, assuming word alignment comes into play, how bytes would biff need. If possible, rearrange biff so that it occupies less space. 4. In general, what do the "*" and "&" operators do in C/C++ when used for memory addressing? 5. In the following cases, what do the following operators in C/C++ do in regards to memory referencing. ((*)) a. as in: int *myPtr; b. "*" as in: *myPtr = 4; c. "&" as in: myPtr = &x; d. "&" as in: myPtr = &(x[0]); (where x is an array defined as: int x[10];) 6. Write out some code (by hand) that will declare and load an array of integers using conventional array accessing methods. Let the array have 10 elements. 7. Now, using memory pointers, write out some code (by hand) that will declare and load an array of integers. Let the array have 10 elements. 8. Why is the method using memory pointers more computationally efficient?
Expert Answer:
Answer rating: 100% (QA)
The image youve provided contains a list of questions related to programming concepts in CC Lets go through them step by step 2 What is word alignment When is it important Word alignment is the practi... View the full answer
Related Book For
Foundations of Financial Management
ISBN: 978-1259024979
10th Canadian edition
Authors: Stanley Block, Geoffrey Hirt, Bartley Danielsen, Doug Short, Michael Perretta
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Let x be the number of magazines a person reads every week. Based on a sample survey of adults, the following probability distribution table was prepared. Find the mean and standard deviation of x. 0...
-
According to the five forces model, one potential threat in an industry is buyers. Yet unless buyers are satisfied, they are likely to look for satisfaction elsewhere. Can the fact that buyers can be...
-
Pole Manufacturing Corporation issued stock with a par value of $67,000 and a market value of $503,500 to acquire 95 percent of Spencer Corporations common stock on August 30, 20X1. At that date, the...
-
The following are methods used to evaluate public health data and scientifc evidence except a. Use of standard criteria by experts b. By combining the results of multiple scientifc studies that are...
-
Describe MHSs recent change in business strategy. It was late October of 2009, and Willis Willie Stahe was running late. As president of Midwest Universitys Computing and Information Systems student...
-
3) A bicycle tire pump has a piston with area 0.40 in 2 . If a person exerts a force of 15 lb on the piston while inflating a tire, what pressure does this produce on the air in the pump? 4) A large...
-
Consider a hospital in which each doctor is responsible for many patients while each patient is cared for by just one doctor. Each doctor has a unique employee number, name, telephone number, and...
-
[3] 2 Find the rotation of point p =5 by 60 about the axis u = -2. - - 1 a. Using quaternions. b. Using the rotation matrix. Note the rotation matrix R for rotation by an angle 8 about the axis [x] u...
-
I'm not sure what is meant by this. what ultimately is the reasoning behind removing all interfaces from VLAN1? NETW260 Module 4 Practice Lab Report Question: What was the purpose of removing all...
-
Use the data set chick6.xls in Moodle to answer the following: In the chick6 data set y=per capita chicken consumption, pounds per year; yd= disposable income per capita, hundreds of dollars;...
-
8. Flash memory has some of the properties of ROM (it retains its contents with the power off), and some of the properties of RAM (you can read or write to it). However most types of FLASH memory are...
-
2. Crohn's disease is a chronic inflammatory disease. A double-blind completely randomized experiment of 71 persons who were resistant to or intolerant to the standard therapy was conducted where 37...
-
Eve Co purchases a machine that had a list price of $10,000 on January 1, 2020 The machine has no estimated residual value and a 2 years estimated useful life. The Company is using the...
-
Which best describes the relationship between the cost of acquiring information and return?
-
Time Travel Publishing was recently organized. The company issued common stock to an attorney who provided legal services worth $25,000 to help organize the corporation. Time Travel also issued...
-
Explain how exports and imports tend to influence the value of a currency.
-
The Milken Investment Fund buys 90 bonds of the Levine Corporation through its broker. The bonds pay 11 percent annual interest. The yield to maturity (market rate of interest) is 14 percent. The...
-
Standard Olive Company of British Columbia has a convertible bond outstanding with a coupon rate of9 percent payable semiannually, and a maturity date of 15 years. The bond maturity value is $1,000....
-
Summer and winter constellations are different because (a) of the spin of Earth about its polar axis. (b) the night sky faces in opposite directions in summer and winter. (c) of the tilt of Earths...
-
The property of a star that relates to the amount of energy per unit time it is producing is its (a) luminosity. (b) apparent brightness. (c) color. (d) volume. (e) mass.
-
The longest-lived stars are those of (a) low mass. (b) high mass. (c) intermediate mass. (d) infinite mass.
Study smarter with the SolutionInn App