Pointers Questions and Answers updated daily – C Language



12 Pointers Questions and answers section with explanation for various online exam preparation, various interviews, C Language Pointers online test. Pointers Questions with detailed description, explanation will help you to master the topic.

Pointers Questions

1.
   What will be the output of the program ?

#include

int main()
{
    char *str;
    str = "%s";
    printf(str, "Kn");
    return 0;
}



SHOW ANSWER
Correct Ans:k
Explanation:


2.
    What will be the output of the program ?

#include

int main()
{
    char str[20] = "Hello";
    char *const p=str;
    *p='M';
    printf("%sn", str);
    return 0;
}



SHOW ANSWER
Correct Ans:mello
Explanation:


3.
      What will be the output of the program ?

#include

int main()
{
    int i=3, *j, k;
    j = &i;
    printf("%dn", i**j*i+*j);
    return 0;
}



SHOW ANSWER
Correct Ans:30
Explanation:


4.
What will be the output of the program ?

#include<stdio.h>

int main()
{
    static char *s[] = {"black", "white", "pink", "violet"};
    char **ptr[] = {s+3, s+2, s+1, s}, ***p;
    p = ptr;
    ++p;
    printf("%s", **p+1);
    return 0;
}



SHOW ANSWER
Correct Ans:ink
Explanation:


5. The operator used to get value at address stored in a pointer variable is



SHOW ANSWER
Correct Ans:*
Explanation:


6.      A pointer is



SHOW ANSWER
Correct Ans:A variable that stores address of other variable
Explanation:


7. What would be the equivalent pointer expression for referring the array element a[i][j][k][l]



SHOW ANSWER
Correct Ans:*(*(*(*(a+i)+j)+k)+l)
Explanation:


8. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?



SHOW ANSWER
Correct Ans:->
Explanation:


9. How many bytes are occupied by near, far and huge pointers (DOS)?



SHOW ANSWER
Correct Ans:near=2 far=4 huge=4
Explanation:
near=2, far=4 and huge=4 pointers exist only under DOS. Under windows and Linux every pointers is 4 bytes long.


10. In which header file is the NULL macro defined?



SHOW ANSWER
Correct Ans:stdio.h and stddef.h
Explanation:
The macro "NULL" is defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h, time.h, and wchar.h.


11.
Can you combine the following two statements into one?

char *p;
p = (char*) malloc(100);



SHOW ANSWER
Correct Ans:char *p = (char*)malloc(100);
Explanation:


12.    What is (void*)0?



SHOW ANSWER
Correct Ans:Representation of NULL pointer
Explanation:



FreshersLive - No.1 Job site in India. Here you can find latest 2017 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.