AmbitionBox

Discover Best Places to work in India

C Programming

C Programming Questions and Answers

Showing 1 - 2 of 2 questions

1

How many times "Ambition Box" is get printed?

#includeint main()
{
    int x;
    for(x=-1; x<=10; x++)
    {
        if(x < 5)
            continue;
        elsebreak;
        printf("Ambition Box");
    }
    return0;
}
a

Infinite times

b

11 times

c

0 times

d

10 times

correct answer c
Answer :

Option C

2

How many times the while loop will get executed if a short int is 2 byte wide?

#includeint main()
{
    int j=1;
    while(j <= 255)
    {
        printf("%c %d\n", j, j);
        j++;
    }
    return0;
}
a

Infinite times

b

255 times

c

256 times

d

254 times

correct answer b

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.

Select a company to compare with

vs

Similar Companies