Answer the following questions true (T) or false (F)

1. Dangling pointers present no problem in C++

2. Dynamic variables or dynamically allocated variables in C++ are created and destroyed according to the program’s needs.

1. False
Explanation: A dangling pointer occurs when several pointers point to the same chunk of allocated freestore memory. If one of the pointers has had the delete
pointer applied to it, releasing the freestore memory, the other pointers are said to be dangling. Because the pointer that had delete applied to it most of the time isn’t
changed by the delete operation (not guaranteed by any means), a deleted pointer is frequently called a ‘dangling pointer.’
2. True
Explanation: Dynamic variables are unaffected by function calls or function return. This is not true of local pointer variables that may point to dynamic variables. Consequently, in a poorly written program, a local pointer can go out of scope and the dynamic variable to which the pointer points may be lost.

Computer Science & Information Technology

You might also like to view...

Signing of mobile code is a suggested approach for addressing the vulnerability of hostile code. Outline what a code signing scheme would have to do

What will be an ideal response?

Computer Science & Information Technology

Most database software is ____ sensitive.

A. case B. file C. field D. record

Computer Science & Information Technology