Tools for Testing and Debugging CS128

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/5

flashcard set

Earn XP

Description and Tags

roar

Last updated 9:51 PM on 11/3/24
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

6 Terms

1
New cards

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.

2
New cards

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

3
New cards

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.

4
New cards

Which sanitizer is defined to help detect undefined behavior?

Asan

Clang-tidy

UBsan

Valgrind

UBsan

5
New cards

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.

6
New cards

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).

Explore top notes

note
trftghgtrfgbhgt
Updated 395d ago
0.0(0)
note
Chemistry moles stuff
Updated 414d ago
0.0(0)
note
Geometry 1.1 - 1.4
Updated 947d ago
0.0(0)
note
Foundations of Government
Updated 1295d ago
0.0(0)
note
Carpal Tunnel Syndrome
Updated 1138d ago
0.0(0)
note
Education
Updated 1189d ago
0.0(0)
note
AP PSYCHOLOGY Unit 0
Updated 565d ago
0.0(0)
note
trftghgtrfgbhgt
Updated 395d ago
0.0(0)
note
Chemistry moles stuff
Updated 414d ago
0.0(0)
note
Geometry 1.1 - 1.4
Updated 947d ago
0.0(0)
note
Foundations of Government
Updated 1295d ago
0.0(0)
note
Carpal Tunnel Syndrome
Updated 1138d ago
0.0(0)
note
Education
Updated 1189d ago
0.0(0)
note
AP PSYCHOLOGY Unit 0
Updated 565d ago
0.0(0)

Explore top flashcards

flashcards
2B Verbos -car, -gar, -zar
41
Updated 1085d ago
0.0(0)
flashcards
BIO FINAL
177
Updated 1029d ago
0.0(0)
flashcards
big french quiz
30
Updated 387d ago
0.0(0)
flashcards
Exam 3 Study Guide
62
Updated 1211d ago
0.0(0)
flashcards
Physics Paper 1
225
Updated 567d ago
0.0(0)
flashcards
2B Verbos -car, -gar, -zar
41
Updated 1085d ago
0.0(0)
flashcards
BIO FINAL
177
Updated 1029d ago
0.0(0)
flashcards
big french quiz
30
Updated 387d ago
0.0(0)
flashcards
Exam 3 Study Guide
62
Updated 1211d ago
0.0(0)
flashcards
Physics Paper 1
225
Updated 567d ago
0.0(0)