Online Test

:

 

What is the output of this program?

     #include <iostream.h>
    using namespace std;
    #define MIN(a,b) (((a)<(b)) ? a : b)
    int main ()
    {
        float i, j;
        i = 100.1;
        j = 100.01;
        cout <<"The minimum is " << MIN(i, j) << endl;
        return 0;
    }

Which is used for manually writing lookup table?


In C++, dynamic memory allocation is accomplished with the operator ____ 


What is the output of this program?

    #include <iostream>
    using namespace std;
    int main()
    {
        double a = 21.09399;
        float b = 10.20;
        int c ;
        c = (int) a;
        cout << c ;
        c = (int) b;
        cout << c ;
        return 0;
    }

How many parameters are required for sort_heap function?


Given a class named Book, which of the following is not a valid constructor?


What is the output of this program?

    #include <iostream.h>
    using namespace std;
    void Sum(int a, int b, int & c)
    {
        a = b + c;
        b = a + c;
        c = a + b;
    }
    int main()
    {
        int x = 2, y =3;
        Sum(x, y, y);
        cout << x << " " << y;
        return 0;
    }

Which operators are part of RTTI?


What punctuation is used to signal the beginning and end of code blocks?


What is the output of this program?
 #include <iostream.h>
    using namespace std;
    void Values(int n1, int n2 = 10)
    {
        using namespace std;
        cout << "1st value: " << n1;
        cout << "2nd value: " << n2;
    }
    int main()
    {
        Values(1);
        Values(3, 4);
        return 0;
    }


What is the output of this program?

 #include <iostream.h>
    using namespace std;
    int func(int m = 10, int n)
    {
        int c;
        c = m + n;
        return c;
    }
    int main()
    {
        cout << func(5);
        return 0;
    }

What is the output of this program?

   #include <iostream>
    #include <vector>
    using namespace std;
    int main():q
    {
        vector<int> v;
        v.assign( 10, 42 );
        for (int i = 0; i < v.size(); i++) 
        {
            cout << v[i] << " ";
        }
    }

Which of the following is false?


To what kind of elements does non-modifying sequence algorithm can be
applied?


 Where does the exceptions are used?


What is the output of this program?

    #include <iostream.h>
    #include <deque.h> 
    using namespace std;
    int main ()
    {
        unsigned int i;
        deque<int> mydeque;
        mydeque.push_back ( 100 );
        mydeque.push_back ( 200 );
        mydeque.push_back ( 300 );
        for (deque<int> :: iterator it = mydeque.begin(); it != mydeque.end(); ++it)
            mydeque.clear();
        cout << ' ' << *it;
    }

 What is the output of this program?

   #include <iostream.h>
    using namespace std;
    #define MAX 10
    int main()
    {
        int num;
        num = ++MAX;
        cout << num;
        return 0;
    }

What do we need to do to pointer for overloading the subscript operator?


What is the output of this program?

   #include <iostream.h>
    using namespace std;
    const int SIZE = 10;
    class safe
    {
        private:
        int arr[SIZE];
        public:
        safe()
        {
            register int i;
            for (i = 0; i < SIZE; i++)
            {
                arr[i] = i;
            }
        }
        int &operator[](int i)
        {
            if (i > SIZE)
            {
                cout << "Index out of bounds" <<endl;
                return arr[0];
            }
            return arr[i];
        }
    };
    int main()
    {
        safe A;
        cout << A[5];
        cout  << A[12];
        return 0;
    }

 What is the output of this program?

#include <iostream.h>
    using namespace std;
    void mani()
    void mani()
    {
        cout<<"hai";
    }
    int main()
    {
        mani();
        return 0;
    }

What is the output of this program?

#include <iostream.h>
    using namespace std;
    int add(int a, int b);
    int main()
    {
        int i = 5, j = 6;
        cout << add(i, j) << endl;
        return 0;
    }
    int add(int a, int b )
    {
        int sum = a + b;
        a = 7;
        return a + b;
    }

 


What are mandatory parts in function declaration?


What will happen while using pass by reference


What is the output of this program?

#include <iostream.h>
    using namespace std;
    #define PI 3.14159
    int main ()
    {
        float r = 2;
        float circle;
        circle = 2 * PI * r;
        cout << circle;
        return 0;
    }

Which option is best to eliminate the memory problem?

 

About Us

TechEpi.com is an online learning website.We cover the latest tech news,online tutorials,blog,online test for Aptitude,C,Java,PHP to improve your knowledge.

Newsletter


Follow TechEpi on