C Language - Functions

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

 
19.

What is the output of the following program?

main()
{
int x=20;
int y=10;
swap(x,y);
printf("%d %d",y,x+2);
}
swap(int x,int y)
{
int temp;
temp =x;
x=y;
y=temp;
}

A. 10,20 B. 20,12
C. 22,10 D. 10,22




20.

What will be the output of the program?

#include
#include
int main()
{
int i=0;
i++;
if(i<=5)
{
printf("careersadda");
exit(1);
main();
}
return 0;
}

A. Prints "careersadda" 5 times B. Function main() doesn't calls itself
C. Infinite loop D. Prints "careersadda"




21.

main()
{
printf("%p",main);
}

A. main B. 00
C. p D. Some address will be printed




22.

main()
{
clrscr();
}
clrscr();

A. 1 B. 0
C. Compiletime error D. No output/error




23.

If int is 2 bytes wide.What will be the output of the program?

#include
void fun(char**);
int main()
{
char *argv[] = {"ab", "cd", "ef", "gh"};
fun(argv);
return 0;
}
void fun(char **p)
{
char *t;
t = (p+= sizeof(int))[-1];
printf("%s\n", t);
}

A. ab B. cd
C. ef D. gh




24.

main()
{
int i;
printf("%d",scanf("%d",&i)); // value 10 is given as input here
}

A. 1 B. 0
C. 10 D. Compiletime error




« previous

1

2

3

4

5

6

7

8

9

...

next »

 
 
 



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