1.  The following program
main()
{
static char a[3][4] = {''abcd'', ''mnop'', ''fghi''};
putchar(**a);
}


will not compile successfully
results in run-time error
prints garbage
none of the above


Answer

 Option

*a points to the string "abcd".**a is the first character of "abcd", which is the character 'a '

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  For the following definition, which of the given option is correct?
int a[10];


a++;
a=a+1
*a++
*a[1]


Answer

 Option

*a+0 points to the a[0] location

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.  C does no automatic array bound checking. This is


True
False
C's asset
C's shortcoming


Answer

 Option

C does no array bound checking. Because of this, one can access fifth clement of an array that is declared to he of lesser size.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  Choose the correct statements


Stictly speaking C supports 1-dimesional arrays only
An array element may be an array by itself
Arrary elements need not occupy contiguous memory locations
Both (a) and (b)


Answer

 Option

C supports 1-dimensional arrays only. But, the array element can be an array by itself. Using this, one can simulate multi-dimensional arrays. Though at the user level, we use 2-dimen-sional arrays, the compiler interprets this as a 1-dimensional array, each of whose element is a 1-dimensional array. As a matter of fact, a declaration like char [3] [4] , will be interpreted as a 1-dimensional array of size 3 (rather than 4)—each element being a character array of length 4.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report