Question 1 of 25
Hints left: 3
Q1
Determine Output: void main() { int i=5, j=6, z; printf("%d", i+++j); }
Q2
Determine Output: void main() { char not; not = !2; printf("%d", not); }
Q3
Determine Output: #define prod(a,b) a*b void main() { int x=3, y=4; printf("%d", prod(x+2, y-1)); }
Q4
Determine Output: void main() { int i=-1, j=-1, k=0, l=2, m; m = i++ && j++ && k++ || l++; printf("%d %d %d %d %d", i, j, k, l, m); }
Q5
Determine Output: void main() { static int i=5; if(--i){ main(); printf("%d ", i); } }
Q6
In the absence of a exit condition in a recursive function, the following error is given . . . . . . . .
Q7
What is the output of this C code? #include <stdio.h> main() { if (sizeof(int) > -1) printf("True"); else printf("False"); }
Q8
Determine Output: #include<stdio.h> void main() { register i=5; char j[]= "hello"; printf("%s %d", j, i); }
Q9
Determine Output: #include<stdio.h> void main() { char s[]={'a','b','c','n','c','\0'}; char *p, *str, *str1; p=&s[3]; str=p; str1=s; printf("%c", ++*p + ++*str1-32); }
Q10
What will be the value of the following assignment expression? (x = foo())!= 1 considering foo() returns 2
Q11
Determine Output: void main() { int c[] = {2.8,3.4,4,6.7,5}; int j, *p=c, *q=c; for(j=0;j<5;j++){ printf(" %d ", *c); ++q; } for(j=0;j<5;j++){ printf(" %d ", *p); ++p; } }
Q12
Determine Output: void main() { static int i=i++, j=j++, k=k++; printf("%d %d %d", i, j, k); }
Q13
Determine Output: void main() { char *str1 = "abcd"; char str2[] = "abcd"; printf("%d %d %d", sizeof(str1), sizeof(str2), sizeof("abcd")); }
Q14
Suppose we have: int a=100; (signed by default). If we want to convert this to an unsigned long integer, we can do this by making the following small change:
Q15
Determine Output: void main() { int i=i++, j=j++, k=k++; printf("%d %d %d", i, j, k); }
Q16
Determine Output: void main() { char p[]="%dn"; p[1] = 'c'; printf(p, 65); }
Q17
Determine Output: void main() { int a[] = {10,20,30,40,50}, j, *p; for(j=0; j<5; j++){ printf("%d" ,*a); a++; } p = a; for(j=0; j<5; j++){ printf("%d" ,*p); p++; } }
Q18
Determine Output: void main() { int i = abc(10); printf("%d", --i); } int abc(int i) { return(i++); }
Q19
Determine Output: void main() { int i; char a[]="�"; if(printf("%sn", a)) printf("Ok here n"); else printf("Forget itn"); }
Q20
Determine Output: void main() { char a[]="12345"; int i = strlen(a); printf("%d", ++i); }
Q21
Determine Output: void main() { static char *s[] = {"black", "white", "yellow", "violet"}; char **ptr[] = {s+3, s+2, s+1, s}, ***p; p = ptr; ++p; printf("%s",*--*++p + 3); }
Q22
Determine Output: void main() { char *p; p="%d\n"; p++; p++; printf(p-2, 300); }
Q23
Determine Output: void main() { int i=0, j=0; if(i && j++) printf("%d..%d", i++, j); printf("%d..%d", i, j); }
Q24
What will be the output of the following C code? #include<stdio.h> main() { int n; n=f1(4); printf("%d",n); } f1(int x) { int b; if(x==1) return 1; else b=x*f1(x-1); return b; }
Q25
Determine Output: void main() { int i = -1; +i; printf("i = %d, +i = %d", i, +i); }