C Interview Questions 71-80

This post contains 71-80 questions of c program. It will helpful to solve c aptitude questions, c quiz , c objective type questions etc in interview.

71-80 Questions

Q1:

If a two dimensional array is used as a formal parameter, then 
a) both the subscripts may be left empty 
b) the first( row) subscript may be left empty
c) the first subscript must be left empty 
d) both the subscripts must be left empty
Answer:

Q2:

If storage class is missing in the array definition, by default it will be taken to be
a) automatic 
b) external 
c) static
Answer:

Q3:

Consider the declaration 
static char hello[]="hello"; 
The output of 
    printf("%s\n",hello);
will be the same as that of 
a) puts( "hello"); 
b) puts(hello); 
c) printf("%s\n","hello"); 
d) puts("hello\n");
Answer:

Q4:

The array name can be pointer to 
a) another array 
b) another variable 
c) to that array only 
d) none
Answer:

Q5:

Array of pointers to table of strings saves 
a) time 
b) memory 
c) CPU utilization 
d) none of the above
Answer:

Q6:

The following program
main()
{
    inc(); 
    inc(); 
    inc();
}
inc()
{
    static int x;
    printf("%d",++x);
} 
prints
a) 0 1 2 
b) 1 2 3 
c) 3 consecutive, but unpredictable numbers 
d) 1 1 1
Answer:

Q7:

main()
{
    int c[ ]={2.8,3.4,4,6.7,5};
    int j,*p=c,*q=c;
    for(j=0;j<5;j++) {
        printf(" %d ",*c);
        ++q; 
    }
    for(j=0;j<5;j++){
        printf(" %d ",*p);
        ++p; 
    }
}
Answer:
2 2 2 2 2 2 3 4 6 5

Q8:

main()
{
    char *p="hai friends",*p1;
    p1=p;
    while(*p!='\0') ++*p++;
    printf("%s %s",p,p1);
}
Answer:
ibj!gsjfoet

Q9:

void main()
{
    char far *farther,*farthest;
    printf("%d..%d",sizeof(farther),sizeof(farthest));
}
Answer:
4..2

Q10:

main()
{
    char *p;
    p="Hello";
    printf("%c\n",*&*p);
}
Answer:
H

 

Leave a Reply

Your email address will not be published. Required fields are marked *