What is the output of the program if character 4 is supplied as input?
#include
using namespace std;
int main () {
int c;
cin >> c;
try
{
switch (c)
{
case 1:
throw 20;
case 2:
throw 5.2f;
case 3:
throw 'a';
default:
cout<<"No exception";
}
}
catch (int e)
{ cout << "int exception. Exception Nr. " << e; }
catch (float e)
{ cout << "float exception. Exception Nr. " << e; }
catch (...)
{ cout << "An exception occurred."; }
return 0;
}
Which code, inserted at line 19, generates the output "23"?
#include
#include
using namespace std;
class A {
int x;
protected:
int y;
public:
int z;
A() { x=1; y=2; z=3; }
};
class B : public A {
string z;
public:
int y;
void set() { y = 4; z = "John"; }
void Print() {
//insert code here
}
};
int main () {
B b;
b.set();
b.Print();
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
void fun(int &i);
int main()
{
int i=2;
fun(i);
cout<
return 0;
}
void fun(int &i)
{
i+=2;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class A {
public:
int x;
A() { x=0;}
};
class B : public A {
public:
B() { x=1;}
};
class C : private B {
public:
C() { x=2;}
};
int main () {
C c1;
cout << c1.x;
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
#define DEF_A 0
int main(int argc, char *argv[]) {
cout << DEF_A;
return 0;
}
Lisa Bailey
14 days agoCynthia Bailey
28 days agoJohn Moore
1 month agoJohn White
1 month agoSandra Ramirez
1 month agoDennis Wilson
25 days agoMelissa Flores
1 month agoGeorge Moore
1 month agoPaz
2 months agoGussie
2 months agoColette
2 months agoYolande
3 months agoDaniel
3 months agoDominga
3 months agoKarina
4 months agoLuisa
4 months agoQueenie
4 months agoPaul
4 months agoEliz
5 months agoRoyal
5 months agoShawnda
5 months agoTonja
5 months agoLucy
6 months agoMaybelle
6 months agoIsadora
6 months agoPrincess
6 months agoWeldon
7 months agoPaola
7 months agoBok
7 months agoBecky
7 months agoStephania
8 months agoCatarina
8 months agoHaley
8 months agoDell
8 months agoWhitley
9 months agoStephaine
9 months agoLazaro
11 months agoCeola
1 year agoAlecia
1 year agoThomasena
1 year agoHannah
1 year agoRonny
1 year agoEttie
1 year agoBrittni
1 year agoTijuana
1 year agoStephania
2 years agoIlene
2 years agoNoel
2 years agoShawna
2 years agoDonte
2 years agoMiss
2 years agoAretha
2 years agoRikki
2 years agoNickolas
2 years agoBobbye
2 years agoLeota
2 years agoDona
2 years agoStefania
2 years agoWalton
2 years agoGlory
2 years agoShawna
2 years agoTequila
2 years agoCordelia
2 years agoChuck
2 years agoBeckie
2 years ago