Q1. A pointer is a variable that stores AAddress of another variableBSize of another variableCValue of another variableDName of another variable Show answer Answer: A. Address of another variable Report a mistake
Q4. Declaration of a pointer to an integer is A*int ptr;Bint ptr;Cint *ptr;Dint &ptr; Show answer Answer: C. int *ptr; Report a mistake
Q5. After int x = 10; int *p = &x; the expression *p gives AAddress of pBValue of xCGarbage valueDAddress of x Show answer Answer: B. Value of x Report a mistake
Q6. Pointers are useful for AOnly constantsBOnly loopsCDynamic memory allocationDOnly static variables Show answer Answer: C. Dynamic memory allocation Report a mistake
Q7. NULL pointer is a pointer that ACannot be declaredBPoints to infinityCPoints to a valid variableDPoints to address 0 Show answer Answer: D. Points to address 0 Report a mistake
Q8. A wild pointer is AA constant pointerBA pointer that has not been initializedCA pointer pointing to NULLDA pointer pointing to a valid object Show answer Answer: B. A pointer that has not been initialized Report a mistake
Q9. The size of a pointer on a 64-bit system is usually A8 bytesB2 bytesC4 bytesD16 bytes Show answer Answer: A. 8 bytes Report a mistake
Q10. Pointer arithmetic is valid with ADivision of two pointersBAll arithmetic operators equallyCInteger addition/subtractionDMultiplication of two pointers Show answer Answer: C. Integer addition/subtraction Report a mistake
Q11. If p points to an integer, p+1 points to APrevious integerBNext integer locationCNext byteDSame location Show answer Answer: B. Next integer location Report a mistake
Q12. The expression *(p+1) is equivalent to Ap[1]B&p[1]Cp+1DBoth a and c Show answer Answer: A. p[1] Report a mistake
Q13. Array name itself acts as AA valueBA functionCA constant pointer to the first elementDA variable pointer Show answer Answer: C. A constant pointer to the first element Report a mistake
Q14. We cannot increment an array name because AArrays have no addressBIt is a constant pointerCIt is a variableDIt is illegal syntax only Show answer Answer: B. It is a constant pointer Report a mistake
Q15. A pointer to a pointer is declared as Aint **pp;Bint *pp;Cint pp**;Dint &pp; Show answer Answer: A. int **pp; Report a mistake
Q16. Dynamic memory allocation in C++ is done using Anew operatorBOnly static allocationCOnly callocDmalloc only Show answer Answer: A. new operator Report a mistake
Q17. Memory allocated by new is released using AremoveBfree onlyCdeleteDclear Show answer Answer: C. delete Report a mistake
Q18. new int; allocates memory for AArray of integersBFloatCOne integerDCharacter Show answer Answer: C. One integer Report a mistake
Q19. new int[10]; allocates memory for A10 charactersBArray of 10 integersCOne integerDNothing Show answer Answer: B. Array of 10 integers Report a mistake
Q20. delete[] is used for AReleasing memory allocated for arraysBReleasing single variable onlyCClearing screenDDeleting files Show answer Answer: A. Releasing memory allocated for arrays Report a mistake
Q21. Memory leak occurs when APointer is NULLBDynamically allocated memory is not releasedCArray is too largeDToo much stack is used Show answer Answer: B. Dynamically allocated memory is not released Report a mistake
Q22. Dangling pointer is a pointer that APoints to NULLBPoints to memory that has been freedCHas not been initializedDPoints to a valid object Show answer Answer: B. Points to memory that has been freed Report a mistake
Q23. this pointer is available in AGlobal functionsBmain() onlyCStatic member functionsDNon-static member functions Show answer Answer: D. Non-static member functions Report a mistake
Q24. this pointer points to ANULLBThe current objectCGlobal variablesDThe previous object Show answer Answer: B. The current object Report a mistake
Q25. A constant pointer means APointer cannot be usedBThe address stored in pointer cannot changeCBoth address and value can changeDThe value pointed to cannot change Show answer Answer: B. The address stored in pointer cannot change Report a mistake
Q26. A pointer to constant means AThe address cannot changeBThe value pointed to cannot be changed through the pointerCBoth can changeDPointer is NULL Show answer Answer: B. The value pointed to cannot be changed through the pointer Report a mistake
Q27. Declaration of constant pointer to integer is Aint * const p;Bconst int * const p;Cint const *p;Dconst int *p; Show answer Answer: A. int * const p; Report a mistake
Q28. Declaration of pointer to constant integer is Aint * const p;Bconst * int p;Cconst int *p;Dint const p; Show answer Answer: C. const int *p; Report a mistake
Q29. Function pointers are used to AStore address of a functionBStore address of a variable onlyCAllocate memoryDOnly call main() Show answer Answer: A. Store address of a function Report a mistake
Q30. Syntax of function pointer is Areturn_type *ptr(parameter_list);Breturn_type ptr*(parameter_list);C*return_type ptr(parameter_list);Dreturn_type (*ptr)(parameter_list); Show answer Answer: D. return_type (*ptr)(parameter_list); Report a mistake
Q31. Pointers can be used to implement AOnly classesBOnly static arraysCDynamic data structures (linked list, tree, etc.)DOnly loops Show answer Answer: C. Dynamic data structures (linked list, tree, etc.) Report a mistake
Q32. The operator -> is used with APointers to objects / structuresBFunctions onlyCArrays onlyDNormal variables Show answer Answer: A. Pointers to objects / structures Report a mistake
Q33. ptr->member is equivalent to A(*ptr).memberBptr.memberC*ptr.memberD&ptr.member Show answer Answer: A. (*ptr).member Report a mistake
Q34. Void pointer can point to AOnly integersBOnly charactersCOnly floatsDAny data type Show answer Answer: D. Any data type Report a mistake
Q35. Void pointer cannot be ADereferenced directly without castingBUsed at allCAssigned addressDDeclared Show answer Answer: A. Dereferenced directly without casting Report a mistake
Q36. Far pointer and near pointer concepts were used in AOnly JavaBOnly PythonCModern 64-bit systems onlyDOld 16-bit segmented memory models Show answer Answer: D. Old 16-bit segmented memory models Report a mistake
Q37. Smart pointers in modern C++ are used to AReplace all variablesBMake pointers fasterCAutomatically manage memory and avoid leaksDIncrease memory usage Show answer Answer: C. Automatically manage memory and avoid leaks Report a mistake
Q38. Examples of smart pointers are Aunique_ptr, shared_ptr, weak_ptrBOnly char*COnly void*DOnly int* Show answer Answer: A. unique_ptr, shared_ptr, weak_ptr Report a mistake
Q39. Reference variable is AA functionBA constantCAn alias for another variableDA pointer Show answer Answer: C. An alias for another variable Report a mistake
Q40. Reference must be ALeft uninitializedBAlways NULLCA pointerDInitialized when declared Show answer Answer: D. Initialized when declared Report a mistake
Q41. Difference between pointer and reference is APointer is saferBReference can point to many variablesCPointer cannot be changedDReference cannot be NULL and must be initialized Show answer Answer: D. Reference cannot be NULL and must be initialized Report a mistake
Q42. Passing large objects is efficient with ACall by value onlyBPointers or referencesCOnly global variablesDOnly arrays Show answer Answer: B. Pointers or references Report a mistake
Q43. Returning a local variable by reference/pointer is ARecommendedBDangerous (dangling reference)CCompulsoryDAlways safe Show answer Answer: B. Dangerous (dangling reference) Report a mistake
Q44. Pointer comparison is valid when AAlways valid for any pointersBBoth pointers point to the same array or objectCNever validDOnly with NULL Show answer Answer: B. Both pointers point to the same array or object Report a mistake
Q46. The expression *(&x) is equal to AAddress of xBxC&xD*x Show answer Answer: B. x Report a mistake
Q47. A pointer can be incremented using AOnly p = p * 2BNot possibleCOnly p = p / 2Dp++ or p = p + 1 Show answer Answer: D. p++ or p = p + 1 Report a mistake
Q48. Base address of an array arr can be obtained by AOnly *arrBOnly &arrCarr or &arr[0]DOnly arr[0] Show answer Answer: C. arr or &arr[0] Report a mistake
Q49. In C++, nullptr is preferred over NULL because AIt uses less memoryBIt is type-safeCIt is compulsoryDIt is faster Show answer Answer: B. It is type-safe Report a mistake
Q50. The most important rule while using pointers is AAlways use wild pointersBNever use deleteCAlways initialize them and free dynamically allocated memoryDNever initialize them Show answer Answer: C. Always initialize them and free dynamically allocated memory Report a mistake