Programming - C++ Language

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

 
31.

Which of the following about arrays as parameters is true?
(i) Arrays are passed by reference only.
(ii) When we declare an array as a formal parameter we do not attach & after the data type of the array component.                         


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




32.

Suppose alpha is an array of 50 components. Which of the following about alpha is true?
(i) The base address of alpha is the address of alpha[0].
(ii) The base address of alpha is the address of alpha[1].                         


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




33.

Suppose that the array alpha is to be declared as a formal parameter in a function heading.Which of the following about alpha is true?
(i) You must specify the size of alpha in square brackets.
(ii) You cannot pass alpha by value.                         


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




34.

Which of the following correctly declares name to be a character array and stores "William" in it?
(i) char name[8] = "William";
(ii) char name[7] = "William";                         


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




35.

Consider the following declaration:
char str[15];
int j;
Which of the following statements stores "Blue Sky" into str?
(i) str = "Blue Sky";
(ii) str[15] = "Blue Sky";
(iii) strcpy(str, "Blue Sky");                         


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




36.

Consider the following declaration:
char name[16];
int j;
and the input is Samantha
Which of the following statements stores "Samantha" into str?
(i) cin>>name;
(ii)
for(j = 0; j < 8; j++)
cin>>name[j];
name[8] = '\0';                         


A. Only (i) B. Only (ii)
C. Both (i) and (ii) 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