Subscribe RSS

Quark India Technical Paper C++ Language questions

August 24th, 2008 by Admin | Filed under Quark Test Papers, Sample Placement Papers.

Quark software recruitment placement test C++ programs and multiple choice technical section questions:

1. Can there be a static class

2. Dynamic binding is
options

3. Find the output of the following program.
main()
{
int i,j=9999;
char buff[5];
i=sprintf(buff,”%d”,j);

cout< }

a. 9999, 4
b 9999,5 ans
c 4,9999
d 9999,1

4. class ab{};
main()
{
cout< }

a 1
b 0 ans
c 2
d 4

5.
class ab
{
int i;
public:
virtual void fun(){}
}
main()
{
cout< }

a. 4 ans

6. when new fails it
a. send _set_new_handler
b. send excection
c.
d. both a and b

7. #define f(a,b) a+b
#define g(x,y) x*y
main()
{
int i;
=f(4,g(5,6));
cout< }

a. 34 ans

8 #define x(a) ++a + a++ +a++
like this I do not
remember this question ans was 4.

9. polymorphism is

10. mutable is used for
ans–changing the value in the
const functions

Multiple choice / objective type questions and fill in the blanks type test problems
Q. __stdcall calling convention
Ans. stack is cleaned by the callee

Q. mutable key word is used for
Ans. if used with a member variable it can be changes by a function declared as a constant

Q. foo & const ref
Ans. this is not a good practise since references are always constants

Q. private inheritance means
Ans Non private members of a base class become private members of derived class

C++ C plus plus CPP sample programs, programming or coding questions for the Quark placement test.

Q. int I=2;
Int j=3;
Int k=4;
Cout<<(I Ans. 1

Q #defines macro(a) ((a++) + (++a) + (a++))
Main()
{
cout << macro(1);
}
Ans. 4

Q. string s = “abcd”
Char &c=s[1];
String t;
T=s;
c=’z’;
if(T[1]==’z’)
{
cout<<”Quark”;
}
else
{
cout<<”express”;
}
Ans. express

Q. int func(int I)
{
static int k=0;
k++;
if( K>5)
return 1;
else
return func(I-1);
}

int main()
{
cout << func(1);
}

Ans. 1

Q. class base
{
public:
virtual func()
{
cout <<”BASE”;
}
};
class der1: public base
{
public:
virtual func()
{
cout << “DER1”;
}
};
class der2: public base
{
public:
virtual func()
{
cout << “DER2”;
}
};
class der3: public base
{
public:
virtual func1()
{
cout << “DER3”;
}
};
main()
{
base *pb;
pb= new der1;
pb->func();
pb= new der2;
pb->func();
pb= new der3;
pb->func();
}
Ans: DER1DER2BASE

Q Which of following will cause application crash…there are three options
ANS. char * p = new char;
Char *q=p;
Delete p;
Delete q;

Q For typeid to give correct result which condition is must
Ans. Class should be polymorphic

Q Following things are default when class is created
Ans. Default constructor, copy constructor, assignment operator

Q. Which casting is done at run time
Ans. dynamic_cast

More Quark India placement papers and whole test question papers can be found here. Practise fully to avoid any unexpected questions in the actual quark exam.

Random Posts

Leave a Reply