C++ interview questions part 60

C++ interview questions part 60

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. How many types of models are available to create the user-defined data type?

Correct Answer is : My exception

2. What is Valarray in C++?

Correct Answer is : Depends on memory

3. Which of the following is correct about Valarray?

Correct Answer is : 0

4. Which header file is required for using Valarray?

Correct Answer is : Caught: bad_cast exception

5. What is the use of apply() function in Valarray?

Correct Answer is : The object is null

6. What is the output of the following C++ code? #include #include using namespace std; int main() { Valarray varr = { 10, 2, 20, 1, 30 }; for (int &x: varr) cout << x << " "; cout<
Correct Answer is : dynamic allocations


7. What is the use of sum() function in Valarray?

Correct Answer is : Both Memory allocation errors & I/O errors

8. What is the output of the following C++ code? #include #include using namespace std; int main() { Valarray varr = { 10, 2, 20, 1, 30 }; cout<<"Sum of array: "<
Correct Answer is : algorithm


9. What is the function of shift()?

Correct Answer is : mismatch

10. Which of the following is correct about the shift?

Correct Answer is : Form a heap

11. What is the output of the following C++ code? #include #include using namespace std; int main() { Valarray varr = { 1, 2, 3, 4, 5 }; for (int &x: varr) cout << x << " "; cout<
Correct Answer is : 8


12. What is the output of the following C++ code? #include #include using namespace std; int main() { Valarray varr = { 1, 2, 3, 4, 5 }; for (int &x: varr) cout << x << " "; cout<
Correct Answer is : 3 4 4 0


13. Which of the following is correct about shift() and cshift()? 1) shift() makes some values of Valarray equal to 0 after shifting by a non-zero number 2) cshift() makes some values of Valarray equal to 0 after shifting by a non-zero number

Correct Answer is : 5 4 3 2 1

14. What is the output of the following C++ code? #include #include using namespace std; int main() { Valarray varr = { 1, 2, 3, 4, 5 }; for (int &x: varr) cout << x << " "; cout<
Correct Answer is : 45354


15. Which function is used to swap two Valarray?

Correct Answer is : 10, 30, 30, 10, 10

16. Which function is used to print the maximum element from Valarray?

Correct Answer is : Bigger than others

17. How many types of returning values are present in c++?

Correct Answer is : All of the mentioned

18. What will you use if you are not intended to get a return value?

Correct Answer is :

19. Where does the return statement returns the execution of the program?

Correct Answer is : all of the mentioned

20. When will we use the function overloading?

Correct Answer is : none of the mentioned

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon