pickzy.com

C  |  C++  |  Objective-C  |  VC++  |  Win32  |  MFC  |  Java  |  Php  |  Delphi  |  Visual Basic  |  .Net  |  Networking  |  General  |  Games  |  Jobs  |  Javascript  |  




Menu

pickSourcecode.com


        

 




 

Cpp > Articles

 

Cpp - CSC interview Questions

CSC interview questions

1.what are the problems you face when calling a C function from C++ function ? How to avoid that?
'Extern C'
{
  #include<myfile.h>
}

2.Apple and orange puzzle?.

3.90 teams. The teams are divided into pairs and the one fails, will be eliminated,How many matches to be conducted to find the champion?

4.Select query to get the names (unique) in the student table
    select distinct name FROM 'student'

5.In a file , how the newline separated entries will be converted to comma separated
 fstream FObj;
   FObj.open("test.txt",ios::in);
   fstream FObj1("test1.txt",ios::out);
   string strTemp,strValue;
   while(getline(FObj,strTemp))  {
         strValue += strTemp;
         strValue += ",";
      }
   FObj.close();

   FObj1<<strValue;
   FObj1.close();

6.whats the unix command to list the directories alone in the current directory?
Ls -d */

7.Reverse String given the function definition void reverseString(char *input,char **output) .U have to fill the remaining code.
#include <iostream>
using namespace std;

void ReverseString(char* input,char** output) {
   char* temp = output[1];
   while(*input) *input++;
   *input--;
   while(*input) {
      *temp = *input;
      *input--; *temp++;     
   }  *temp = '\0';
}

int main(int argc, char **argv) {

    if(argc > 1) {
    char* text[1] = { "World" };
    ReverseString(text[0],argv);
    char* out = argv[1];
    cout<<out<<endl;
    }
}

8.A program with base and derived class. Both has virtual functions.what would be the output?

#include <iostream>
using namespace std;

class A{
public:
   A() { cout<<"A\n"; }
    virtual void Print() { cout<<"Class A - Print\n"; }
};


class B : public A{
public:
   B() { cout<<"B\n"; }
   virtual void Print() { cout<<"Class B - Print\n"; }
};
int main()
{

   A *x;

   x = new B();

   x->Print();
 
}

Output
A
B
Class B-print

 
Privacy Policy | About Us