1.the programmer expected myString to contain the phrase "Girls and Boys" but instead only holds "Girls". Why? User input: Girls and Boys char myString[12]; scanf("%s", myString);
a. myString must be preceded by an ampersand (&)
b. scanf stops reading a string at the first whitespace
c. The variable myString was improperly declared
d. The "%s" parameter should be "%ws"
Question 13
2. Which is correct?
a. |
int main(void) { pkgHeight; pkgLength; pkgWidth; pkgVol = pkgHeight * pkgLength * pkgWidth; } |
||||||||||
b. |
int main(void) { int pkgHeight = 2; int pkgLength = 3; int pkgWidth = 5; pkgVol = pkgHeight * pkgLength * pkgWidth; } |
||||||||||
c. |
int main(void) { pkgHeight = 2; pkgLength = 3; pkgWidth = 5; pkgVol = pkgHeight * pkgLength * pkgWidth; } |
||||||||||
d. |
int main(void) { int pkgHeight; int pkgLength; int pkgWidth; int pkgVol; pkgVol = pkgHeight * pkgLength * pkgWidth; } 3. Which expression is evaluated first? w = y + 2 + 3 * x + z;
|
Question 1: the programmer expected myString to contain the phrase "Girls and Boys" but instead only holds "Girls Because scanf stops reading a string at the first whitespace Answer: b. scanf stops reading a string at the first whitespace Question 2: Correct code is int main(void) { int pkgHeight; int pkgLength; int pkgWidth; int pkgVol; pkgVol = pkgHeight * pkgLength * pkgWidth; } Answer: Option d Question 3: w = y + 2 + 3 * x + z; 3 * x evaluated first in the given expression Answer: 3 * x
Get Answers For Free
Most questions answered within 1 hours.