[go: up one dir, main page]

0% found this document useful (0 votes)
27 views12 pages

Predict Output Questions C

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)
27 views12 pages

Predict Output Questions C

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/ 12

Predict the Output - 30 Questions in C Programming

1.
```c
#include<stdio.h>
int main() {
int x = 5;
printf("%d", x++);
return 0;
}
```

2.
```c
#include<stdio.h>
int main() {
int a = 10, b = 20;
printf("%d", a > b ? a : b);
return 0;
}
```

3.
```c
#include<stdio.h>
int main() {
int x = 0;
if(x)
printf("True");
else
printf("False");
return 0;
}
```

4.
```c
#include<stdio.h>
int main() {
int a = 5;
printf("%d %d", a++, ++a);
return 0;
}
```

5.
```c
#include<stdio.h>
int main() {
char ch = 'A';
printf("%c %d", ch, ch);
return 0;
}
```

6.
```c
#include<stdio.h>
int main() {
int a = 5, b = 10;
printf("%d", a + b++);
return 0;
}
```

7.
```c
#include<stdio.h>
int main() {
int x = 5;
printf("%d", printf("%d", x));
return 0;
}
```

8.
```c
#include<stdio.h>
int main() {
int arr[3] = {1, 2, 3};
printf("%d", arr[1]);
return 0;
}
```
9.
```c
#include<stdio.h>
int main() {
int x = 10;
printf("%d", x / 2 * 3);
return 0;
}
```

10.
```c
#include<stdio.h>
int main() {
int a = 5;
printf("%d", a += 10);
return 0;
}
```

11.
```c
#include<stdio.h>
int main() {
int arr[] = {10, 20, 30};
printf("%d", sizeof(arr) / sizeof(arr[0]));
return 0;
}
```

12.
```c
#include<stdio.h>
int main() {
char str[] = "Hello";
printf("%s", str + 2);
return 0;
}
```

13.
```c
#include<stdio.h>
int main() {
int x = -1;
printf("%u", x);
return 0;
}
```

14.
```c
#include<stdio.h>
int main() {
float a = 5.0 / 2;
printf("%.1f", a);
return 0;
}
```

15.
```c
#include<stdio.h>
int main() {
char ch = 'B';
ch++;
printf("%c", ch);
return 0;
}
```

16.
```c
#include<stdio.h>
int main() {
int x = 5, y = 10;
printf("%d", x * y / x + y);
return 0;
}
```

17.
```c
#include<stdio.h>
int main() {
int a = 10, b = 20, c;
c = a, b;
printf("%d", c);
return 0;
}
```

18.
```c
#include<stdio.h>
int main() {
int a = 5, b = 10;
printf("%d", a > b && b++);
printf("%d", b);
return 0;
}
```

19.
```c
#include<stdio.h>
int main() {
int x = 5;
if(x = 0)
printf("Hello");
else
printf("World");
return 0;
}
```

20.
```c
#include<stdio.h>
int main() {
int x = 1;
switch(x) {
case 0: printf("Zero");
case 1: printf("One");
case 2: printf("Two");
}
return 0;
}
```

21.
```c
#include<stdio.h>
int main() {
int a = 5;
printf("%d %d", a++, ++a);
return 0;
}
```
22.
```c
#include<stdio.h>
int main() {
int a = 5, b = 10;
printf("%d", a++ + ++b);
return 0;
}
```

23.
```c
#include<stdio.h>
int main() {
int a = 5;
if(a = 0)
printf("False");
else
printf("True");
return 0;
}
```

24.
```c
#include<stdio.h>
int main() {
int a = 5;
if(a > 0) {
int b = 10;
printf("%d", b);
}
return 0;
}
```

25.
```c
#include<stdio.h>
int main() {
int x = 5, y = 10;
printf("%d", x % y);
return 0;
}
```

26.
```c
#include<stdio.h>
int main() {
int x = 5, y = 2;
printf("%d", x / y);
return 0;
}
```
27.
```c
#include<stdio.h>
int main() {
int a = 5, b = 3;
printf("%d", a << b);
return 0;
}
```

28.
```c
#include<stdio.h>
int main() {
char str[] = "Hello";
printf("%c", str[1]);
return 0;
}
```

29.
```c
#include<stdio.h>
int main() {
int a = 10, b = 5;
printf("%d", a / b + b);
return 0;
}
```

30.
```c
#include<stdio.h>
int main() {
int x = 10, y = 0;
printf("%d", x && y);
return 0;
}
```

You might also like