C Language - Pointers

You Are Here :: Home > C Language > Pointers - General Questions

 
31.

What will be output if you will execute following code?

#include
int display();
int(*array[3])();
int(*(*ptr)[3])();
int main(){
array[0]=display;
array[1]=getch;
ptr=&array;
printf("%d",(**ptr)());
(*(*ptr+1))();
return 0;
}
int display(){
int x=5;
return x++;
}

A. 3 B. 5
C. 6 D. 7




32.

What will be output if you will execute following code?

#include
int main(){
char *array[4]={"c","c++","java","sql"};
char *(*ptr)[4]=&array;
printf("%s ",++(*ptr)[2]);
return 0;
}

A. c B. java
C. ava D. jav




33.

What will be output if you will execute following code?

#include
int main(){
static char *s[3]={"math","phy","che"};
typedef char *( *ppp)[3];
static ppp p1=&s,p2=&s,p3=&s;
char * (*(*array[3]))[3]={&p1,&p2,&p3};
char * (*(*(*ptr)[3]))[3]=&array;
p2+=1;
p3+=2;
printf("%s",(***ptr[0])[2]);
return 0;

A. math B. phy
C. che D. math che




34.

What will be output if you will execute following code?

#include
#define int int*
int main(){
int *p,q;
p=(int *)5;
q=10;
printf("%d",q+p);
return 0;
}

A. 10 B. 15
C. 20 D. 25




35.

#include

main()
{
int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };
int *p,*q;
p=&a[2][2][2];
*q=***a;
printf("%d----%d",*p,*q);
}

A. Compile time error B. 22222222
C. Can't be determined D. SomeGarbageValue




36.

#include

int main(){
const array[2][3][3]={0,1,2,3,4,5,6,7,8,9,10,11,12};
int const (*ptr)[2][3][3]=&array;
printf("%d",*(*(*ptr)[1]+2));
return 0;
}

A. 9 B. 10
C. 11 D. 12




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



© 2013 freshersindia.in ® | Copyrights | Terms & Conditions
   Designed by Freshers India
Catch Us on