Live Help (Start Chat)
View Count: 0
Duration: 48 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 21 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 63 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 7 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 33 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 13 mins
Accessed date:
Not Yet Viewed
View Count: 0
Duration: 13 mins
Accessed date:
Not Yet Viewed
Post your comment / feedback here
 
 

Be the first one to comment about this video

Question No: 1 of 14
How many times will this loop execute?
  main()
  {
    char c=125;
    do
         printf("%d ",c);
    while(c++);
} 
Options:
  1. 3 times
  2. Single time
  3. Char is wrong
  4. Finite times
View Answer/Explanation:
d
Explanation:
If char is incremented, then variable c will be increment as well 126, 127,-128,-127,-126 . . . . , -3, -2, -1, 0. When variable c = 0 then loop will terminate.

Question No: 2 of 14
_____ Statement execute the body of the loop before the test is performed. 
Options:
  1. If
  2. do
  3. While
  4. For
View Answer/Explanation:
b
Explanation:

Question No: 3 of 14
What is the o/p of following program
#include
int main(){
  	  float a=1.5f;
   
    	while(a){
       	  printf("%.f ",a);
         	a-=.5f;
  	  }
    return 0;     
} 
Options:
  1. 2 1 1
  2. 0 1 2
  3. No output
  4. Compilation Error
View Answer/Explanation:
a
Explanation:

Question No: 4 of 14
While loop without any body is possible. For example:
#include
int main()
{
    int i=0;
   
    while(i<=8) i++;
    printf("%d ",i);
    return 0;         
} 
Options:
  1. 1
  2. 8
  3. 9
  4. No output
View Answer/Explanation:
c
Explanation:

Question No: 5 of 14
What will be output of following c code?
#include
int main(){
    int i=2,j=2;
    while(i+1?--i:j++)
         printf("%d",i);
    return 0;
} 
Options:
  1. 1
  2. 2 3
  3. 1 2
  4. 0 1
View Answer/Explanation:
a
Explanation:

Question No: 6 of 14
What will be output of the following code?
#include
int main()
{
  		unsigned int i = 65535; /* Assume 2 byte integer and 65535 is the max value*/
  		while(i++ != 0)
	    	 	printf("%d",++i);
	     	printf("\n");
	      	return 0;
 } 
Options:
  1. Infinity
  2. 0 1 2 ... 65535
  3. 0 1 2 ... 32767 - 32766 -32765 -1 0
  4. No output
View Answer/Explanation:
a
Explanation:

Question No: 7 of 14
What will be the output of the program?
#include
int main()
{
	    	int i = 5;
  	while(i-- >= 0)
  		printf("%d,", i);
 	 	i = 5;
		printf("\n");
	 	while(i-- >= 0)
    	 	printf("%i,", i);
  	 while(i-- >= 0)
 	 		printf("%d,", i);
	 	return 0;
} 
Options:
  1. 4, 3, 2, 1, 0, -1 4, 3, 2, 1, 0, -1
  2. 5, 4, 3, 2, 1, 0 5, 4, 3, 2, 1, 0
  3. Error
  4. 5, 4, 3, 2, 1, 0 5, 4, 3, 2, 1, 0 5, 4, 3, 2, 1, 0
View Answer/Explanation:
a
Explanation:
Initially the value of variable i is '5'. Control goes to while (i-- >= 0) here i = 5, this statement becomes while (5-- >= 0) Hence the while condition is satisfied and it prints '4'. (Variable 'i' is decremented by '1'). After completing some loops, i = 0, while (0-- >= 0) condition prints '-1'.In next loop, i = -1, and loop exits. The output of first while loop is 4, 3, 2, 1, 0,-1 Then variable i is initialized to '5'. Then it prints a new line (\n). And all above loops are repeated giving output of second while loop is 4, 3, 2, 1, 0,-1. The third while loop, i = -1, while (-1-- >= 0) Hence the while condition is not satisfied and loop exits.

Question No: 8 of 14
Point out the error, if any in the while loop.
#include
int main()
{
 	     int i=1;
	     while()
	     {
	   	printf("%d\n", i++);
	  	 if(i>10)
	   	break;
	     }
    	 return 0;
} 
Options:
  1. There should be a condition in the while loop
  2. There should be at least a semicolon in the while
  3. The while loop should be replaced with for loop
  4. No error
View Answer/Explanation:
a
Explanation:
The while() loop must have conditional expression or it shows "Expression syntax" error.

Question No: 9 of 14
What is the o/p of following program
#include 
int main()
{    
	int i=0;
	while(i < 10) 
	{
		i++; 
		if (i == 6) continue;	
		if (i == 8)  break;
		printf("%d\n",i); 
	}
} 
Options:
  1. 0 1 2 3 4 5 6 7 8 9
  2. 1 2 3 4 5 6 7 8 9
  3. 1 2 3 4 5 7
  4. 1 2 3 4 5 6 7
View Answer/Explanation:
c
Explanation:
Explanation: if I = 6, rest of the statements are skipped and if i=8, for loop breaks

Question No: 10 of 14
What will be output of following c code?
#include
int main(){
    int i=1;
    for(i=0;i=-1;i=1) {
         printf("%d ",i);
         if(i!=1) break;
    }
    return 0;
} 
Options:
  1. 1
  2. 0
  3. -1
  4. Compilation Error
View Answer/Explanation:
c
Explanation:

  1