What happens if the following C++ statement is compiled and executed?
int *ptr = NULL;
delete ptr;
a)   The program compiled successfully but throws an error during run-time
b)	 The program gives a compile-time error
c)	 The program is not semantically correct
d)	 The program is compiled and executed successfully
Answer: d
Explanation: The above statement is syntactically and semantically correct as C++ allows the programmer to delete a NULL pointer, therefore, the program is compiled and executed successfully.
						
						
												
							Related Posts
What are the portability concerns founded in Seeheim model?
Which of the following is the main task accomplished by the user?
Which among the following are the functions that any system with a user interface must provide?
The _____________ system is widely used for mapping from Java objects to relations.
The ______________ layer, which provides the interface between the business-logic layer and the underlying database.
The _____________ layer, which provides a high-level view of data and actions on data.
Which layer deals which deals with user interaction is called _____________ layer.
Join The Discussion