Paper Tayyari

Lecture 14: Pointers

MCQs, short and long questions from lecture 14.Lecture 14 ki MCQs, short aur long sawal.

5 MCQs · 1 short question · 5 MCQs from past papers5 MCQs · 1 short sawal · 5 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/5
– correctsahi
1.
★ Final term solved MCQs (Moaaz & Asad)

There is a pointer variable named ptr of type int then address of which type of variable the ptr will store in it?

  1. Avariable of type char
  2. Bvariable of type short
  3. Cvariable of type int
  4. Dvariable of type double

An int pointer stores the address of an int.

2.
★ Solved MCQs collection

Dereferencing operator is represented by _______

  1. A*
  2. B+
  3. C–
  4. DNone of the given

The unary * operator dereferences a pointer.

3.
★ Solved MCQs collection

What will be the correct syntax for initialization of pointer ptr of type int with variable x?

  1. Aint ptr = &x ;
  2. Bint ptr = x ;
  3. Cint *ptr = &x ;
  4. Dint ptr* = &x ;

A pointer to int is declared with * and initialized with the address of x.

4.
★ Past paper collection

The statement cout << yptr will show the __________the yptr points to.

  1. AValue
  2. Bmemory address
  3. CVariable
  4. DNone of the given

Printing the pointer itself shows the address it holds.

5.
★ Past paper collection

_________ is used as a dereferencing operator.

  1. A*
  2. B+
  3. C-
  4. DNone of the above

The unary * operator gives the value at the address in a pointer.