49. | main() {
char string[]="Hello World";
display(string);
}
void display(char *string)
{
printf("%s",string);
}
|
|||||||
|
50. | Which of the following correctly initializes an array arr to contain four elements each with value 0? I int [] arr = {0, 0, 0, 0};
II int [] arr = new int [4];
III int [] arr = new int [4];
for (int i = 0; i < arr. length; i ++)
arr [i] = 0;
|
|||||||
|
51. | What will be the output of the program if the array begins 1200 in memory? #include
int main()
{
int arr[]={2, 3, 4, 1, 6};
printf("%u, %u, %u\n", arr, &arr[0], &arr);
return 0;
}
|
|||||||
|
52. | the following program segment is intended to find the index of the first negative integer in arr [0] ... arr [ N-1], where arr is an array of N integers. int i = 0;
while (arr [i] >= 0)
{
i++;
}
location = i ;
This segment will work as intended
|
|||||||
|
53. | What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u\n", a+1, &a+1);
return 0;
}
|
|||||||
|
54. | Refer to the following code segment. You may asume that arr is an array of integers. int sum = arr [0], i = 0;
while (i < arr. length)
{
i++;
sum+= arr [i];
}
Which of the following will be the resul of executing the segment?
|
|||||||
|
« previous
1
2
3
4
5
6
8
9
...next »