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

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.

9 Answers   Microsoft,


#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }

1 Answers  


How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.

1 Answers  


Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  


how can u draw a rectangle in C

53 Answers   Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,






main() { int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }

3 Answers   GNITC,


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

1 Answers  


How to access command-line arguments?

4 Answers  


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


main() { int i = 257; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers   CSC,


main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


Categories