Home » C Array Test 1

C Array Test 1


1) In C, if we pass an array as an argument to a function, what actually get passed?

  1. Address of the last element of array
  2. Base address of the array
  3. Value of elements in array
  4. First element of the array

The correct option is (b).

Explanation:

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?

  1. Strings are Equal
  2. No output
  3. Runtime error
  4. Compilation error

The correct option is (a).

Explanation:

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?

  1. 5 9
  2. 9 20
  3. 2 9
  4. 2 5

The correct option is (c).

Explanation:

The strlen(x) function is used for finding the length of string ‘x’. In program the length of string is count of character upto ‘

You may also like