

MCQOPTIONS
Saved Bookmarks
This section includes 11 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.
1. |
Which of the following is an arithmetic unary functor? |
A. | logical_not<T> f; |
B. | logical_and<T> f; |
C. | logical_or<T> f; |
D. | negate<T> f; |
Answer» E. | |
2. |
Which of the following is a logical unary functor? |
A. | logical_or<T> f; |
B. | logical_and<T> f; |
C. | logical_not<T> f; |
D. | negate<T> f; |
Answer» D. negate<T> f; | |
3. |
How many ways are there to use functors? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
4. |
What are binary functors? |
A. | Functors that accepts only one parameter |
B. | Functors that accepts more than one parameters |
C. | Functors that accepts two parameters |
D. | Functors that accepts other than a specific type of parameter |
Answer» D. Functors that accepts other than a specific type of parameter | |
5. |
What are unary functors? |
A. | Functors that accepts only one parameter |
B. | Functors that accepts two parameters |
C. | Functors that accepts more than one parameters |
D. | Functors that accepts other than a specific type of parameter |
Answer» B. Functors that accepts two parameters | |
6. |
Which of the following header file is required to use in-bulit functors of C++? |
A. | <any> |
B. | <fucntional> |
C. | <functor> |
D. | <function> |
Answer» C. <functor> | |
7. |
Which of te following is a built-in example of functors in C++? |
A. | mltiplication<T> f(a1, a2); |
B. | add<T> f(a1, a2); |
C. | subtract<T> f(a1, a2); |
D. | plus<T> f(a1, a2); |
Answer» E. | |
8. |
Which of the following is correct about Functors? |
A. | Functors should not be declared outside the main function |
B. | Overloaded operator () function is not a member of the class |
C. | Functors should be declared global |
D. | Functors have a state |
Answer» E. | |
9. |
What is the correct function prototype of () operator overloading? |
A. | return_type operator(arguments)(); |
B. | return_type operator(arguments); |
C. | return_type operator()(arguments); |
D. | return_type operator(Class_name)(arguments); |
Answer» D. return_type operator(Class_name)(arguments); | |
10. |
Which of the following operators are overloaded for functors? |
A. | [] |
B. | () |
C. | << |
D. | >> |
Answer» C. << | |
11. |
What are functors in C++? |
A. | Objects of a class which are treated as functions |
B. | Objects that are used to call the function of other classes |
C. | Functions that are called using pointer objects |
D. | Functions that are called only once in a program |
Answer» B. Objects that are used to call the function of other classes | |