Compare commits
No commits in common. "f2d6dd8bd7837384a4d65b16c5e2adb20af385a5" and "b12b0f9262f2a852ce43ee976b82185dc5b1eb82" have entirely different histories.
f2d6dd8bd7
...
b12b0f9262
@ -1,36 +0,0 @@
|
|||||||
> 3. Which of the following aren not legal types in C?
|
|
||||||
|
|
||||||
a. `short unsigned int`
|
|
||||||
b. `short float`
|
|
||||||
c. `long double`
|
|
||||||
d. `unsigned long`
|
|
||||||
|
|
||||||
Answer:
|
|
||||||
b. `short float`
|
|
||||||
|
|
||||||
> 4. If `c` is a variable of type `char`, which of the following statements is illegal?
|
|
||||||
|
|
||||||
```c
|
|
||||||
char c;
|
|
||||||
// A:
|
|
||||||
i += c; // i has type int
|
|
||||||
// B:
|
|
||||||
c = 2 * c - 1;
|
|
||||||
// C:
|
|
||||||
putchar(c);
|
|
||||||
// D:
|
|
||||||
printf(c);
|
|
||||||
```
|
|
||||||
|
|
||||||
Answer:
|
|
||||||
D is illegal because `printf` operates on strings, not `char`s.
|
|
||||||
|
|
||||||
> 6. For each of the following items of data, specify which one of the types `char`, `short`, `int`, or `long`is the smallest one guaranteed to be large enough to store the item.
|
|
||||||
|
|
||||||
Answer:
|
|
||||||
A. Days in a month: `char`
|
|
||||||
B. Days in a year: `short`
|
|
||||||
C. Minutes in a day: `short`
|
|
||||||
D. Seconds in a day: `long`
|
|
||||||
|
|
||||||
> 10. Suppose that `i` is a variable of type `int`, `j` is a variable of type `float`, and `k` is a variable of type `unsigned int`. What is the type of the expression `i + (int) j * k`?
|
|
Loading…
x
Reference in New Issue
Block a user