Search for question
Question

Question 1 0.9 Points Given the following structs, how many bytes would two struct B's take up? Give your answer in decimal only. struct A { short i; }; struct B { char* str1; int* i, j; char ch; A a, b; }; Question 2 0.9 Points This problem considers a linked list that has been created in memory. We know the linked list consists of 2 nodes, we know one of the nodes resides at address 0x00007fffffffea40 and has the following declaration in C. struct Inode { struct Inode *prev; struct Inode *next; char first; char *word; int length; }; We decide to look at the node in gdb and see the following: (gdb) x/4xg 0x555555554774 0x555555554774: 0x6f72203136325343 0x6c65480021736b63 0x555555554784: 0x3b031b0100216f6c 0x000000060000003c (gdb) x/14xg $rsp 0x7fffffffea00: 0x00007fffffffeb58 0x00000001756e6547 0x7fffffffea10: 0x00007fffffffea40 0x0000000000000000 0x0000000000000043 0x0000555555554774 0x7fffffffea20: 0x7fffffffea30: 0x000000000000000c 0x000055555555473d 0x7fffffffea40: 0x0000000000000000 0x00007fffffffea10 0x7fffffffea50: 0x0000000000000048 0x0000555555554781 0x7fffffffea60: 0x0000000000000006 0x2248a3a88ddbb600 Fill-in the following blanks for the node starting at address 0x00007fffffffea40. The field first is stored at address Blank 1 (copy the value and paste it here including Ox) The field length is stored at address Blank 2 (copy the value and paste it here including Ox) The value stored in the field next is Blank 3 (copy the value and paste it here including Ox) the first ASCII character referenced by word is Blank 4 (you can use an ASCII table) The value stored in the field first is Blank 5 (copy the value and paste it here) Question 3 Given the struct definition for Inode shown below, and the memory containing one instance of Inode, answer the question below .Struct: struct Inode { char *str; char first; int size; struct Inode *next; }; Memory: 0x555555756b40: 0x0000555555756b60 0x0000000700000076 0x555555756b50: 0x0000000000000000 0x0000000000000021 0x555555756b60: 0x000a646569726176 0x0000000000000000 0x555555756b70: 0x0000000000000000 0x0000000000000021 Where is the word referenced by str stored? Give your answer either in hexadecimal or binary, accounting for all 64 bits. Question 4 Given the struct definition for Inode shown below, and the memory containing one instance of Inode, answer the question below .Struct: struct Inode{ char *str; char first; int size; struct Inode *next; }; Memory: 0x555555756b80: 0x0000555555756ba0 0x0000000900000074 0x555555756b90: 0x0000555555756b40 0x0000000000000021 0x555555756ba0: 0x74617265706d6574 0x0000000000000065 0x555555756bb0: 0x0000000000000000 0x0000000000000021 What is the address where the variable first is stored? Give your answer either in hexadecimal or binary, accounting for all 64 bits.