21. What is the correct way to pass a pointer to a function in C++? A. By reference B. By value C. By dereferencing the pointer D. By declaring the pointer globally Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
22. What is a memory leak in C++? A. Failure to allocate memory when needed B. Allowing memory to be accessed by unauthorized users C. Accessing an invalid memory location D. Failure to deallocate memory after it's no longer needed Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
23. What is the purpose of the 'delete' keyword in C++? A. Deletes a variable B. Deletes a pointer C. Deallocates memory dynamically D. Deallocates memory statically Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
24. What does the 'nullptr' keyword signify when used as a pointer value in C++? A. A pointer to a null reference B. A null pointer C. A pointer to a null object D. None of the above Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
25. What is a pointer arithmetic in C++? A. Assigning arithmetic expressions to a pointer B. Using pointers to perform arithmetic operations C. Performing arithmetic operations on pointers D. Storing arithmetic operations in a pointer Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
26. What is the purpose of the 'this' pointer in C++? A. Points to the next object instance B. Points to the previous object instance C. Points to the base class object instance D. Points to the current object instance Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
27. What is the output of the following code: char str[] = "Hello"; cout << sizeof(str); in C++? A. 5 B. 4 C. Compilation error D. 6 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
28. What does the 'sizeof' operator return when used with a pointer variable in C++? A. Size of the pointer variable B. Size of the data type pointed to by the pointer C. Address of the pointer variable D. Address of the data pointed to by the pointer Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
29. What is the purpose of the 'const' keyword in a pointer declaration in C++? A. Indicates that the pointer itself is constant B. Indicates that the value pointed to is constant C. Indicates that the pointer can be reassigned D. Indicates that the pointer points to a constant value Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
30. What is the output of the following code: int arr[3] = {1, 2, 3}; cout << *(arr + 2); in C++? A. 1 B. 2 C. 3 D. Compilation error Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board