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};
vector
deque
vector
deque
d1.erase(it2+5);
it2 = d1.begin();
cout<<*(it2+5)<<" ";
v1.erase(it1+5);
it1 = v1.begin();
cout<<*(it1+5)< }
Correct : A
Start a Discussions
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
set
deque
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
Start a Discussions
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;
Correct : E
Start a Discussions
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};
vector
deque
cout< cout< cout< cout< cout< return 0; }
Correct : A
Start a Discussions
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.insert(s1.find(7), 3);
for(multiset
cout<<*i<<" ";
}
return 0;
}
Correct : A
Start a Discussions