What Will Print Out?: Answer:empty String
What Will Print Out?: Answer:empty String
2. 3. 4. 5. 6. 7. 8. 9. 10. main() { char *p1="name"; char *p2; p2=(char*)malloc(20); memset (p2, 0, 20); while(*p2++ = *p1++); printf("%s\n",p2); }
Answer:empty string. 11. What will be printed as the result of the operation below:
12. 13. 14. 15. 16. 17. 18. } main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf("%d%d\n",x,y);
Answer : 5794 19. What will be printed as the result of the operation below:
20. 21. 22. 23. 24. } { int x=5; printf("%d,%d,%d\n",x,x< <2,x>>2); main()
Answer: 5,20,1
int temp;
temp=a;
b=a;
a=temp;
return 0;
Answer: 10, 5 10, 5 36. What will be printed as the result of the operation below:
37. 38. 39. main() { char *ptr = " Cisco Systems";
Answer:Cisco Systems isco systems 45. What will be printed as the result of the operation below:
46. 47. 48. 49. 50. 51. } main() { char s1[]="Cisco"; char s2[]= "systems"; printf("%s",s1);
Answer: Cisco 52. What will be printed as the result of the operation below:
53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. } main() { char *p1; char *p2; p1=(char *)malloc(25); p2=(char *)malloc(25); strcpy(p1,"Cisco"); strcpy(p2,"systems"); strcat(p1,p2); printf("%s",p1);
Answer: Ciscosystems 64. The following variable is available in file1.c, who can access it?:
65. static int average;
Answer: all the functions in the file1.c can access the variable. 66. WHat will be the result of the following code?
67. 68. 69. 70. 71. 72. } #define TRUE 0 // somecode.
while(TRUE) { // somecode
Answer: This will not go into the loop as TRUE is defined as 0. 73. What will be printed as the result of the operation below:
int x;
int modifyvalue()
return(x+=10);
int changevalue(int x)
return(x+=1);
void main()
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x);
Answer: 12 , 13 , 13 74. What will be printed as the result of the operation below:
Answer: 11, 16 82. What will be printed as the result of the operation below:
83. 84. 85. 86. 87. 88. } main() { int a=0; if(a==0) printf("Cisco Systems\n"); printf("Cisco Systems\n");