1.  Given the piece of code
int a[50];
int *pa;
pa=a;
To access the 6th element of the array which of the following is incorrect ?


*(a+5)
a[5]
pa[5]
*(*pa+5)


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  What is the effect of the following code?
main()
{
int a[4]={1,5};
printf(‘’%d’’,a[3]);
}


0.
Syntax error because of improper
5
Syntax error because of invalid


Answer

 Option

Given that int a[4]={1,5} So a[2], a[3] etc. are 0

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  Which of the following statements are correct about an array ?
1. The array int num[26]; can store 26 elements.
2. The expression num[1] designates the very first element in the array.
3. It is necessary to initialize the array at the time of declaration.
4. The declaration num[SIZE] is allowed if SIZE is a macro.


1
1, 4
2, 3
2, 4


Answer

 Option

1. The array int num[26]; can store 26 elements. This statement is true. 2. The expression num[1] designates the very first element in the array. This statement is false, because it designates the second element of the array. 3. It is necessary to initialize the array at the time of declaration. This statement is false. 4. The declaration num[SIZE] is allowed if SIZE is a macro. This statement is true, because the MACRO just replaces the symbol SIZE with given value. Hence the statements '1' and '4' are correct statements.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  Which of the following statements mentioning the name of the array begins DOES NOT yield the base address ?
1. when array name is used with the sizeof operator
2. when array name is operand of the & operator
3. when array name is passed to scanf() function
4.when array name is passed to printf() function


1
1, 2
2
2, 4


Answer

 Option

The statement 1 and 2 does not yield the base address of the array. While the scanf() and printf() yields the base address of the array.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  What is the index number of the last element of an array with 29 elements ?


29
28
0.
Programmer-defined


Answer

 Option

No answer description available for this question.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report