C++ Basics

 44 Minutes
 22 Questions


This test covers a wide range of topics related to the C++ programming language. It includes questions on the Standard Template Library (STL), the Standard Library, Object Oriented Programming, Compound Data Types, Basics, Algorithms and Advanced Concepts. The test is designed to assess a candidate's knowledge and understanding of the C++ language and its various components.


Example Question:

Multiple-Choice
In the following code we call the function template twice. In the second call we don't specify the type (long) when calling the function template. Will it work?
#include <iostream>
using namespace std;
template <class T>
T FetchMax (T a, T b) {
T result;
result = (a>b)? a : b;
return (result);
}
int main () {
int i=5, j=6, k;
long l=10, m=5, n;
k=FetchMax<int>(i,j);
n=FetchMax(l,m);
cout << k << endl;
cout << n << endl;
return 0;
}