NCR Placement Paper Contributed by knowledgemkk updated on Nov 2019

                             NCR: Written Test for experienced C/C++ professional 

Question 1: Reverse words in the given string “this is it” Output should be “it is this” 
Void reverseWordsOfString(char *str) { // Implement } 

Question 2: If we call myFunc(n) with the below provide definition, what will be the output? 
int myFunc(int n) 
{ While(n--) 
{ Switch(--n) 
{ case 1:printf(“\n%d”,n); 
default:printf(“\n%d”,n); 
return myFunc(--n); 
break; 
case 0:printf(“\n%d”,n); 
break; 
case 2:printf(“\n%d”,n); 
break; } 
} If (n==0) 
Return 0; } 

Question 3:Critque the above program , and suggest any correction needs to be done in the respect of code style, logic,..etc. 

Question 4: What is the output of the below program. If there any errors , mention line numbers and correct them. 
#include using namespace std; 
class A{ public: virtual display_A(A *obj) 
{
cout<<”class A”<display_A(&obja);
pObja->display_A(&objb); 
pObja->display_B(&objb);
pObja->display_A(&objc);
return 0;
}

feedback