closepop
closepop

Would you like to submit the test?


C Language :

Pointers




1.
   What is (void*)0?

Representation of NULL pointer
Representation of void pointer
Error
None of above




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

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

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




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

stdio.h
stddef.h
stdio.h and stddef.h
math.h




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

near=2 far=4 huge=4
near=4 far=8 huge=8
near=2 far=4 huge=8
near=4 far=4 huge=8




5.
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?

.
#
&
->




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

((((a+i)+j)+k)+l)
*(*(*(*(a+i)+j)+k)+l)
(((a+i)+j)+k+l)
((a+i)+j+k+l)




7.
     A pointer is

A keyword used to create variables
A variable that stores address of an instruction
A variable that stores address of other variable
All of the above




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

*
&&
!!
$$




9.
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;
}

ink
ack
ite
let




10.
      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;
}

30
27
9
3




11.
    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;
}

mello
hello
hmello
none of the above




12.
   What will be the output of the program ?

#include

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

error
no output
k
%s










FreshersLive - No.1 Job site in India. Here you can find latest 2016 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.


FreshersLive - No.1 Job site in India. Here you can find latest 2016 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.