C Online Exam-Quiz5

C Online Exam-Quiz5

1. The output of the following program is:

#include<stdio.h>

void main()

{

int i=5;

while(i)

printf(“Programming”);

printf(“Hello \n”);

}

 
 
 
 

2. How many Times Hello will be printed while executing following C program:

#include<stdio.h>

void main()

{

int i=0;

int j=0;

for(i=0;i<4;i++)

{

for(j=0;j<5;j++)

{

if(i>0)

continue;

printf(“Hello\n”);

}

}

}

 
 
 
 

3. continue” statement is used to

 
 
 
 

4. What is the output of following program?

#include<stdio.h>

void main()

{

int a=1;

if(a–)

printf(“TRUE “);

if(++a)

printf(“FALSE \n”);

}

 
 
 
 

5. The output of the following program is:

#include<stdio.h>

main()

{

int x = 5, y = 15;

int * p1, * p2;

p1 = &x;

p2 = &y;

*p1 = 10;

*p2 = *p1;

p1 = p2;

*p1 = 20;

printf(“%d %d”,x,y);

}

 
 
 
 

6. The output of the following program is:

#include<stdio.h>

main()

{

int i=0;

do

{

printf(“While Vs do-While”);

}while(i==0);

printf(“Out of Loop”);

}

 
 
 
 

7. The output of the following program is:

#include<stdio.h>

void main()

{

int n,i;

unsigned long result=1;

printf(“Enter an integer: “);

scanf(“%d”,&n);

for(i=1;i<=n;++i)

result*=i;

printf(“%llu”,result);

}

 
 
 
 

8. The output of the following program is:

#include<stdio.h>

void main()

{

int a=0,i=0,b;

for(i=0;i<5;i+=0.5)

{

a++;

continue;

}

printf(“%d”,a);

}

 
 
 
 

9. How many Times Hello will be printed while executing following C program:

#include<stdio.h>

void main()

{

int k,j;

for(k=0;k<=10;k+=2)

{

for(j=1;j!=k;j=j+1)

{

printf(“Hello\n”);

break;

}

}

}

 
 
 
 

10. For the following statements, would arr[3] and ptr[3] fetch the same character?

char arr[]=”Surprised”

char *ptr=”Surprised”

 

 
 
 
 

11. The output of the following program is:

#include<stdio.h>

void main()

{

int i=0,j=0;

while(i<4,j<5)

{

i++;

j++;

}

printf(“%d %d”, i, j);

}

 
 
 
 

12. The output of the following program is:

#include<stdio.h>

main()

{

char *name=”INDIA”;

int x;

char *cptr = name;

while(*cptr != ‘\0’)

{

cptr++;

}

x = cptr – name;

printf(“%d”, x);

return 0;

}

 
 
 
 

13. Given the following program, which statement will produce a compilation error?

#include<stdio.h>

main()

{

int k1=1;

int k2=5;

int *ptr1=&k1;

int *ptr2=&k2;

printf(“%d\n”,((ptr1-ptr2))); //Statement 1

printf(“%d\n”,*(ptr1+ptr2)); //Statement 2

}

 
 
 
 

14. a[x][y][z] is same as

 
 
 
 

15. Are ++*ptr and *ptr++ same ?

 
 
 
 

16. What does the array ‘arr’ refer to?

int* arr[8];

 
 
 
 

17. How many Times Hello will be printed while executing following C program:

#include<stdio.h>

void main()

{

int k=0;

for(;;k++)

{

printf(“Hello”);

if(k%10==0)

break;

}

}

 
 
 
 

18. “break” is used to

 
 
 
 

19. The output of the following program is:

#include<stdio.h>

main()

{

int a[]={1,2,3,4,5};

int b[]={1,2,3,4,5};

if(a==b)

printf(“yes”);

else

printf(“no”);

}

 
 
 
 

20. The output of the following program is:

#include<stdio.h>

main()

{

int a[3][4]={1,2,3,4,4,3,2,1,1,3,4,1};

printf(“%d”,*(*(a+1)+2));

}

 
 
 
 

Question 1 of 20

error: Content is protected !!