

MCQOPTIONS
Saved Bookmarks
This section includes 6 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. |
What is the correct syntax of defining function template/template functions? |
A. | template <class T> void(T a){cout<<a;} |
B. | Template <class T> void(T a){cout<<a;} |
C. | template <T> void(T a){cout<<a;} |
D. | Template <T> void(T a){cout<<a;} |
Answer» B. Template <class T> void(T a){cout<<a;} | |
2. |
Which keyword is used for the template? |
A. | Template |
B. | template |
C. | Temp |
D. | temp |
Answer» C. Temp | |
3. |
Templates simulate which of the following feature? |
A. | Polymorphism |
B. | Abstraction |
C. | Encapsulation |
D. | Inheritance |
Answer» B. Abstraction | |
4. |
What is the difference between normal function and template function? |
A. | The normal function works with any data types whereas template function works with specific types only |
B. | Template function works with any data types whereas normal function works with specific types only |
C. | Unlike a normal function, the template function accepts a single parameter |
D. | Unlike the template function, the normal function accepts more than one parameters |
Answer» C. Unlike a normal function, the template function accepts a single parameter | |
5. |
In how many ways templates concept can be used? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
6. |
What are Templates in C++? |
A. | A feature that allows the programmer to write generic programs |
B. | A feature that allows the programmer to write specific codes for a problem |
C. | A feature that allows the programmer to make program modular |
D. | A feature that does not add any power to the language |
Answer» B. A feature that allows the programmer to write specific codes for a problem | |