Which of the following are C-string constants? Give the number of characters in each of these.
a. ‘\n’
b. ‘n’
c. “Lamb\n”
d. “Mary”
e. “M”
c) d) and e) are C-strings.
Explanation: In a), and b) ‘n’ and ‘\n’ are character constants. The number of characters: In a) 1, the \n is an escape sequence. b) 1 character. c) 5 characters in the characters in Lamb, plus 1 for the new line, plus 1 more for the terminator, for a total of 6 . d) has five characters, including ‘\0’ e) has two including ‘\0’.
You might also like to view...
Suppose a list contains {"red", "green", "red", "green"}. What is the list after the following code?
``` String element = "red"; for (int i = list.size() - 1; i >= 0; i--) if (list.get(i).equals(element)) list.remove(element); ``` a. {"red", "red", "green"} b. {"red", "green"} c. {"green", "green"} d. {"green"} e. {}
Identify the compiler errors, and state what is needed to eliminate the error(s).
#Include
What setting for outgoing e-mail is useful for companies that prefer using a more professional name than the actual mail server name?
A. Masquerade B. Authenticate C. Alternate D. Absolute
The percentage rate of increase is calculated by using this formula:
A) base * amount of increase. B) base/amount of increase. C) amount of increase/base. D) amount of increase * base percent.