My Report

C++ Programming Practice Test 8


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What is the correct syntax of constructing any using assignment operator?

2. What is the use of sort_heap() function in heap?

3. What is the function of shift()?

4. Which of the following is correct about tuples?

5. What is the use of is_array() function in C++?

6. What will be the output of the following C++ code?

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
	vector <int> v = {1,5,23,90,15,35};
	cout<<is_heap(v.begin(), v.end());
	make_heap(v.begin(), v.end());
	cout<<is_heap(v.begin(), v.end());
}

7. What will be the output of the following C++ code?

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
	vector <int> v = {1,5,23,90,15,35};
	make_heap(v.begin(),v.end());
	cout<<v.front();
}

8. What will be the output of the following C++ code?

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
	vector <int> v = {1,5,23,90,15,35};
	make_heap(v.begin(),v.end());
	v.push_back(110);
	push_heap(v.begin(), v.end());
	cout<<v.front();
}

9. Which header file is required for using Valarray?

10. Given below classes which of the following are the possible row entries in vtable of Base class?

class Base
{
    public:
    virtual void function1() {};
    virtual void function2() {};
};
class D1: public Base
{
    public:
    virtual void function1() {};
};
class D2: public Base
{
    public:
    virtual void function2() {};
};

 

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.