in Programming retagged by
141 views
0 votes
0 votes
Which of the following is/are true regarding the following code snippet?

1:int *p;

2:p = &q;

 

A)*p gives faster retrieval of information than q.

B)The size of p is same as size of int.

C)Only statement 2 gives an error.

D)In statement 1, * is used as a dereferencing operator.
in Programming retagged by
141 views

4 Comments

I just asked them and they provided a video solution  mentioning following reasons for all the options 

  1. TRUE because pointers have direct address of the respective stored variable in the memory so the retrieval is always faster.
  2.  FALSE because it not depends on what is the data type of pointer rather it depends on what is the data type of the variable to which it is pointing to and also on the architecture of the machine.
  3. TRUE , here they treated statement 2 separately and said that we can’t just store address of some variable in another variable if we assume it to be pointer then first it needs to be declared.
  4. FALSE , here * is not the dereferencing operator rather a referencing operator and it is just to declare that variable P is a pointer of type int.
0
0

@Pranavpurkar For your mental and technical health please avoid such questions and even more the explanations. 

1
1

yes sir!

0
0

Please log in or register to answer this question.