LinkedIn C++ Skill Quiz Answers 2022

  1. Which of the following is a reason why using this line is considered a bad practice? (Alternative: Why is using this line considered a bad practice?)
  2. What is the smallest size a variable of the type child_t may occupy in memory?
  3. Which of the following shows the contents of vector v1 and v2 after running this code?
  4. Which of the following is a true statement about the difference between pointers and iterators?
  5. What’s a benefit of declaring the parameter as a const reference instead of declaring it as a regular object?
  6. What’s the storage occupied by u1?
  7. Which of the following operators is overloadable?
  8. Which of the following shows the contents of vector pointed by v1 and v2 after running this code?
  9. Which of the following is not a difference between a class and a struct?
  10. Suppose you need to keep a data struct with permission to access some resource based on the days of the week, but you can’t use a bool variable for each day. You need to use one bit per day of the week. Which of the following is a correct implementation of a structure with bit fields for this application?
  11. What is an lvalue?
  12. What does auto type specifier do in this line of code (since C++11)?
  13. A class template is a _?
  14. What is the ternary operator equivalent to this code snippet?
  15. What is the meaning of the two parts specified between parentheses in a range-based for loop, separated by a colon?
  16. What results from executing this code snippet?
  17. What is a valid definition for the get_length function, which returns the length of a null-terminated string?
  18. Which STL class is the best fit for implementing a collection of data that is always ordered so that the pop operation always gets the greatest of the elements? Suppose you are interested only in push and pop operations.
  19. What is the meaning of the three sections specified between parentheses in a for loop separated by semicolons?
  20. What is printed from this code?
  21. What is true about the variable named ptr?
  22. What is the difference between a public and a private class member?
  23. What is the value of x after running this code?
  24. Which statement is true?
  25. Consider a pointer to void, named ptr, which has been set to point to a floating point variable g. Which choice is a valid way to dereference ptr to assign its pointed value to a float variable f later in the program?
  26. What is the .* operator and what does it do?
  27. For these declarations, which choice shows four equivalent ways to assign the character “y” in the string to a char variable c?
  28. Which choice is the correct declaration for the class named Dog, derived from the Animal class?
  29. How can C++ code call a C function?
  30. Which choice is not a valid type definition of a structure that contains x and y coordinates as integers, and that can be used exactly as shown for the variable named center?
  31. Which choice does not produce the same output as this code snippet? Assume the variable i will not be used anywhere else in the code.
  32. What does this part of a main.cpp file do?
  33. Which choice is an include guard for the header file my_library.h?
  34. What’s wrong with this definition when using a pre-C++11 compiler?
  35. What is the statement below equivalent to?
  36. Consider a class named complexNumber. Which code will result in an equivalent object?
  37. What is the result from executing this code snippet?
  38. What is the output of this code?
  39. Which of the following STL classes is the best fit for implementing a phonebook? Suppose each entry contains a name and a phone number, with no duplicates, and you want to have lookup by name.
  40. What does this program do?
  41. Which of the following is not a consequence of declaring the member variable count of my_class as static?
  42. What is the assumed type of a constant represented in the source code as 0.44?
  43. What is the output of this piece of code?
  44. What is an appropriate way of removing my_object as shown below?
  45. What is the correct way to call the count member function for the object pointer called grades?
  46. What would be the output of this code?
  47. What does this function do?
  48. Consider a class named CustomData. Which choice is a correct declaration syntax to overload the postfix ++ operator as a class member?
  49. You want to sort my_array, declared below. Which choice is the correct call to std::sort, using a lambda expression as the comparison function?
  50. Which choice is the most reasonable implementation of the function std::mutex::lock() by using std::mutex::try_lock()?
  51. What is the purpose of a destructor?
  52. Which STL class is the best fit for implementing a phonebook? Suppose each entry contains a name and a phone number, with no duplicates, and you want to have lookup by name.
  53. What is the main difference between these two Functions?
  54. What is one benefit of declaring the parameter as a const reference instead of declaring it as a regular object?
  55. What is an include guard?
  56. What would be the correct declaration of a default constructor for a class named Sprite?
  57. What is the purpose of this line in a header file?
  58. What is a variable of type double?
  59. Consider this function declaration of is_even, which takes in an integer and returns true if the argument is an even number and false otherwise. Which declarations are correct for overloaded versions of that function to support floating point numbers and string representations of numbers?
  60. Other than shifting bits to the left, what is the << oprator used for ?
  61. Does this code cause a compiler error? If so, why, and if not, what is child_t?
  62. Which choice is a reason to specify the type of a pointer instead of using void *, which works as a pointer ro any type?
  63. What is wrong with this piece of code?
  64. What is this expression equivalent to?
  65. Which statement is true when declaring the member variable count as static?
  66. When placed in a valid execution context, which statement will dynamically allocate memory from the heap for an integer of value 11?
  67. Which choice best describes the type long?
  68. Which of the following types has the closest functionality to a class?
  69. Given these records in a map, how will you update the value for the key “Sinead” to 22?
  70. Why can the std::sort receive a function object as one of its parameters?
  71. What will happen when you execute this code snippet?
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Share via
G Certification Course We would like to show you notifications for the latest news and updates.
Dismiss
Allow Notifications
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend