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 RSPQ

B QSRP

C QPSR

D SRQP

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 Order may vary from compiler to compiler

B f1, f2, f3

C None of above

D f1, f2, f3

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

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

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

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

D Member function and data are by default private in structures but public 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 linker error.

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

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

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 Both 1 and 2 are incorrect.

B Only 2 is correct.

C Both 1 and 2 are correct.

D Only 1 is correct.

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 Garbage garbage

B 10 10 20 20

C Garbage garbage 20 20

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 report compile time error.

B The program will print the output Garbage.

C The program will print the output 0.

D The program will print the output 33.

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 44.

B The program will print the output 0.

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 46 22

B 45 22

C 46 23

D 45 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 report compile time error.

B The program will print the output 0.

C The program will print the output Garbage.

D The program will print the output 22.