Home > C++ Programming > Quizzes > C++ Programming Fundamentals Test 3
C++ Programming Fundamentals Test 3
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 25% Most missed: “Which is a valid comment statement in C++?”
C++ Programming Fundamentals Test 3
Time left 00:00
25 Questions

1. Where T is a type: std::vector::at vs std::vector::operator[]:
2. int *array = new int[10]; delete array;
3. What is the proper way to use the .substr() function on the following string to get the word 'World'? string aString = 'Hello World!';
4. A structure item exists in your code with an integer member units. You have the following variable declaration: item * myItem;. How do you access the value of units?
5. int a[] {1 - 2 - 3}; a[[] { return 2; }()] += 2; What is the value of a[2]?
6. Is the following legal C++ code? | char *str = 'abc' + 'def';
7. What does OOD stand for?
8. Consider the following: namespace myNamespace { int a; int b; } How would the main part of the program access myNamespace variable a?
9. Which is a valid variable initialization statement?
10. Choose the valid C++ function declaration which passes the function parameters by reference.
11. What is the purpose of std::set_union?
12. An anonymous namespace is used to...
13. char * array = 'Hello'; char array[] = 'Hello'; What is the difference between the above two - if any - when using sizeof operator ?
14. Can a struct have a constructor in C++?
15. Which is a valid comment statement in C++?
16. This symbol calls the pre-processor to include the specified system files such as iostream.
17. If class B inherits class A - A::x() is declared virtual and B::x() overrides A::x() - which method x() will be called by the following code: B b; b.x();
18. What is the size in bytes of an int variable on a 32-bit system?
19. Which of the following is not a specific type casting operator in the C++ language?
20. Which of the following is a valid variable identifier in C++?
21. Given the following - how many bytes of memory does var occupy?: class a { int x; short y; }; a var[20];
22. If you do not supply any constructors for your class - which constructor(s) will be created by the compiler?
23. Which of the following is not a member of std::weak_ptr?
24. What is an advantage to using C++ Templates?
25. The C++ programming language derived from: