C Array Test 1
1) In C, if we pass an array as an argument to a function, what actually get passed?
- Address of the last element of array
- Base address of the array
- Value of elements in array
- First element of the array
The correct option is (b).
In C language when we pass an array as a function argument, then the Base address of the array will be passed.
2) What will be the output of the below program?
- Strings are Equal
- No output
- Runtime error
- Compilation error
The correct option is (a).
In the program we are comparing the base address of ‘x’ and ‘y’ and they are not same.
Therefore the program has No output.
3) What will be the output of the below program?
- 5 9
- 9 20
- 2 9
- 2 5
The correct option is (c).
The strlen(x) function is used for finding the length of string ‘x’. In program the length of string is count of character upto ‘