image not found

Oops! That page can't be found.


Directions to Solve

In questions below, each passage consist of six sentences. The first and sixth sentence are given in the begining. The middle four sentences in each have been removed and jumbled up. These are labelled as P, Q, R and S. Find out the proper order for the four sentences.

Q1:
S1: Smoke oozed up between the planks.
P : Passengers were told to be ready to quit the ship.
Q : The rising gale fanned the smouldering fire.
R : Everyone now knew there was fire on board.
S : Flames broke out here and there.
S6: Most people bore the shock bravely.
The Proper sequence should be:

A SRQP

B QPSR

C RSPQ

D QSRP

Q2: Which of the following is the correct order if calling functions in the below code?
a = f1(23, 14) * f2(12/4) + f3();

A f1, f2, f3

B f1, f2, f3

C Order may vary from compiler to compiler

D None of above

Q3: Which of the following is the only technical difference between structures and classes in C++?

A Member function and data are by default protected in structures but private in classes.

B Member function and data are by default private in structures but public in classes.

C Member function and data are by default public in structures but private in classes.

D Member function and data are by default public in structures but protected in classes.

Q4: Which of the following statements is correct about the program given below?
class Aptitude
{
    public:
    static void MyFunction();
};
int main()
{
    void(*ptr)() = &Aptitude::MyFunction;
    return 0; 
}

A The program reports an error as pointer to member function cannot be defined outside the definition of class.

B The program reports an error as pointer to static member function cannot be defined.

C The program reports an error as pointer to member function cannot be defined without object.

D The program reports linker error.

Q5:
Which of the following statements are correct for a static member function?
  1. It can access only other static members of its class.
  2. It can be called using the class name, instead of objects.

A Only 1 is correct.

B Only 2 is correct.

C Both 1 and 2 are correct.

D Both 1 and 2 are incorrect.

Q6: What will be the output of the following program?
#include<iostream.h> 
class Aptitude
{
    public:
      int x;
};
int main()
{
    Aptitude *p = new Aptitude();

    (*p).x = 10;
    cout<< (*p).x << ' ' << p->x << ' ' ;

    p->x = 20;
    cout<< (*p).x << ' ' << p->x ;

    return 0;
}

A 10 10 20 20

B Garbage garbage 20 20

C 10 10 Garbage garbage

D Garbage garbage Garbage garbage

Q7:
Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    static int x; 
    public:
    static void SetData(int xx)
    {
        x = xx; 
    }
    void Display() 
    {
        cout<< x ;
    }
};
int AptitudeCrack::x = 0; 
int main()
{
    AptitudeCrack::SetData(33);
    AptitudeCrack::Display();
    return 0; 
}

A The program will print the output 0.

B The program will print the output 33.

C The program will print the output Garbage.

D The program will report compile time error.

Q8:
Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    static int x; 
    public:
    static void SetData(int xx)
    {
        x = xx; 
    }
    static void Display() 
    {
        cout<< x ;
    }
};
int AptitudeCrack::x = 0; 
int main()
{
    AptitudeCrack::SetData(44);
    AptitudeCrack::Display();
    return 0; 
}

A The program will print the output 0.

B The program will print the output 44.

C The program will print the output Garbage.

D The program will report compile time error.

Q9: What will be the output of the following program?
#include<iostream.h> 
class AptitudeTeam
{
    int x, y; 
    public:
    AptitudeTeam(int xx)
    {
        x = ++xx;
    }
    void Display()
    {
        cout<< --x << ' ';
    }
};
int main()
{
    AptitudeTeam objBT(45);
    objBT.Display();
    int *p = (int*)&objBT;
    *p = 23;
    objBT.Display();
    return 0; 
}

A 45 22

B 46 22

C 45 23

D 46 23

Q10:
Which of the following statement is correct about the program given below?
#include<iostream.h> 
class AptitudeCrack
{
    static int x; 
    public:
    static void SetData(int xx)
    {
        this->x = xx; 
    }
    static void Display() 
    {
        cout<< x ;
    }
};
int AptitudeCrack::x = 0; 
int main()
{
    AptitudeCrack::SetData(22);
    AptitudeCrack::Display();
    return 0; 
}

A The program will print the output 0.

B The program will print the output 22.

C The program will print the output Garbage.

D The program will report compile time error.