main{
int x = {100, 200, 300};
printf("%d", *x +1);
}
Example
The correct option is (c).
Explanation:
In program *x refers to 100 and adding a 1 to *x gives 101.
Therefore the output is 101.
## 7) In the below statement, what does the "arr" indicates?
char *arr[20];
Example
- arr is an array of 20 characters
- arr is an array of 20 character pointers
- arr is an array of function
- arr is a pointer to an array
The correct option is (b).
Explanation:
The Square parenthesis signifies an array at declaration and the type is char *. So it is an array of character pointer.
Therefore "arr" is an array of 20 character pointers.
## 8) What will be the output of the below program?
include<stdio.h>
void main
{
char a = "C++";
printf("%s ",a);
a++;
printf("%s",a);
}
Example
- C++ ++
- ++ ++
- C++ C++
- Compile error
The correct option is (d).
Explanation:
In program 'a' refers to constant address and the constant address variable is not allowed to be incremented.
Therefore the program will generate compile error in output.
## 9) Which of the statements are correct about 5 used in the program?
int num[5];
num[5]=20;
Example
- In the first statement 5 specifies an array size, whereas in the second statement it specifies a particular element of array.
- In the first statement 5 specifies a particular element, whereas in the second statement it specifies a array size.
- In the first statement 5 specifies a particular element, whereas in the second statement it specifies a type.
- In both the statement 5 specifies array size.
The correct option is (a).
Explanation:
The declaration int num[5]; indicates the array's size, while num[5]=20; specifies the value of the sixth element in the array.
Therefore, in the initial statement, 5 denotes the size of an array, while in the subsequent element, it indicates a specific element within the array.
## 10) Which of the below statements using the name of an array does not yield the base address?
- When array name is operand of the & operator
- When array name is passed to scanf() function
- When array name is passed to printf() function
- When array name is used with the sizeof operator.
- 1, 4
- 1, 3
The correct option is (a).
Explanation:
The first and fourth expressions do not return the starting address of an array. However, the printf() and scanf() functions do provide the base address of an array.