Question 1 of 11
Hints left: 3
Q1
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: A(){ cout<<"Created\n"; } ~A(){ cout<<"Destroyed\n"; } }; int main(int argc, char const *argv[]) { A <int>a1; A <char>a2; A <float>a3; return 0; }
Q2
What will be the output of the following C++ code? #include <iostream> #include <algorithm> #include <vector> using namespace std; int main () { int myints[] = {10, 20, 30, 30, 20, 10, 10, 20}; int mycount = count (myints, myints + 8, 10); cout << mycount; vector<int> myvector (myints, myints + 8); mycount = count (myvector.begin(), myvector.end(), 20); cout << mycount; return 0; }
Q3
What is the use of accumulate function in a numeric library?
Q4
How the different permutations are ordered in c++?
Q5
What will act as a intermediate between i/o operations and physical file?
Q6
What will be the output of the following C++ code in text file? #include <stdio.h> int main () { FILE * p; char buffer[] = { 'x' , 'y' , 'z' }; p = fopen ( "myfile.txt" , "wb" ); fwrite (buffer , 1 , sizeof(buffer) , p ); fclose (p); return 0; }
Q7
What will happen when an exception is not processed?
Q8
Which operator is used to insert the data into file?
Q9
Pick out the in correct type of function in header file.
Q10
What is the difference between get() and at()?
Q11
What will be the output of the following C++ code by manipulating the text file? #include <stdio.h> int main () { if (remove( "myfile.txt" ) != 0 ) perror( "Error" ); else puts( "Success" ); return 0; }