# NCR Corporation Placement paper November 2011

Posted on :05-04-2016
Q1.

static int i;
{
i=10;
...
}
printf("%d",i);

ANS: 10

Q2.

#define func1(a) #a
#define func2(a,b,c) a##b##c
printf("%s",func1(func2(a,b,c)))

ANS: func2(a,b,c)

Q3.

const int* ptr;
int* ptr1;
int a=10;
const int p=20;
ptr=a;
ptr1=p;

Q4.

class a
virtual disp()
{ printf("In a");}
class b:public a
disp()
{ printf("In b");}
class c:public a
disp()
{ printf("In c");}
main()
{
a obj;
b objb;
c objc;
a=objb;
a.disp();
a=objc;
a.disp();

ANS: "In a" "In a"

Q5.

a="str";
char *b="new str";
char *temp;
malloc(sizeof(temp)+1,....
strcpy(a,temp);
malloc(sizeof(b)+1,....
strcpy(temp,b);

Q6.

int m,i=1,j=0,k=-1;
m=k++||j++&&i++;
printf("%d...",m,i,j,k);

Q7.

class x
{
double b;
double *l;
float &c;
}
main()
{
double g=10.34;
double *f=1.3;
float k=9;
x o;
o.b=g;
o.l=f;
o.c=k;
}

ANS: Compiler Error

Q8. Find the Kth smallest element in a Binary Tree.

Q9. Each worker does a job and is given a rating +ve,-ve or Zero.

Find the Max SubSequence Sum for given no. of workers.

Ex: Workers=6; Ratings={1,0,-1,4,5,-3}

MaxSubSequenceSum=4+5=9 (5 Marks)

Q10. 1 to N ppl sitting in a circle. Each one passes a hot potato to the next person. After M passes the person holding the potato is eliminated. The last person remaining is winner. Find winner for given N,M.

Ex: N=5, M=2, Winner=4 (5 Marks)

Q11. Reverse a given Linked List. (5 Marks)

Q12. There is a file called Knowledge Base.txt which contains some words. Given a sub-string u have to find all the words which match the word in the file.

Ex: file contains a, ant, and, dog, pen. If I give "an" I should get o/p as "ant, and" (10 Marks)

Q13. Company employee have id,level,no. of sub-ordinates under him... If a emp leaves then his sub-ordinates are assigned to any of the emp,s seniors... Write four functions:

FreshersLive - No.1 Job site in India. Here you can find latest 2020 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.

 ✖