by abdulsaboor » Sat Oct 04, 2014 9:59 am
2.
How many times the while loop will get executed if a short int is 2 byte wide?
#include<stdio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
}
A. Infinite times
B. 255 times
C. 256 times
D. 254 times
Answer: Option B
Explanation:
The while(j <= 255) loop will get executed 255 times. The size short int(2 byte wide) does not affect the while() loop.
DR ABDUL SABOOR
PHD Scholar at Superior University Lahore- Pakistan
MS Business Administration (HRM)
BS Business Administration (Marketing)
Member Editorial Board Science Publishing Group USA
Member Editorial Board International Journal of Marketing Studies
Cell=0308-6837987
Pakistan