61. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class class0
{
public:
virtual ~class0(){}
protected:
char p;
public:
char getChar();
};
class class1 : public class0
{
public:
void printChar();
};
void class1::printChar()
{
cout << "True" << endl;
}
int main()
{
class1 c;
c.printChar();
return 1;
}
#include <iostream>
using namespace std;
class class0
{
public:
virtual ~class0(){}
protected:
char p;
public:
char getChar();
};
class class1 : public class0
{
public:
void printChar();
};
void class1::printChar()
{
cout << "True" << endl;
}
int main()
{
class1 c;
c.printChar();
return 1;
}62. What is the signature of math in function using command line arguments?
63. What will be the output of the following C++ code?
#include <stdio.h>
#include <ctype.h>
int main ()
{
int i = 0;
int cx = 0;
char str[] = "Hello, welcome!";
while (str[i])
{
if (ispunct(str[i])) cx++;
i++;
}
printf ("%d\n", cx);
return 0;
}
#include <stdio.h>
#include <ctype.h>
int main ()
{
int i = 0;
int cx = 0;
char str[] = "Hello, welcome!";
while (str[i])
{
if (ispunct(str[i])) cx++;
i++;
}
printf ("%d\n", cx);
return 0;
}64. Where exception are handled?
65. By seeing which operator thus this C++ program stops getting the input?
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
char ch;
streambuf * p;
ofstream os ("test.txt");
pbuf = os.rdbuf();
do {
ch = cin.get();
p -> sputc(ch);
} while (ch != '.');
os.close();
return 0;
}
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
char ch;
streambuf * p;
ofstream os ("test.txt");
pbuf = os.rdbuf();
do {
ch = cin.get();
p -> sputc(ch);
} while (ch != '.');
os.close();
return 0;
}66. Which of the following statements regarding absolute and concrete classes in C++ is correct?
67. 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>a;
return 0;
}
#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>a;
return 0;
}68. What can go wrong in resource management on c++?
69. What is the main purpose of the constructor?
70. Which is used to solve the memory management problem in c++?
Read More Section(C plus plus miscellaneous)
Each Section contains maximum 100 MCQs question on C plus plus miscellaneous. To get more questions visit other sections.
- C plus plus miscellaneous - Section 1
- C plus plus miscellaneous - Section 2
- C plus plus miscellaneous - Section 3
- C plus plus miscellaneous - Section 4
- C plus plus miscellaneous - Section 5
- C plus plus miscellaneous - Section 7
- C plus plus miscellaneous - Section 8
- C plus plus miscellaneous - Section 9
- C plus plus miscellaneous - Section 10
- C plus plus miscellaneous - Section 11
