Question

1.the programmer expected myString to contain the phrase "Girls and Boys" but instead only holds "Girls"....

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;

b.

2 + 3

c.

3 * x

d.

x + z

Homework Answers

Answer #1
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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
USE C programming (pls label which file is libcipher.h and libcipher.c) Q4) A shift cipher is...
USE C programming (pls label which file is libcipher.h and libcipher.c) Q4) A shift cipher is one of the simplest encryption techniques in the field of cryptography. It is a cipher in which each letter in a plain text message is replaced by a letter some fixed number of positions up the alphabet (i.e., by right shifting the alphabetic characters in the plain text message). For example, with a right shift of 2, ’A’ is replaced by ’C’, ’B’ is...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char...
1 #include <stdio.h> 2 #include <stdlib.h> 3 4 extern char **environ;    5 void output(char *a[], char *b[]) { 6 int c = atoi(a[0]); 7 for (int i = 0; i < c && b[i]; ++i) { 8 printf("%s", b[i]+2); 9 } 10 } 11 12 void main(int argc, char *argv[]) { 13      14 switch (argc) { 15 case 1: 16 for (int i = 0; environ[i]; ++i) {    17 printf("%s\n", environ[i]); 18 } 19 break; 20 default: 21 output(argv +...
1. Three random people get on a bus. Assume that boys and girls are equally likely...
1. Three random people get on a bus. Assume that boys and girls are equally likely to get on the bus. Let x represent the number of girls that get on the bus. Construct a probability distribution. 2. Find the value of z to the left of the mean so that 71.55% of the area under the distribution curve lies to the right of it. 3. According to a study done by a research center, 39% of adults believe that...
8.15 *zyLab: Method Library (Required & Human Graded) This code works but there are some problems...
8.15 *zyLab: Method Library (Required & Human Graded) This code works but there are some problems that need to be corrected. Your task is to complete it to course style and documentation standards CS 200 Style Guide. This project will be human graded. This class contains a set of methods. The main method contains some examples of using the methods. Figure out what each method does and style and document it appropriately. The display method is done for you and...
"C language" Take this code and make the minor modification necessary to create a circular linked...
"C language" Take this code and make the minor modification necessary to create a circular linked list (Hint: Store a pointer to the first node in the next pointer of the last node.) Demonstrate that this is working by traversing the list until the first pointer is encountered 3 times. Next redefine the node structure to include a back pointer. This will enable your program to move from front to back and then from back to front. It is not...
According to an article in Newsweek, the natural ratio of girls to boys is 100:105. In...
According to an article in Newsweek, the natural ratio of girls to boys is 100:105. In China, the birth ratio is 100:114 (46.7% girls). Suppose you don't believe the reported figures of the percent of girls born in China. You conduct a study. In this study, you count the number of girls and boys born in 150 randomly chosen recent births. There are 64 girls and 86 boys born of the 150. Based on your study, do you believe that...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class...
1) Consider the following Java program, which one of the following best describes "setFlavor"? public class Food {     static int count;     private String flavor = "sweet";     Food() { count++; }     void setFlavor(String s) { flavor = s; }     String getFlavor() { return flavor; }     static public void main(String[] args) {         Food pepper = new Food();         System.out.println(pepper.getFlavor());     } } a. a class variable b. a constructor c. a local object variable d....
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*;...
1) Consider the following Java program. Which statement updates the appearance of a button? import java.awt.event.*; import javax.swing.*; public class Clicker extends JFrame implements ActionListener {     int count;     JButton button;     Clicker() {         super("Click Me");         button = new JButton(String.valueOf(count));         add(button);         button.addActionListener(this);         setSize(200,100);         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         setVisible(true);     }     public void actionPerformed(ActionEvent e) {         count++;         button.setText(String.valueOf(count));     }     public static void main(String[] args) { new Clicker(); } } a. add(button);...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total 52 case sensitive) and five special characters (‘.’, ‘,’, ‘:’, ‘;’ and ‘!’) in all the .txt files under a given directory. The program should include a header count.h, alphabetcount.c to count the frequency of alphabet letters; and specialcharcount.c to count the frequency of special characters. Please only add code to where it says //ADDCODEHERE and keep function names the same. I have also...