1/5
roar
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Which of the following statements is incorrect?
A memory leak is problematic because it causes memory usage to balloon while the program is running.
Dereferencing the nullptr results in well-defined behavior.
You should be careful about array bounds when indexing into an array.
You shouldn’t access memory after it has been deallocated since a write might get lost, and a read possibly garbage.
Dereferencing the nullptr results in well-defined behavior.
Given the following code snippet,
char input[6];
std::cin >> input;
std::cout << input << std::endl;
Of the strings below, which is most likely to cause a segmentation fault if read from standard input into input
?123
Hello World
Howdy
Texas_A&M_University
Texas_A&M_University
Of the following statements, three describe programmatic actions/operations that can cause runtime issues, while one is entirely safe. Select the safe statement.
After deallocating a dynamically allocated memory, assign the pointer that once pointed to the dynamically allocated object the nullptr.
An off-by-one error while indexing into an array.
Forgetting to return a value in a value-returning function.
Interacting with an uninitialized or otherwise invalid pointer.
After deallocating a dynamically allocated memory, assign the pointer that once pointed to the dynamically allocated object the nullptr.
Which sanitizer is defined to help detect undefined behavior?
Asan
Clang-tidy
UBsan
Valgrind
UBsan
A memcheck tool tells you the following:
Total heap usage: 2 allocs, 1 frees, 72,744 bytes
What is this message reporting?
A memory leak: your program called new twice but invoked delete once.
Your program terminates due to a segmentation fault. You have been working with dynamically allocated objects and fear that you may have attempted member access on the nullptr. Which sanitizer should you employ to investigate your suspicion?
AddressSanitizer (ASan).
Clang-Tidy.
UndefinedBehaviorSanitizer (UBSan).
Valgrind.
AddressSanitizer (ASan).