C++ Programming Fundamentals
Tests understanding of C++ language mechanics including variable initialization, constructors, arrays, references, and enums.
Questions
Which is the first successful high level programming language?
- C
- C++
- QBASIC
- FORTRAN
const int x = 5; int main(int argc, char** argv) { int x[x]; int y = sizeof(x) / sizeof(int); return 0; }
- 0
- 5
- 20
- undefined
int x = 5; class x { }; int main(int argc, char** argv) { class x y; return 0; }
- True
- False
#include const int SIZE = 5; struct tester { int array[SIZE]; enum { SIZE = 3 }; void size() { std::cout << sizeof(array) / sizeof(int); } }; int main(int argc, char** argv) { tester t; t.size(); return 0; }
- 5
- 3
- 0
- undefined
int main() { int& x[50]; return 0; }
- True
- False
What is the maximum number of implicitly defined constructors that this struct will have? struct A { A(A& a) { } A(double d) {} int val; };
- 0
- 1
- 2
- undefined
What is the value of the local variable x at the end of main? int x = 5; int main(int argc, char** argv) { int x = x; return 0; }
- 0
- 5
- undefined
- 1