Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: Pointers

Home > C Programming > Pointers > General Questions

41. What will be the result of the following program?

#include
void print(char *p);
int main()
{
char s[] = "T.C.S", *A;
print(s);
return 0;
}
void print(char *p)
{
while (*p != '\0')
{
if (*p != '.')
printf ("%c", *p);
p++;
}
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  TCS

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  TCS

43. struct adr {
char *name;
char *city;
int zip;
};
struct adr *adradr;

Which are valid references?

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  TCS

44. #include
void print(char *p);
int main()
{
char s[] = "T.C.S", *A;
print(s);
return 0;
}
void print(char *p)
{
while (*p != '\0')
{
if (*p != ".")
printf ("%c", *p);
p++;
}
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

45. #include
void print(char *p);
int main()
{
char s[] = "T.C.S", *A;
print(s);
return 0;
}
void print(char *p)
{
while (*p != '\n')
{
if (*p != '.')
printf ("%c", *p);
p++;
}
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

46. p and q are pointers to the same type of data items.

Which of these are valid?
(i) *(p+q)
(ii) *(p-q)
(iii) *p - *q

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

47. What will be output of following c program?

int main()
{
char *name = "name";
change (name);
printf ("%s", name);
return 0;
}
change (char *name)
{
char *nm = "newname";
name = nm;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

48. Which are valid?

(i) pointers can be added.
(ii) pointers can be subtracted.
(iii) integers can be added to pointers.

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

49. What is the output of this C code?

#include
int main()
{
int i=12;
int *p =&i;
printf("%d\n",*p++);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Capgemini

50. What is the output of the following 'C' program ?

#include
int main()
{
int *ptr1,*ptr2;
ptr1=(int *)malloc(sizeof(int));
ptr2=func(20,10,ptr1);
printf("%d %d\n",*ptr1,*ptr2);
}

int *func(int a, int b, int *c)
{
int x=a+b;
*c=a-b;
return(&x);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

there is bug in the code :

i.e after the execution of the func, the space allocated to it into the stack will be freed up after its completion where func is trying to send the address of the variable x which is declared inside the func and after dellocating its stack space there will no x be present at the location which is being returned by the func.

hence there is bug in the code.

Workspace


Tags:  Global Edge