Interview Pattern – Integra

Company: Intergraph

the questions were easy there will be two or three question form each subject ,(c ,c++, data structures , 4 or 5 aptitude , 3 verbal questions and so on). the next round is a programming test where we have to write two or three programs in C or Java , the programs are

1.Get a set of strings from command line and print the strings with first letter in capital and other letters as small letters
i,e you have to write a program for eg , printCaps.c .it will be run from the command line as > printCaps this is a saMPLE program

the output should be This Is A Sample Program

2. I dint remember correctly , but i think the program is for sorting the alphabets in the given name

eg . if the input is jawahar the output should be aaahjrw

3 . some program for implementing test cases i,e you have a program for sorting N numbers , you have to check the efficiency for sorting program, the input for the sorting program will be the value of N followed by N numbers

It seem to be difficult but the logic is easy first you have to generate the set of inputs and pass them to the sorting program
you can store the input in files and redirect the input to the program from the file

for example
FILE *fp = fopen(“input.txt”,”w”);
fprintf (“%dn”,n);
for(i = 0 ; i fprintf (“%dn”,i);
fclose(fp);
write function for getting the time
system(” sorting.exe < input.txt”); // this will execute sorting.exe with the values in the file as input
write function for getting the time

compare the time and print the output

The next round was the technical interview they asked question from C++ overloading

the question was to overload the ++ operator for an object

the class file will be like this

class Integer
{
int i;
public Integer(int i)
{
this.i = i;
}
}
you have to write a function for overloading the ++ operator such that it behaves like the ++ operator we use for int s

Integer obji = new Integer(0); similar to int i = 5;

obj++ ; // should increment the value of the i in the class be 1 i++ ; value of i is 6
++ obj ; // should increment the value of the i in the class be 1 ++i ; value of i is 7

++obj = 5 ; // should give an error as LValue requeired ++i = 8 ; // will give an error LValue required

the solution is
class Integer
{
int i;
public Integer(int i)
{
this.i = i;
}
const Integer Operator++() // I hope the syntax is correct
{
i++;
}
}
add a const keyword before the over load operator so that ++obj = 5 ; will give the error lvalue required when we assign a value to a const object then they asked to tell about the default methods we have to write when writing a class in C++

1. Void constructor ()
2. copy constructor

though the compiler will not give any error if u dint write the above two , but it is a good habit to write them the other questions were easy and covers the basics of C and C++ like
1. what is the difference between calloc and malloc

the next round was HR interview , In the interview they will ask your details and give the offer letter to you