Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged interview
0
votes
1
answer
61
Prog \ What is the output of the following program?
#include<stdio.h> int main() { int a = 5; int b = ++a * a++; printf("%d ",b); return 0; } (a) 25 (b) 30 (c) 36 (d) Undefined Behavior
#include<stdio.h int main() { int a = 5; int b = ++a * a++; printf("%d ",b); return 0; }(a) 25 (b) 30 (c) 36 (d) Undefined Behavior
Desert_Warrior
2.4k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
2
answers
62
Prog \ What is the output of the following program? tricky question
#include<stdio.h> int main() { int a = 5; switch(a) { default: a = 4; case 6: a--; case 5: a = a+1; case 1: a = a-1; } printf("%d \n",a); return 0; } (a) 5 (b) 4 (c) 3 (d) None of these
#include<stdio.h int main() { int a = 5; switch(a) { default: a = 4; case 6: a ; case 5: a = a+1; case 1: a = a-1; } printf("%d \n",a); return 0; }(a) 5 (b) 4 (c) 3 (d) N...
Desert_Warrior
8.9k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
output
programming-in-c
interview
+
–
7
votes
1
answer
63
Prog \ What is the output of the following program?
#include <stdio.h> void f(char**); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char **p) { char *t; t = (p += sizeof(int ... \n", t); } (a) ab (b) cd (c) ef (d) gh In GATE Exam, if not specified What should be size of integer?
#include <stdio.h void f(char ); int main() { char *argv[] = { "ab", "cd", "ef", "gh", "ij", "kl" }; f(argv); return 0; } void f(char p) { char *t; t = (p += sizeof(int)...
Desert_Warrior
1.3k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
pointers
interview
+
–
0
votes
1
answer
64
Prog / What is the output of the following program?
#include<stdio.h> int main() { char c=125; c=c+10; printf("%d",c); return 0; } (a) 135 (b) +INF (c) -121 (c) -8
#include<stdio.h int main() { char c=125; c=c+10; printf("%d",c); return 0; }(a) 135 (b) +INF (c) -121 (c) -8
Desert_Warrior
5.2k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
1
answer
65
Prog \ What is the output of the following program?
#include<stdio.h> int main() { int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater"); else printf("Lesser"); return 0; } (a) Equal (b) Greater (c) Lesser (d) Compile Error
#include<stdio.h int main() { int i=10; static int x=i; if(x==i) printf("Equal"); else if(x>i) printf("Greater"); else printf("Lesser"); return 0; }(a) Equal (b) Greater ...
Desert_Warrior
1.6k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
1
answer
66
Prog \ Predict the output.
#include <stdio.h> int main() { int i = 3; int j; j = sizeof(++i + ++i); printf("i=%d j=%d\n", i, j); return 0; } (a) i=4 j=4 (b) i=3 j=4 (c) i=5 j=4 (d) the behavior is undefined
#include <stdio.h int main() { int i = 3; int j; j = sizeof(++i + ++i); printf("i=%d j=%d\n", i, j); return 0; }(a) i=4 j=4 (b) i=3 j=4 (c) i=5 j=4 (d) the behavior is un...
Desert_Warrior
2.7k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
1
answer
67
Prog\ What is the output of the following program?
#include<stdio.h> int a = 10; int main() { fun(); fun(); return 0; } int fun() { static int a = 1; printf("%d ",a); a++; return 0; }
#include<stdio.h int a = 10; int main() { fun(); fun(); return 0; } int fun() { static int a = 1; printf("%d ",a); a++; return 0; }
Desert_Warrior
521
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
output
interview
+
–
0
votes
1
answer
68
Prog \ What is the output of the following program?
#include<stdio.h> #include<stdlib.h> int main() { char s[] = "Opendays2012"; int i = 0; while(*(s++)) i++; printf("%d",i); return 0; } (a) Segmentation Fault (b) Compile Error (c) 12 (d) 0
#include<stdio.h #include<stdlib.h int main() { char s[] = "Opendays2012"; int i = 0; while(*(s++)) i++; printf("%d",i); return 0; }(a) Segmentation Fault (b) Compile Err...
Desert_Warrior
604
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
pointers
output
interview
array
+
–
1
votes
1
answer
69
Programming \ What is the output of the following program?
#include<stdio.h> void foo(char *); int main() { char *string = "Hello"; foo(string); printf("%s",string); return 0; } void foo(char *a) { while(*a) { *a += 1; a++; } } (a) Hello (b) Ifmmp (c) Compile Error (d) Segmentation fault
#include<stdio.h void foo(char *); int main() { char *string = "Hello"; foo(string); printf("%s",string); return 0; } void foo(char *a) { while(*a) { *a += 1; a++; } }(a)...
Desert_Warrior
2.0k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
pointers
+
–
0
votes
0
answers
70
Programming \ What is the output of the following program?
#include <stdio.h> void foo(int[][3]); int main(void) { int a[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; foo(a); printf("%d\n", a[2][1]); return 0; } void foo(int b[][3]) { ++b; b[1][1] = 9; } (a) 8 (b) 9 (c) 7 (d) none of the above
#include <stdio.h void foo(int[][3]); int main(void) { int a[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; foo(a); printf("%d\n", a ); return 0; } void foo(int b[][3]) { ...
Desert_Warrior
600
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
array
+
–
0
votes
1
answer
71
Programming \ What is the output of the following program?
#include <stdio.h> int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; } options are : (a) Compile Error (b) 2 1 (c) 2 5 (d) none of the above
#include <stdio.h int main(void) { char a[5] = { 1, 2, 3, 4, 5 }; char *ptr = (char*)(&a + 1); printf("%d %d\n", *(a + 1), *(ptr - 1)); return 0; }options are : (a) Compi...
Desert_Warrior
397
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
pointers
+
–
0
votes
2
answers
72
Programming \ what is the output?
#include<stdio.h> int main() { int a[10][20][30]={0}; printf("%ld",&a+1 - &a); return 0; }
#include<stdio.h int main() { int a[10][20][30]={0}; printf("%ld",&a+1 - &a); return 0; }
Desert_Warrior
1.6k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
array
+
–
0
votes
2
answers
73
Programming \ What is the output of this Program ?
Prog 1 : #include<stdio.h> #include<string.h> void foo(char *); int main() { char a[100] = {0}; printf("%lu %lu",sizeof(a),strlen(a)); return 0; } Prog 2 #include<stdio.h> #include<string.h> int main() { char string[] = "Hello"; printf("%lu %lu",sizeof(string),strlen(string)); return 0; }
Prog 1 : #include<stdio.h #include<string.h void foo(char *); int main() { char a[100] = {0}; printf("%lu %lu",sizeof(a),strlen(a)); return 0; }Prog 2#include<stdio.h #in...
Desert_Warrior
2.0k
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
1
answer
74
Programming \ predict the output
#include<stdio.h> int main() { char str[] = {'a','b','c','\0'}; str[0] -= 32; printf("%s",str); return 0; }
#include<stdio.h int main() { char str[] = {'a','b','c','\0'}; str[0] -= 32; printf("%s",str); return 0; }
Desert_Warrior
467
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
output
interview
+
–
0
votes
2
answers
75
What does the following function do?
int foo( int a, int b) { int c = a-b; c = c&(0x80000000); return (!c)*a +(!!c)*b; }
int foo( int a, int b) { int c = a-b; c = c&(0x80000000); return (!c)*a +(!!c)*b; }
Desert_Warrior
827
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
interview
+
–
0
votes
0
answers
76
Programming \What is the following function doing ?
unsigned fun(unsigned int a) { unsigned int i, x = 0, y = 0, z = 0; for(i = 0; i < 16; i++) { y <<= 2; y += !!(a & 0x80000000) << 1; y += !!(a & 0x40000000); a <<= 2; x = x + (x&1); x <<= 1; z <<= 1; if(x + 1 <= y) { x++; z++; y-=x; } } return z; }
unsigned fun(unsigned int a) { unsigned int i, x = 0, y = 0, z = 0; for(i = 0; i < 16; i++) { y <<= 2; y += !!(a & 0x80000000) << 1; y += !!(a & 0x40000000); a <<= 2; x =...
Desert_Warrior
451
views
Desert_Warrior
asked
May 16, 2016
Programming in C
programming-in-c
interview
+
–
Page:
« prev
1
2
3
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register