Javatpoint Logo
Javatpoint Logo

C Pointers Test 2


6) What will be the output of a program?

  1. Hello
  2. olleH
  3. ello llo lo o
  4. Hello ello llo lo o

The correct option is (c).

Explanation:

As C-Language is machine dependent language. Therefore it will give different output in other platforms (depending upon machine and compiler).

If we execute and compile this program in Windows platform using Turbo C, then it will give output "ello llo lo o".

If we execute and compile this program in Linux platform using GCC Compiler, then it will give output "Hello ello llo lo o".

7) How many bytes are occupied by far, near and huge pointers in DOS (Disk Operating System)?

  1. near=4 far=8 huge=8
  2. near=4 far=4 huge=8
  3. near=2 far=4 huge=4
  4. near=2 far=4 huge=8

The correct option is (c).

Explanation:

Under Linux and Windows every pointer is 4 bytes long.

Under DOS the value of near, far and huge pointer is:

  • near=2
  • far=4
  • huge=4

8) What will be the output of a program?

  1. **j=b
  2. j=&b
  3. *j=&b
  4. &j=*b

The correct option is (c).

Explanation:

In normal pointer assignment, when function (fun()) is called it's received as (j), so whatever operation performed on j will be returned at i in main.

After the function call,

Therefore the address of (b) get stored in (i) when we use statement *j=&b.

9) The below program reports an error on compilation.

  1. True
  2. False

The correct option is (b).

Explanation:

There is no error on compilation of the program in GCC under Linux and Turbo C under DOS.

The output of the program is 12.000000.

10) Are the three declarations char **ball, char *ball[], and char ball[][] same?

  1. True
  2. False

The correct option is (b).

Explanation:

No, the three declarations char **ball, char *ball[], and char ball[][] are different.

char **ball - It is a double pointer

char *ball[] -It is an array of pointers

char ball[][]-It is 2-d array.





Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA