Question
main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Question Submitted By :: Guest
I also faced this Question!!
Rank
Answer Posted By
Re: main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Answer
# 1
a) 2, 2
Guest
Re: main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Answer
# 2
size of char is 1
and size of int is 2/4 depending on n-bit m/c
Lalitha
Re: main()
{
printf("%d, %d", sizeof('c'), sizeof(100));
}
a. 2, 2
b. 2, 100
c. 4, 100
d. 4, 4
Answer
# 3
@ guest
if we give sizeof(char) or
char ch;
sizeof(ch) the result is 1
and if we give sizeof('1)
sizeof('c') the result is 2/4
does it treat as AsCII value which is an interger?????
how come????
Lalitha
Other C Code Interview Questions
Question Asked @ Answers main()
{
int i=10,j=20;
j = i, j?(i,j)?i:j:j;
printf("%d %d",i,j);
} 1 Write a function to find the depth of a binary tree. Adobe 8 main()
{
char a[4]="HELLO";
printf("%s",a);
} 1 main()
{
int a=2,*f1,*f2;
f1=f2=&a;
*f2+=*f2+=a+=2.5;
printf("\n%d %d %d",a,*f1,*f2);
} 1 const int perplexed = 2;
#define perplexed 3
main()
{
#ifdef perplexed
#undef perplexed
#define perplexed 4
#endif
printf("%d",perplexed);
}
a. 0
b. 2
c. 4
d. none of the above HCL 1 plz send me all data structure related programs 1 main()
{
char *p = “ayqm”;
char c;
c = ++*p++;
printf(“%c”,c);
} 1 Write a routine that prints out a 2-D array in spiral order Microsoft 2 Given an array of characters which form a sentence of
words, give an efficient algorithm to reverse the order of
the words (not characters) in it.
Microsoft 7 #include<stdio.h>
main()
{
char s[]={'a','b','c','\n','c','\0'};
char *p,*str,*str1;
p=&s[3];
str=p;
str1=s;
printf("%d",++*p + ++*str1-32);
} 1 #include<stdio.h>
main()
{
struct xx
{
int x=3;
char name[]="hello";
};
struct xx *s=malloc(sizeof(struct xx));
printf("%d",s->x);
printf("%s",s->name);
} 1 main()
{
main();
} 1 Find your day from your DOB? Microsoft 12 char *someFun1()
{
char temp[ ] = “string";
return temp;
}
char *someFun2()
{
char temp[ ] = {‘s’, ‘t’,’r’,’i’,’n’,’g’};
return temp;
}
int main()
{
puts(someFun1());
puts(someFun2());
} 1 What is the hidden bug with the following statement?
assert(val++ != 0); 1 main()
{
extern int i;
i=20;
printf("%d",i);
} 1 void main()
{
int i=10, j=2;
int *ip= &i, *jp = &j;
int k = *ip/*jp;
printf(“%d”,k);
} 1 Write, efficient code for extracting unique elements from
a sorted list of array.
e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
Microsoft 10 void main()
{
if(~0 == (unsigned int)-1)
printf(“You can answer this if you know how values are
represented in memory”);
} 1 void main ()
{
int x = 10;
printf ("x = %d, y = %d", x,--x++);
}
a. 10, 10
b. 10, 9
c. 10, 11
d. none of the above HCL 1 For more C Code Interview Questions Click Here