Convergys Technical Interview Questions

1. What is the output of the program?

struct *s;
s=(struct *)malloc(10*sizeof(struct)+90*sizeof(int));
free(s);

a) total memory deallocated
b) total memory allocated
c) Error in the code
d) None

2. What is the return value of the function?

func()
{ int x=1;
if(x=1)
x=1000;
else
x=10;
return x;
}

a) 1000 b) 1050 c) Error d) None

3. What is the output for the following program?

#include
main()
{
char a[5][5],flag;
a[0][0]='A';
flag=((a==*a)&&(*a==a[0]));
cout<< < }

4. Explain the following function?
f(){
int *b;
*b=2;
}

5. What is the output of the following function?
int a(int n)
{ count++; }
void main()
{
int count=0;
while(a<10)
a(count)
return cout<< count;
}

6. Find the valid statement in C++
a) char *cp; b) const char *cpp; c) cpp=cp; d) cp=cpp;

7. Write program to swap 2 variables without using extra memory?
8. Write a program to find all Java files present in nested directories?

Shared by: Susant Kumar