Decide Fast & Get 50% Flat Discount | Limited Time Offer - Ends In 0d 00h 00m 00s Coupon code: SAVE50

Master C++ Institute CPP Exam with Reliable Practice Questions

Page: 1 out of Viewing questions 1-5 out of 228 questions
Last exam update: Nov 15,2024
Upgrade to Premium
Question 1

What happens when you attempt to compile and run the following code?

#include

#include

#include

using namespace std;

int main ()

{

int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};

vectorv1(t, t+10);

dequed1(t, t+10);

vector::iterator it1 = v1.begin();

deque::iterator it2 = d1.begin();

d1.erase(it2+5);

it2 = d1.begin();

cout<<*(it2+5)<<" ";

v1.erase(it1+5);

it1 = v1.begin();

cout<<*(it1+5)<

}


Correct : A


Options Selected by Other Users:
Mark Question:

Start a Discussions

Submit Your Answer:
0 / 1500
Question 2

What happens when you attempt to compile and run the following code?

#include

#include

#include

#include

#include

using namespace std;

void myfunction(int i) {

cout << " " << i;

}

int add (int a, int b) { return a+b; }

int main() {

int t[] = { 10, 5, 9, 6, 2, 4, 7, 8, 3, 1 };

vector v1(t, t+10);

set s1(t, t+10);

deque d1;

d1.resize(s1.size());

transform(s1.begin(), s1.end(), v1.begin(), d1.begin(), add);

for_each(d1.begin(), d1.end(), myfunction);

return 0;

}

Program outputs:


Correct : B


Options Selected by Other Users:
Mark Question:

Start a Discussions

Submit Your Answer:
0 / 1500
Question 3

What will happen when you attempt to compile and run the code below, assuming that you enter the following sequence: true true?

#include

#include

using namespace std;

int main ()

{

bool a,b;

cin>>a>>b;

cout<

return 0;

}

Program will output:


Correct : E


Options Selected by Other Users:
Mark Question:

Start a Discussions

Submit Your Answer:
0 / 1500
Question 4

What happens when you attempt to compile and run the following code?

#include

#include

#include

using namespace std;

template

int calculate(T start, T end)

{

int s = 0;

while (start != end)

s+= *start; start++;return s;

}

int main ()

{

int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};

vectorv1(t, t+5);

dequed1(t+5, t+10);

cout<

cout<

cout<

cout<

cout<

return 0;

}


Correct : A


Options Selected by Other Users:
Mark Question:

Start a Discussions

Submit Your Answer:
0 / 1500
Question 5

What happens when you attempt to compile and run the following code?

#include

#include

#include

using namespace std;

int main(){

int t[] ={ 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };

multiset s1(t,t+10);

s1.insert(s1.find(7), 3);

for(multiset::iterator i=s1.begin();i!= s1.end(); i++) {

cout<<*i<<" ";

}

return 0;

}


Correct : A


Options Selected by Other Users:
Mark Question:

Start a Discussions

Submit Your Answer:
0 / 1500