Question

The C-string cityName[30] can contain ________. A) thirty characters B) thirty one characters C) twenty nine...

The C-string cityName[30] can contain ________.

A) thirty characters

B) thirty one characters

C) twenty nine characters and the null terminator

D) thirty characters and the null terminator

E) None of the above

Homework Answers

Answer #1

In C,

defining string as cityName[30] means it will have string of 30 characters. Also all string is terminated by a NULL string. So that is not something is mentioned but is understood by default.

The number of characters in character array is defined in the square bracket [ ] . The first character will be placed at index 0.

So the correct option is (D).

No space is given to null Terminator while defining size of character array. It is just appended at the last position of array.

If you have any questions comment down and please? upvote thanks

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
Consider strings that contain only the characters A, B, C, D and E. 1- Find a...
Consider strings that contain only the characters A, B, C, D and E. 1- Find a recurrence relation for the number of such strings that contain three consecutive Bs. 2- What are the initial conditions?
Discrete Mathematics A pin consists of 6 characters. Each one of the characters can be digits...
Discrete Mathematics A pin consists of 6 characters. Each one of the characters can be digits (0-9) or letters (upper case only). 1. How many codes are possible if there are no restrictions? 2. How many codes are possible if none of the characters can be repeated? 3. How many codes contain at least one repeated character?
ANSWER IN C++ ONLY A string of characters including only alphabets (lowercase letters) is provided as...
ANSWER IN C++ ONLY A string of characters including only alphabets (lowercase letters) is provided as an input. The first task is to compute the frequency of each character appearing in the string. In the output, the characters have to be arranged in the same order as they appear in the input string. Then characters have to be rearranged, such that all the characters having a specific frequency, say xx, come together. Let the frequency of a character, lying in...
This is for C++ A string is a palindrome if reverse of the string is same...
This is for C++ A string is a palindrome if reverse of the string is same as the original string. For example, “abba” is palindrome, but “abbc” is not palindrome. Basically a string with a plane of symmetry in the middle of it is considered a palindrome. For example, the following strings are palindromic: "abbbbba", "abba", "abbcbba", "a", etc. For this problem, you have an input string consisting of both lowercase or uppercase characters. You are allowed to pick and...
How many permutations of the set {A, B, C, D, E, F, G, H} a) Contain...
How many permutations of the set {A, B, C, D, E, F, G, H} a) Contain the string DEF? b) Contain the strings ABE and EFG? c)Have D next to C? d) Contain the strings DCB and BAD?
In a large university, 20% of the students are male. If a random sample of twenty-two...
In a large university, 20% of the students are male. If a random sample of twenty-two students is selected. a. What is the probability that the sample contains exactly twelve male students? b. What is the probability that the sample will contain no male students? c. What is the probability that the sample will contain exactly twenty female students? d. What is the probability that the sample will contain more than nine male students? e. What is the probability that...
Give the number of core electrons for Se. A) 26               B) 30               C) 28     &nb
Give the number of core electrons for Se. A) 26               B) 30               C) 28               D) 32               E) 34 (1) Which the following orbitals can hold two electrons? A) 3s                                     B) 2px                                                         C) 4dxy D) all of the above                E) none of the above
Which of the following substances would contain a polar covalent bond? a. Cl2 b. HCl c....
Which of the following substances would contain a polar covalent bond? a. Cl2 b. HCl c. NaCl d. All contain polar covalent bonds e. None contain polar covalent bonds
Which of the following substances would contain a pure covalent bond? a. Cl2 b. HCl c....
Which of the following substances would contain a pure covalent bond? a. Cl2 b. HCl c. NaCl d. All contain pure covalent bonds e. None contain pure covalent bonds
Huffman Codes: You are give a text file containing only the characters {a,b,c,d,e,f}. Let F(x) denote...
Huffman Codes: You are give a text file containing only the characters {a,b,c,d,e,f}. Let F(x) denote the frequency of a character x. Suppose that: F(a) = 13, F(b) = 4, F(c) = 6, F(d) = 17, F(e) = 2, and F(f) = 11. Give a Huffman code for the above set of frequencies, i.e. specify the binary encoding for each of the six characters.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT