Ecp Mock
Ecp Mock
===============================
1. #include <stdio.h>
int main(void)
printf(" %d",result++);
return 0;
Answers
1. 100 102
2. 100 104
3. 100 103
4. 100 101
==============================================================================
2. #include <stdio.h>
int main(void)
int num1=0,num2=1;
int result;
return 0;
}
Answers
1. 1,0,0
2. 1,0,1
3. 1,1,0
4. 1,1,1
====================================================================
int main(void)
int result=0;
int num=10;
printf("%d",result);
return 0;
1. 21
2. 22
3. 20
4. 23
======================================================================
4. #include <stdio.h>
int main(void)
int i = 0;
if (i == 0)
i++;
continue;
printf("Sunbeam");
printf("%d",i);
return 0;
==============================================
int main(void)
int i = 0;
printf("%d] sunbeam\t",i++);
return 0;
2. 0] Sunbeam 1] Sunbeam
3. Runtime Error
4. 3] Sunbeam
==============================================================================
Answers
================================
int i;
int main(void)
fun();
fun();
fun();
printf("%d",i);
return 0;
i++;
}
Answers
1. Garbage
2. 0
3. 3
======================================================================
Answers
1. value is constant
2. pointer is constant
===========================================
int main()
printf("%d",(arr+1)[3]);
Answers
1. 5
2. 4
3. 2
int main()
ptr++;
printf("%d",*ptr++);
Answers
1. 1
2. 3
3. 2
4. Garbage
==============================================
int main()
int result;
char name2[8]={'S','U','N','B','E','A','M','\0'};
result = strcmp(name,name2);
if(result==0)
printf("same");
else
printf("not same");
Answers
1. not same
2. same
4. Runtime Error
==========================================================================
int main()
puts(name);
Answers
1. Sun
2. beam
3. Garbage
====================================================
int main()
int arr[2][2]={{1,2},{4,5}};
int i,j;
printf("%d %d %d %d\n",i,j,*(*(arr+i)+j),*(*(arr+i)+j));
return 0;
Answers
1. 0 0 1 1 0 1 1 2 1 0 4 5 1 1 0 0
2. 0 0 1 1 0 1 2 4 1 0 4 5 1 1 5 5
3. 0 0 1 1 0 1 2 2 1 0 4 4 1 1 5 5
4. 0 0 1 1 0 1 2 2 1 0 4 5 1 1 5 4
=====================================================
int main(void)
int i,j;
int *ptr;
ptr = (int*)&arr+1;
ptr++;
printf("%d",*ptr);
return 0;
Answers
1. 1
2. 3
3. Garbage
4. 4
========================================================
Answers
1. calloc() allocates the memory and also initialise the allocated memory to zero,
================================================================
printf("%d %d",var++,--num);
void main()
func(p,p);
printf("%d %d ",p++,--q);
}
Answers
1. 3 2 3 0
2. 3 2 3 2
3. 3 2 3 1
4. 2 3 2 3
========================================================
struct bit {
int a:1;
};
int main(void)
b1.b =5;
printf("%d",b1.b);
printf(" %d",sizeof(b1));
return 0;
Answers
1. 1 4
2. 2 8
3. garbage 8
4. 2 4
=======================================================
#define cal(a) a * 5 / a
int z = cal(1+2) * 5;
printf("%d",z);
return 0;
Answers
1. 10
2. 21
3. 5
4. 11
===============================================================
#include<string.h>
int main(void)
strcpy(st1.str, "Pune");
printf("%s %s",st2.str,st1.str);
return 0;
}
Answers
1. Kune Kune
2. Pune Kune
3. Pune Garbage
4. Pune Pune
===========================================================
#pragma pack(1)
typedef union {
char ch;
float fvar;
}D1;
int main()
printf("%d",sizeof(D1));
return 0;
Answers
2. 16
3. 24
4. 12
=======================================================
21. What will be the output of following program ? #include<stdio.h>
enum menu m;
int main()
printf(“%d %d”,b+a,e+d);
Answers
1. 2 3
2. 0 1
3. 5 -1
4. Error
=============================================================
int main()
char ch;
else
printf("MarketYard");
return 0;
Answers
1. MarketYard
2. Hinjewadi
3. NO OUTPUT
4. Hinjewadi MarketYard
===============================================================
int main()
char ch = 65;
switch(++ch)
return 0;
Answers
1. MarketYard Karad
2. Karad
3. Hinjewadi
===================================================================
void main()
int s=0;
while(s++<10)
continue;
printf(“\n%d\t”,s);
Answers
1. 1 2 3 1 0
2. 4 5 6 7 8 9
3. 4 5 6 7 8 9 10
4. 1 2 3 4 5 6 7 8 9
========================================================
25. Output?
#include <stdio.h>
int main()
int c = 5, no = 10;
do {
no /= c;
} while(c--);
return 0;
Answers
1. 1
2. Runtime Error
3. 0
4. Compiler Error
============================================================
#include <stdio.h>
int main()
printf("%d",--i);
return 0;
int abc(int i)
{ return(i++); }
Answers
1. 10
2. 9
3. 11
===================================================
27. What will be the o/p of the following code If P is a pointer to an integer and T is a pointer to a
character then scale factor of P will be
Answers
=============================================================
#include<stdio.h>
int i =0;
printf("%s\n",argv[i]); argv++;
return 0;
Answers
1. programname wednesday
2. programname tuesday
3. Runtime Error
4. programname monday
===================================================
Answers
1. int *
2. int **
3. void *
4. void **
================================================================
Answers
4. Option (ii)only
===============================================================
Answers
=========================================================
32. What is the purpose of "rb" in fopen() function used below in the code?
Answers
1. Open "sunbeam.txt" in binary mode for reading
========================================================
int main()
c=~(a^b / a<<b);
printf("%d",c);
Answers
1. 5
2. 10
3. -5
4. -10
===============================================
34. In the following code what is 'sunbeam'?typedef char *charp; const charp sunbeam;
Answers
1. sunbeam is a constant
4. None of above
====================================================
35. int main()
typedef int f;
f *fptr;
fptr = &fval;
printf("%f\n", *fptr);
return 0;
Answers
1. 10
2. 97
3. 98
4. 0
=============================================
Answers
1. makefile describes to the make command that how to compile the program
====================================================
Answers
3. Volatile keyword instruct the compiler not to do any optimization on that variable
==========================================================
int main()
struct bitfield p;
printf("%d\n", p.x);
return 0;
Answers
1. 0
2. 1
3. 2
4. Error
==============================================================
39. When fopen() gets failed to open the file, it returns ___________ .
Answers
1. EOF
2. NULL
Answers
1. cdecl
2. pascal
3. stdcall
================================