MCQOPTIONS
Saved Bookmarks
This section includes 6 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Calculate the % of memory saved when bit-fields are used for the following C structure as compared to with-out use of bit-fields for the same structure? (Assuming size of int = 4) |
| A. | 75% |
| B. | 50% |
| C. | 33.3% |
| D. | 25% |
| E. | None of these |
| Answer» B. 50% | |
| 2. |
For what minimum value of x in a 32-bit Linux OS would make the size of e equal to 8 bytes? |
| A. | 32 |
| B. | 12 |
| C. | 8 |
| D. | 4 |
| E. | None of these |
| Answer» C. 8 | |
| 3. |
What is the correct syntax to initialize bit-fields in an structure? |
| A. | <pre class="prettyprint lang-c">struct temp<br> {<br> unsigned int n = 1;<br> }s;<br></pre> |
| B. | <pre class="prettyprint lang-c">struct temp<br> {<br> unsigned float n : 1;<br> }s;<br></pre> |
| C. | <pre class="prettyprint lang-c">struct temp<br> {<br> unsigned int n : 1;<br> }s;<br></pre> |
| D. | All of above |
| E. | None of these |
| Answer» D. All of above | |
| 4. |
What is the order for the following C declarations? |
| A. | Illegal, legal |
| B. | Legal, legal |
| C. | Legal, illegal |
| D. | Illegal, illegal |
| E. | None of these |
| Answer» E. None of these | |
| 5. |
In the following declaration of bit-fields, the constant-expression must be __________. |
| A. | Nonnegative integer value |
| B. | Any type |
| C. | Nothing |
| D. | Integer value |
| E. | None of these |
| Answer» B. Any type | |
| 6. |
In the following declaration of bit-fields, the constant-expression specifies __________. |
| A. | Error |
| B. | The width of the field in bytes |
| C. | Nothing |
| D. | The width of the field in bits |
| E. | None of these |
| Answer» E. None of these | |