Online Test

:

 

What is the output of this program?

  #include <iostream.h>
    using namespace std;
    int main ()
    {
        int a = 100;
        double b = 3.14;
        cout << a;
        cout << endl;
        cout << b << endl << a * b;
        endl (cout);
        return 0;
    }

What will be the output of the following program?

#include <iostream.h>
    #include <cstring.h>
    using namespace std;
    int main ()
    {
        char str1[10] = "Hello";
        char str2[10] = "World";
        char str3[10];
        int  len ;
        strcpy( str3, str1);
        strcat( str1, str2)
        len = strlen(str1);
        cout << len << endl;
        return 0;
    }

What will be the out of the following program?

#include<iostream.h> 
class EpiBase
{
    public:
    int x, y; 
    public:
    EpiBase(int xx = 0, int yy = 0)
    {
        x = xx;
        y = yy; 
    } 
 };
class EpiDerived : public EpiBase
{
    private:
        EpiBase objBase; 
    public:
    EpiDerived(int xx, int yy) : EpiBase(xx), objBase(yy)
    {
        cout << x          << " " 
             << this->x    << " "  
             << EpiBase::x << " "     
             << this->objBase.x ;
    } 
    ~EpiDerived()
    { }
};
int main()
{
   EpiDerived objDev(11, 22); 
    return 0;
}

Which parameter is legal for non-type template?


What is the kind of execution does sequence point allow?


 What is the output of this program?

    #include <iostream.h>
    #include <algorithm.h>
    using namespace std;
    int main () 
    {
        int myints[] = {1, 2, 3};
        sort (myints, myints + 3);
    do 
    {
    } while ( next_permutation(myints, myints + 3) );
        cout << myints[0] << ' ' << myints[1] << ' ' << myints[2] << '\n';
        return 0;
    }

What is the output of this program?

 #include <iostream.h>
    #include <algorithm.h>
    #include <vector.h>
    using namespace std;
    int main () 
    {
        vector<int> myvector;
        for (int i = 1; i < 6; ++i) 
            myvector.push_back(i);
        reverse(myvector.begin(), myvector.end());
        for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
            cout << ' ' << *it;
        return 0;
    }

Which of the following statement is correct about the program given below?

#include
int EpiTest(int x, int y);
int EpiTest(int x, int y, int z = 5);
int main()
{
    cout<< EpixTest(2, 4) << endl; 
    return 0;
}
int EpiTest(int x, int y)
{
    return x * y;
}
int EpiTest(int x, int y, int z = 5)
{
    return x * y * z; 
}

Which of the following statement is correct about the program given below?

#include<iostream.h> 
int val = 0; 
class TechEpi
{
    public: 
    TechEpi()
    {
        cout<< ++val;
    }
    ~TechEpi()
    {
        cout<< val--; 
    } 
}; 
int main()
{
    Techepi objEpi1, objEpi2, objEpi3;
    {
        TechEpi objEpi4;
    } 
    return 0;
}

 

What is the output of this program?

#include <iostream.h>
    using namespace std;
    class Foo
    {
        public:
        Foo(int i = 0){ _i = i;}
        void f()
        {
            cout << "Executed"<<endl;
        }
        private:
        int _i;
    };
    int main()
    {
        Foo *p = 0;
        p -> f();
    }

What is the output of this program?

   #include <iostream.h>
    #include <typeinfo.h>
    using namespace std;
    class A 
    { 
    };
    int main()
    { 
        char c; float x;
        if (typeid(c) != typeid(x))
        cout << typeid(c).name() << endl;
        cout << typeid(A).name();
        return 0;
    }

 


What is the output of this program in text files?
#include <stdio.h>
    int main ()
    {
        char buffer[BUFSIZ];
        FILE *p1, *p2;
        p1 = fopen ("myfile.txt", "w");
        p2 = fopen ("myfile2.txt", "a");
        setbuf ( p1 , buffer );
        fputs ("Buffered stream", p1);
        fflush (p1);
        setbuf ( p2 , NULL );
        fputs ("Unbuffered stream", p2);
        fclose (p1);
        fclose (p2);
        return 0;
    }

What is the output of this program?

  #include <iostream.h>
    #include <algorithm.h>
    using namespace std;
    bool myfn(int i, int j) 
    {
        return i < j;
    }
    int main () 
    {
        int myints[ ] = {3, 7, 2, 5, 6, 4, 9};
        cout <<  *min_element(myints, myints + 7, myfn) << '\n';
        cout << *max_element(myints, myints + 7, myfn) << '\n';
        return 0;
    }

What is the output of this program?

#include <iostream.h>
    #include <exception>
    using namespace std;
    class base { virtual void dummy() {} };
    class derived: public base { int a; };
    int main () 
    {
        try 
        {
            base * pba = new derived;
            base * pbb = new base;
            derived * pd;
            pd = dynamic_cast<derived*>(pba);
            if (pd == 0) 
                cout << "Null pointer on first type-cast" << endl;
            pd = dynamic_cast<derived*>(pbb);
            if (pd == 0) 
                cout << "Null pointer on second type-cast" << endl;
        } 
        catch (exception& e) 
        {
            cout << "Exception: " << e.what();
        }
        return 0;
    }

What is the output of this program?

 #include <iostream.h>
   #include <string.h>
   using namespace std;
   int main ()
   {
       string str ("Ubuntu");
       cout << str.capacity();
       cout << str.max_size();
       return 0;
   }
 

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