C++ Programming Fundamentals

Tests understanding of C++ language mechanics including variable initialization, constructors, arrays, references, and enums.

7 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Which is the first successful high level programming language?

  1. C
  2. C++
  3. QBASIC
  4. FORTRAN
Question 2 Multiple Choice (Single Answer)

const int x = 5; int main(int argc, char** argv) { int x[x]; int y = sizeof(x) / sizeof(int); return 0; }

  1. 0
  2. 5
  3. 20
  4. undefined
Question 3 True/False

int x = 5; class x { }; int main(int argc, char** argv) { class x y; return 0; }

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

#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; }

  1. 5
  2. 3
  3. 0
  4. undefined
Question 5 True/False

int main() { int& x[50]; return 0; }

  1. True
  2. False
Question 6 Multiple Choice (Single Answer)

What is the maximum number of implicitly defined constructors that this struct will have? struct A { A(A& a) { } A(double d) {} int val; };

  1. 0
  2. 1
  3. 2
  4. undefined
Question 7 Multiple Choice (Single Answer)

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; }

  1. 0
  2. 5
  3. undefined
  4. 1