0% found this document useful (0 votes)
57 views7 pages

OUTPUT BASED QUESTIONS-Sheet-1

Output based placement questions btech
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)
57 views7 pages

OUTPUT BASED QUESTIONS-Sheet-1

Output based placement questions btech
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/ 7

OUTPUT BASED QUESTIONS

1.
#include<stdio.h>
int main()
{
int n;
for(n = 7; n!=0; n--)
printf("n = %d", n--);
getchar();
return 0;
}

2. #include<stdio.h>
int main()
{
printf("%x", -1<<1);
getchar();
return 0;
}

3. # include <stdio.h>
# define scanf "%s Geeks For Geeks "
main()
{
printf(scanf, scanf);
getchar();
return 0;
}

4. #include <stdlib.h>
#include <stdio.h>
enum {false, true};
int main()
{
int i = 1;
do
{
printf("%d\n", i);
i++;
if (i < 15)
continue;
} while (false);
getchar();
return 0;
}

5. #include <stdlib.h>
#include <stdio.h>
enum {false, true};
int main()
{
int i = 1;
do
{
printf("%d\n", i);
i++;
if (i < 15)
break;
} while (true);

getchar();
return 0;
}

6. char *getString()
{
char *str = "Nice test for strings";
return str;
}

int main()
{
printf("%s", getString());
getchar();
return 0;
}

7. #include<stdio.h>
char *getString()
{
char str[] = "Will I be printed?";
return str;
}
int main()
{
printf("%s", getString());
getchar();
}

8. #include<stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}

9. #include<stdio.h>
int main()
{
static int var = 5;
printf("%d ",var--);
if(var)
main();
}

10. #include<stdio.h>
int main()
{
int x;
printf("%d",scanf("%d",&x));
/* Suppose that input value given
for above scanf is 20 */
return 1;
}

11. void main ()

{
int x = 128;

printf ("n%d", 1 + x++);

}
12. #include <stdio.h>

int tmp=20;

main( ) {

printf("%d ",tmp);

func( );

printf("%d ",tmp);

func() {

static int tmp=10;

printf("%d ",tmp);

13. main() {

int a = 10;

if ((fork ( ) == 0))

a++;

printf ("%dn", a );

}
14. #include <stdio.h>

main( ) {

int i;
for ( i=0; i<5; i++ ) {

int i = 10;

printf ( " %d", i );

i++;

return 0;

}
15. struct

int si;

double d;

float cp;

} s;

void

main ()

printf ("%d, %d, %d", sizeof (s.si), sizeof (s.d), sizeof (s.cp));

16. int main ()

int a, b;

a = b = 4;

b = a++;
printf ("%d %d %d %d", a++, --b, ++a, b--);

17. int main ()

int a[4] = { 25, 16 };

printf ("%d %d", a[0] & a[1], a[1] | a[2]);

18. int main ()

static int num = 8;

printf ("%d", num = num - 2);

if (num != 0)

main ();

19. How many times "Placement Question" will print.

int main()

int x;

for(x=-1; x<=10; x++)

if(x < 5)
continue;

else

break;

printf("Placement Question");

return 0;

20. int main()

printf("%d%d%d", sizeof(3.14f), sizeof(3.14l));

You might also like