C Programming > Control Instructions
1.
How many times "vchowk" is get printed?
#include<stdio.h>
int main()
{
int x;
for(x=-1; x<=10; x++)
{
if(x < 5)
continue;
else
break;
printf("vchowk");
}
return 0;
}
A. Infinite times
B. 11 times
C. 0 times
D. 10 times
Answer: Option C
C Programming > Control Instructions
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
C Programming > Control Instructions
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
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
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
Re: C Programming > Control Instructions
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.
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
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
- abdulsaboor
- ADMIN
- Posts: 2004
- Joined: Fri Sep 28, 2007 3:42 am
- Location: vehari-punjab-pakistan
- Contact:
Re: C Programming > Control Instructions
3.
Which of the following is not logical operator?
A. &
B. &&
C. ||
D. !
Answer: Option A
Explanation:
Bitwise operators:
& is a Bitwise AND operator.
Logical operators:
&& is a Logical AND operator.
|| is a Logical OR operator.
! is a NOT operator.
So, '&' is not a Logical operator.
Which of the following is not logical operator?
A. &
B. &&
C. ||
D. !
Answer: Option A
Explanation:
Bitwise operators:
& is a Bitwise AND operator.
Logical operators:
&& is a Logical AND operator.
|| is a Logical OR operator.
! is a NOT operator.
So, '&' is not a Logical operator.
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
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