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

int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }

1 Answers  






main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,


void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }

1 Answers  


Program to find the largest sum of contiguous integers in the array. O(n)

11 Answers  


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

2 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


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

2 Answers  


#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }

1 Answers  


Categories