Programming - C++ Language

You Are Here :: Home > C++ Language > Arrays - General Questions

 
37.

Consider the following declaration:
char str[16];
What is the length of the largest string that can be properly stored in str?                         


A. 15 B. 16
C. 17 D. None of these




38.

The string "Welcome" is to be stored in the character array str. What should be the minimum size of str?                         


A. 7 B. 8
C. 10 D. None of these




39.

Suppose that alpha is a character array of size 20. Which of the following statements is valid in C++?
(i) cin>>alpha;
(ii) strcpy(alpha, "Fair");
(iii) alpha[0] = 'C';                         


A. Only (i) B. Only (ii)
C. Only (iii) D. All (i), (ii), and (iii)




40.

Suppose that nameStr is a character array of size 21. Which of the following statements is valid in C++?
(i)
if(strcmp(nameStr, "Lisa") == 0)
cout<(ii)
if(nameStr[0] == 'L')
cout<                        


A. Only (i) B. Only (ii)
C. Both (i) and (ii) D. None of these




41.

Suppose that str is a character array of size 51 and the input is: Cool Winter
Which of the following statements stores this string in str?
(i) cin.get(str,51);
(ii) cin>>str(51);                         


A. Only (i) B. Only (ii)
C. Both (i) and (ii) D. None of these




42.

Consider the following declaration.
char charArray[51];
char discard;
Suppose that the input is:Hello There! How are you?
What is the value of discard after the following statements execute?
cin.get(charArray,51);
cin.get(discard);                         


A. discard = ' ' (Space) B. discard = '!'
C. discard = '\n' D. None of these




« prev

1

2

3

4

5

6

7

8

9

next »

 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on