What is the output of the following piece of code?
public class array
{
public static void main(String args[])
{
int []arr = {1,2,3,4,5};
System.out.println(arr[2]);
System.out.println(arr[4]);
}
}
Answer: A
Array indexing starts from 0.
Enter details here
applications of a multidimensional array
Answer: D
No answer description available for this question.
Enter details here
Consider an array consisting of –ve and +ve numbers. What would be the worst case time complexity of an algorithm to segregate the numbers having same sign altogether i.e all +ve on one side and then all -ve on the other ?
Answer: A
No answer description available for this question.
Enter details here
Which of the following statements are correct about 6 used in the program?
int num[6];
num[6]=21;
Answer: B
No answer description available for this question.
Enter details here
The parameter passing mechanism for an array is
Answer: C
No answer description available for this question.
Enter details here
What is the maximun number of dimensions an array in C may have?
Answer: D
The maximum size of an array is determined by the amount of memory that a program can access. On a 32-bit system, the maximum amount of memory that can be addressed by a pointer is 2^32 bytes which is 4 gigabytes. The actual limit may be less, depending on operating system implementation details.
Enter details here
Predict the output of below code:
#include
int main()
{
int arr[1]={10};
printf("%d\n", 0[arr]);
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
What will be the size of above array element ?
int a[20]
Answer: C
No answer description available for this question.
Enter details here
The following program
main()
{
static char a[3][4] = {"abcd", "mnop", "fghi"};
putchar(**a);
}
Answer: D
*a points to the string "abcd".**a is the first character of "abcd", which is the character 'a '
Enter details here
Pick out the output
#include
int main()
{
foo(ary);
}
void foo(int **ary)
{
int i = 10, k = 10, j = 2;
int *ary[2];
ary[0] = &i;
ary[1] = &j;
printf("%d\n", ary[0][1]);
}
Answer: D
No answer description available for this question.
Enter details here