What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int f(int i);
int main()
{
int i=0;
i++;
for (i=0; i<=2; i++)
{
cout< } return 0; } int f(int a) { return a+a; } A. It prints: 202020 B. It prints: 012 C. It prints: 024 D. It prints: 0
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
int main()
{
string s1[]= {"H" , "t" };
string s;
for (int i=0; i<2; i++) {
s = s1[i];
A. insert(1,"o"); cout << s; } return( 0 ); }
B. It prints: Hoto
C. It prints: Ho
D. It prints: to
E. It prints: Ht
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int min(int a, int b);
int main()
{
int b=10;
b = min(5,20);
cout << b;
return 0;
}
int min(int a, int b)
{
if (a
return(a);
else
return(b);
}
A. It prints: 10
B. It prints: 20
C. It prints: 5
D. It prints: 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;
A. set();
B. Print(); return 0; }
C. cout << y << z;
D. cout << y << A::z;
E. cout << A::y << A::z;
F. cout << B::y << B::z;
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int mul (int a, int b=2)
{
int r;
r=a*b;
return (r);
}
int main ()
{
cout << mul(1) << mul(2,4);
return 0;
}
A. It prints: 2
B. It prints: 28
C. It prints: 8
D. It prints: 6
What happens when you attempt to compile and run the following code? #include
#include
using namespace std;
class SampleClass
{
string *s;
public:
SampleClass() { s = new string("Text");}
SampleClass(string s) { this?>s = new string(s);}
~SampleClass() { delete s;}
void Print(){ cout<<*s;}
};
int main()
{
SampleClass *obj;
obj = new SampleClass("Test");
obj?>Print();
}
A. It prints: Text
B. It prints: Test
C. It prints: TextTest
D. Garbage value.
What happens if characters 'w', 'o', 'r', 'l' and 'd' are entered as input?
#include
#include
using namespace std;
int main()
{
string s1 = "Hello";
string s2;
getline( cin, s2 );
cout << s1 + s2;
return( 0 );
}
A. It prints: Helloworld
B. It prints: Hello
C. It prints: world
D. Compilation error
What is the output of the program?
#include
#include
using namespace std;
struct t
{
int tab[2];
};
class First
{
struct t u;
public:
First() {
A. tab[0] = 1;
B. tab[1] = 0; } void Print(){ cout << u.tab[0] << " " << u.tab[1]; } }; int main() { First t;
C. Print(); }
D. It prints: 2 2
E. It prints: 1 1
F. It prints: 1 0
G. It prints: 0 0
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
struct Person {
string name;
int age;
};
class First
{
Person *person;
public:
First() {person = new Person;
person?>name = "John";
person?>age = 30;
}
void Print(){
cout<
}
};
int main()
{
First t;
A. Print(); }
B. It prints: 30
C. It prints: John
D. It prints: John 30
E. It prints: John 30John 30
What happens when you attempt to compile and run the following code?
#include
using namespace std;
namespace myNamespace1
{
int x = 5;
int y = 10;
}
namespace myNamespace2
{
float x = 3.14;
float y = 1.5;
}
int main () {
namespace newname = myNamespace1;
using namespace newname;
cout << x << " ";
cout << y;
return 0;
}
A. It prints: 5 1.5
B. It prints: 3.14 1.5
C. It prints: 5 10
D. It prints: 5
Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only C++ Institute exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your CPA exam preparations and C++ Institute certification application, do not hesitate to visit our Vcedump.com to find your solutions here.