1.What is the size (in bytes) of a pointer in C++ on a 32-bit system?
  • A. 2 bytes
  • B. 4 bytes
  • C. 8 bytes
  • D. Size depends on the data type

4 bytes

4 bytes

2.Which of the following statements is correct about pointers in C++?
  • A. A pointer can hold the address of a variable of any data type
  • B. A pointer can only hold the address of an integer
  • C. A pointer can only hold the address of a float
  • D. A pointer can store a string literal

A pointer can hold the address of a variable of any data type

A pointer can hold the address of a variable of any data type

3.What does the * operator do when used with a pointer in C++?
  • A. It defines a pointer variable
  • B. It dereferences the pointer
  • C. It creates a pointer to a constant
  • D. It returns the address of a variable

It dereferences the pointer

It dereferences the pointer

4.What will be the output of the following C++ code?
int x = 10; int *p = &x; cout << *p;
  • A. 0
  • B. 10
  • C. Address of x
  • D. Error

10

10

5.What is the correct way to initialize a pointer in C++?
  • A. int* ptr = 10;
  • B. int* ptr = &10;
  • C. int* ptr = NULL;
  • D. int* ptr = new int(10);

int* ptr = new int(10);

int* ptr = new int(10);