0% found this document useful (0 votes)
76 views4 pages

C Twisters

Uploaded by

Akash Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views4 pages

C Twisters

Uploaded by

Akash Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TWISTERS

1. #include <stdio.h>
int num;
int function(int n)
{
int num = 10;
return num;
}

int main(void)
{
printf("%d %d\n", num, function(20));
return 0;
}

A. 10 0
B. 20 0
C. 0 10
D. 0 20

Answer: C
2. #include <stdio.h>
int no1 = 17, no2 = 71;

void swapping(void)
{
int temp = no2;
no2 = no1;
no1 = temp;
}
int main(void)
{
int no1 = 17, no2 = 71;
printf("%d %d ", no1 , no2);
swapping();
printf("%d %d\n", no1, no2);
return 0;
}

A. 17 17 17 17
B. 17 71 17 71
C. 71 17 71 17
D. 71 71 71 71

Answer: B
3. #include <stdio.h>
int sunbeam()
{
int a=3;
return a * a;
}
int main(void)
{
int a=3;
printf("%d ", sunbeam(a));
return 0;
}

A. 9
B. garbage
C. compiler error
D. runtime error

Answer: A
4. #include <stdio.h>

int testDemo(int, int);

int main(void)
{
int you = 64, me = 32;
int we = testDemo(you, me);
printf("%d %d %d\n", me, you, we);
return 0;
}
int testDemo(int me, int you)
{
me = me + you;
return me - you;
you = you - me;
return me + you;
}

A. 32 64 32
B. 64 64 32
C. 64 32 64
D. 32 64 64

Answer: D

You might also like