What will be the output of the program ?
#include
int main()
{
char str[] = "peace";
char *s = str;
printf("%s\n", s++ +3);
return 0;
}
Answer: D
No answer description available for this question.
Enter details here
What will be the output of the following C code?
#include
int main()
{
int i = 97, *p = &i;
foo(&p);
printf("%d ", *p);
return 0;
}
void foo(int **p)
{
int j = 2;
*p = &j;
printf("%d ", **p);
}
Answer: A
No answer description available for this question.
Enter details here
How many number of pointer (*) does C have against a pointer variable declaration?
Answer: D
No answer description available for this question.
Enter details here
What is the output of the code below?
int main()
{
int i = 10;
int *const p = &i;
foo(&p);
printf("%d\n", *p);
}
void foo(int **p)
{
int j = 11;
*p = &j;
printf("%d\n", **p);
}
Answer: A
No answer description available for this question.
Enter details here
If the size of integer is 4bytes, What will be the output of the program?
#include
int main()
{
int arr[] = {12, 13, 14, 15, 16};
printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0]));
return 0;
}
Answer: B
No answer description available for this question.
Enter details here
What is the output of this C code?
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("q\n");
else
printf(" nullq\n");
}
Answer: A
No answer description available for this question.
Enter details here
Which of the following changes can correct the program so that it prints “Geeks Quiz”?
#include
void myStrcat(char *a, char *b)
{
int m = strlen(a);
int n = strlen(b);
int i;
for (i = 0; i <= n; i++)
a[m+i] = b[i];
}
int main()
{
char *str1 = "Geeks ";
char *str2 = "Quiz";
myStrcat(str1, str2);
printf("%s ", str1);
return 0;
}
Answer: A
No answer description available for this question.
Enter details here
What is the output of this C code?
void main()
{
int x = 0;
int *ptr = &x;
printf("%d\n", *ptr);
}
Answer:
Enter details here
How many bytes are occupied by near, far and huge pointers (DOS)?
Answer: A
near=2, far=4 and huge=4 pointers exist only under DOS. Under windows and Linux every pointers is 4 bytes long.
Enter details here
Which of the following is the correct syntax to send an array as a parameter to function?
Answer: A
No answer description available for this question.
Enter details here