Question: 1. Which sections have a size that can be determined only when the program runs? Text Data BSS Heap Stack 2. What will the following
1. Which sections have a size that can be determined only when the program runs?
| Text | ||
| Data | ||
| BSS | ||
| Heap | ||
| Stack |
2. What will the following code print?
int i = 10; switch (i) { case 9: i = 7; case 10: i = 12; case 11: i = 4; default: i = -3; } printf("%d ", i);
3. The relationship between C variables, types, and assignment is:
| C variables are untyped, and assignments to variables can be of any type. | ||
| C variables are declared with a type, and the initial assignment must be compatible with that type, but future assignments can be of any type. | ||
| C variables are typed and immutable, and no assignments can be made to a variable once it is initialized. | ||
| C variables are declared with a type, and every assignment to a variable must be compatible with that type. |
4. Which of the following are valid scope lifetimes for C variables?
| Static scope, with a lifetime the same as the program | ||
| Module scope, with a lifetime the same as the module they are in. | ||
| Global scope, with a lifetime the same as the program | ||
| Block scope, with a lifetime from where they are declared to the nearest closing curly brace. |
5. Given a pointer to a region of memory allocated by malloc(), how can the programmer find out how much memory was requested at allocation time?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
