Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the following questions, assume a 32-bit machine. Consider the following code: typedef union class scheduling { /* Assume all structs were typedefed */ /*

image text in transcribed

For the following questions, assume a 32-bit machine. Consider the following code: typedef union class scheduling { /* Assume all structs were typedefed */ /* elsewhere. */ CS61C* cs61c; /* sizeof(CS61C) == x; */ CS161* cs161; /* sizeof(CS161) == y; */ CS162 cs162; /* sizeof(CS162) == z; */ } class Scheduling; Q10.1 4 Points Given the following segment of code, what issues exist? Select all that apply. Assume that syntax warnings and errors in previous lines do not perpetuate to later lines. /* Assume all structs used and memory addresses accessed have been initialised. */ void* classSelect (CS61C new_61c, CS161* new_161, CS162* new_162, Classscheduling* classes) { /* Class assignment field-setting. */ classes.cs610 = new_61c; classes.cs161 = &new 161; classes->cs 162 - new_162; /* Examining classes; assume printfs of class object gets the class information and string-formats it. */ printf("Class No. $d: %s", 1, classes.cs61c); printf("Class No. $d: %s", 1.5, (*classes) ->cs161); printf("Class No. #d: %s", (unsigned) 2, *classes.cs162); Incompatible ptr assignment Incorrect ptr assignment Used memory access operator on ptr Used arrow operator on union Garbage prints Definitively accessing uninitialised memory cs6lc and cs161 fields get overwritten by cs161 and cs162 fields respectively cs61c field gets verwritten by cs161 and cs162 fields Incorrect string formatter Incorrect signed formatter Incorrect float formatter Incorrect unsigned formatter None of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions