main()

{

printf("%d, %d", sizeof('c'), sizeof(100));

}

a. 2, 2

b. 2, 100

c. 4, 100

d. 4, 4

Answers were Sorted based on User's Feedback



main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / guest

a) 2, 2

Is This Answer Correct ?    48 Yes 22 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / lalitha

size of char is 1
and size of int is 2/4 depending on n-bit m/c

Is This Answer Correct ?    24 Yes 6 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / lalitha

@ 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????

Is This Answer Correct ?    12 Yes 1 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / anil

for the above question the give options are not suitable

it gives the out put as:
1, 2

Is This Answer Correct ?    9 Yes 6 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / praneeth

In C programming language
The size of character literal is size of int. (2 or 4)
ex:: sizeof('A') == sizeof(65)

the size of char is 1
ex:: char ch = 'a';
sizeof(ch) == 1

I hope U understand....
praneeth

Is This Answer Correct ?    7 Yes 4 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / ab

answer can be both a and d part..its compiler dependent...

Is This Answer Correct ?    3 Yes 0 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / sai

Answer will be (2,2).
EXPLANATION:
In the above printf() statement the size of the char is 2 because
it will takes ASCII value for 'c' because "%d" is the integer specifier.

Is This Answer Correct ?    3 Yes 0 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / ameesha

d). 4,4

Is This Answer Correct ?    3 Yes 0 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / balu

answer 2,2
char=1byte
int =2bytes

Is This Answer Correct ?    2 Yes 1 No

main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 ..

Answer / vamsi

A.(2,2)

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Code Interview Questions

which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


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); }

1 Answers  


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


void main() { int i=5; printf("%d",i+++++i); }

3 Answers  






how to check whether a linked list is circular.

11 Answers   Microsoft,


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

2 Answers   HCL,


Find the largest number in a binary tree

7 Answers   Infosys,


how to delete an element in an array

2 Answers   IBM,


main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,


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.

2 Answers   Wipro,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


Categories