Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ECEIII-C Programming SP18 Final Version 2 of 4 Name:Alla ALAs Circle Cormect Ans

ID: 3720155 • Letter: E

Question

ECEIII-C Programming SP18 Final Version 2 of 4 Name:Alla ALAs Circle Cormect Answers 1 Opts) How are "siruct" identifiers and "array" identifiers similar in C? a Botdh must use the same data types b. Both must be declared as typodef identifiers c. Both can only be declared as global data d. Both have contigaous memory (Spes, which of the following. meanszg there could be multiple Rnswers, are paradigms we use when designing software? 2. the code a Tradeoft design for execution time of the code versus the amount of memory akes b. Design for reusable code c. Design in complexity d. Design for maintainability Tradeoff time and space 3. 3pts) A stracture declaration using "struct" tells the complier to reserve memory True False 4. (3pts) Structure Padding" is when the compiler "pads" bytes or bits so that the members of the structure are cormectly aligned in memory, based on a byte or word boundary a. False b. True 3pts) A 32 bit machine has a natural "word" size of 32 bits, this means the compiler will try to align data to the bus size, "word alignment" 5. a False b. True The next questions use the following code example. 1. tyrodef unsignod char uns t 2 typedef char ints t 3. typedef unsigned short uint16 5. tpedef int int32 t 6 typedef unsigned int win32 main/machine is a 32bit architecture struct hitchhikerst the ultimate question just 2 shot nt16 1 a: 12 12 struct hachiker 1 turStnaxt my?Struct-(OxEAD, OuFF, J.14, Ondeade,OXBEEF, ONDE) 13 uincsmySire sizeoft myStractk 4urStruct-my Stract 15 urStruct-mSuructc 2 17

Explanation / Answer

1. Both struct identifiers and array identifiers have contiguous memory, that is

int a[50]:- defines contiguous memory in location as, 50*2 = 100bytes, 100 contiguous memory locations are identified here

struct ex

{

int a;

float b;

}ex1;

ex1, will have contiguous memory of size , 2+4 = 6 bytes

4) True, in C structure padding is to naturally aligne every member of structure, that is because the members will be of different sizes

5) True, The word size shows the particular processor design and is the natural unit of data for the same, thus it is also used for the word alignment of data into the bus size.