Question 31
# include <stdio.h>
int main ()
{
int i, j;
char a [2] [3] = {{\'a\', \'b\', \'c\'}, {\'d\', \'e\', \'f\'}};
char b [3] [2];
char *p = *b;
for (i = 0; i < 2; i++) {
for (j = 0; j < 3; j++) {
*(p + 2*j + i) = a [i] [j];
}
}
}
/* Add code here. Remove these lines if not writing code */
Question 32
Question 33
A one dimensional array A has indices 1....75. Each element is a string and takes up three memory words. The array is stored at location 1120 decimal. The starting address of A[49] is
Question 35
For the following declaration of a function in C, pick the best statement
int [] fun(void (*fptr)(int *));
Question 36
In C, 1D array of int can be defined as follows and both are correct.
int array1D[4] = {1,2,3,4};
int array1D[] = {1,2,3,4};
But given the following definitions (along-with initialization) of 2D arrays
int array2D[2][4] = {1,2,3,4,5,6,7,8}; /* (i) */
int array2D[][4] = {1,2,3,4,5,6,7,8}; /* (ii) */
int array2D[2][] = {1,2,3,4,5,6,7,8}; /* (iii) */
int array2D[][] = {1,2,3,4,5,6,7,8}; /* (iv) */
Pick the correct statements.
Question 37
The following function computes the maximum value contained in an integer array p[] of size n (n >= 1)
int max(int *p, int n)
{
int a=0, b=n-1;
while (__________)
{
if (p[a] <= p[b])
{
a = a+1;
}
else
{
b = b-1;
}
}
return p[a];
}
The missing loop condition is
There are 37 questions to complete.