ExamVeda
Login
Home
81
What will be the output of the following C++ code?
#include <iostream>
#include <iterator>
using namespace std;
int main ()
{
    try {
        double value1, value2;
        istream_iterator<double> eos;       
        istream_iterator<double> iit (cin);   
        if (iit != eos) 
            value1 = *iit;
        iit++;
        if (iit != eos) 
            value2 = *iit;
        cout << (value1 * value2) << endl;
    }
    catch (...) {
        cout << "Unknown exception: " << endl;
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
82
Which is called on allocating the memory for the array of objects?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
83
What will be the type of output of vector cross product?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
84
What will be the output of the following C++ code?
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
template<class T>
class A
{
    public:
	T func(T a, T b){
		return a/b;
	}	
};
 
int main(int argc, char const *argv[])
{
	A <int>a1;
	cout<<a1.func(3,2)<<endl;
	cout<<a1.func(3.0,2.0)<<endl;
	return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
85
Which keyword is used to declare the min and max functions?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
86
What is the syntax of inheritance of class?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
87
What will be the output of the following C++ code?
#include <stdio.h>
int main ()
{
    FILE * p;
    int c;
    int n = 0;
    p = fopen ("myfile.txt", "r");
    if (p == NULL) 
        perror ("Error opening file");
    else
    {
        do {
            c = getc (p);
            if (c == '$') 
                n++;
        } while (c != EOF);
        fclose (p);
        printf ("%d\n", n);
    }
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
88
Which function is used to check whether a character is printable on console?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
89
What will be the output of the following C++ code?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i,int j) { return (i<j); }
int main () 
{
    int myints[] = {9, 8, 7, 6, 5};
    vector<int> myvector (myints, myints + 5);
    partial_sort (myvector.begin(), myvector.begin() + 3, myvector.end());
    partial_sort (myvector.begin(), myvector.begin() + 2, myvector.end(), 
    myfunction);
    for (vector<int> :: iterator it = myvector.begin(); it != myvector.end(); ++it)
        cout << ' ' << *it;
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
90
What may be the name of the parameter that the template should take?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board