TCS
Company
Programming
Arrays
Which of the following statements are correct about 6 used in the program?
int num[6];
num[6]=21;
A)In the first statement 6 specifies a particular element , whereas in the second statement it specifies a array size. B)In both the statements 6 specifies array size C)In the first statement 6 specifies a array size, whereas in the second statement it specifies a particular element of array. D)In the first statement 6 specifies a particular element, whereas in the second statement it specifies a type.
Read Solution (Total 11)
-
- C.
While initializing an array size is written under square brackets so in the first line i.e. int num[6];, 6 is representing the size of the array and in the second line value is being assigned to the 6th element of the array. so there 6 is representing the element. - 3 years agoHelpfull: Yes(6) No(0)
- In C language the first line shows declaration and the second line defines the 6th element assigned as 21.
Option C is correct - 4 years agoHelpfull: Yes(1) No(0)
- Option C is correct as num[6] indicates the size of some Array , where as if we write num[6] = 21 ; ,
That means we are assigning 21 to the 6th position of some array . - 3 years agoHelpfull: Yes(1) No(0)
- c :
Because,
In the first statement 6 are available under the square bracket[6] ,it specifies the size of an array here nam is an integer type array variable and in the second statement it show the storing value of 6th index location in an array. - 3 years agoHelpfull: Yes(0) No(0)
- first line defines that the array declared is of int data type with an array size of 6 and the second line indicates that the in the index position of 6 which means 7th element should be 21
- 3 years agoHelpfull: Yes(0) No(0)
- Option : c
- 3 years agoHelpfull: Yes(0) No(0)
- Option c
1st line is defining array size
2nd line is specifying a special element. - 3 years agoHelpfull: Yes(0) No(0)
- second line isn't valid as array size remain fixed there can't be 7th element
all options incorrect - 3 years agoHelpfull: Yes(0) No(0)
- I think option c is correct.
- 3 years agoHelpfull: Yes(0) No(0)
- c. In first statement it specifies an array size and in second it specifies perticular element in that array
- 1 year agoHelpfull: Yes(0) No(0)
- C option is correct here . In the first statement the array is declared . and in second statement the assignation is held.
- 8 Months agoHelpfull: Yes(0) No(0)
TCS Other Question