MCQ PORTAL

Back to All Topics

Pointers

Showing 20 of 20 questions in this topic

Start Practice Mode

Answer Green MarksON

Correct answers are highlighted in green

C070Pointers • Definition
Most ImportantEasy

Q1.A pointer is a variable that stores:

A
a value
B
the address of another variable
Correct answer
C
a string
D
a function
C071Pointers • Address operator
Most ImportantEasy

Q2.Which operator is used to get the ADDRESS of a variable?

A
* (star)
B
& (ampersand)
Correct answer
C
# (hash)
D
@ (at)
C072Pointers • Dereference
Most ImportantMedium

Q3.Which operator accesses the VALUE stored at the address held by a pointer?

A
& (ampersand)
B
* (star)
Correct answer
C
-> (arrow)
D
. (dot)
C073Pointers • Declaration
Most ImportantEasy

Q4.What is the correct way to declare a pointer to an integer?

A
int p;
B
int *p;
Correct answer
C
int &p;
D
pointer int p;
C074Pointers • Dereference value
Most ImportantMedium

Q5.If int a = 10; int *p = &a; then what does *p give?

A
the address of a
B
10
Correct answer
C
0
D
a garbage value
C078Pointers • Store address
Most ImportantEasy

Q6.Which statement correctly stores the address of variable x into pointer p?

A
p = x;
B
p = &x;
Correct answer
C
p = *x;
D
&p = x;
C158Pointers • Dereference
Most ImportantMedium

Q7.What does *p print? int a = 5; int *p = &a; printf("%d", *p);

A
address of a
B
5
Correct answer
C
0
D
garbage
C159Pointers • Modify through pointer
Most ImportantHard

Q8.What is the value of a after this? int a = 5; int *p = &a; *p = 10;

A
5
B
10
Correct answer
C
0
D
error
C160Pointers • Address operator
Most ImportantEasy

Q9.The expression &a gives the:

A
value of a
B
address of a
Correct answer
C
size of a
D
type of a
C166Pointers • Pass by reference
Most ImportantMedium

Q10.To pass a variable by reference to a function, you pass its:

A
value
B
address using &
Correct answer
C
type
D
name only
C075Pointers • Array and pointer
ImportantMedium

Q11.The name of an array (for example arr) represents the:

A
last element
B
address of the first element (base address)
Correct answer
C
size of the array
D
a null value
C076Pointers • Pointer arithmetic
ImportantHard

Q12.If p is an integer pointer (int size = 4 bytes), then p++ increases the stored address by:

A
1 byte
B
4 bytes (size of one int)
Correct answer
C
8 bytes always
D
0 bytes
C163Pointers • NULL
ImportantMedium

Q13.In C, NULL represents a pointer that:

A
points to the first element
B
points to nothing (address 0)
Correct answer
C
points to main()
D
cannot be declared
C164Pointers • String pointer
ImportantMedium

Q14.In char *s = "HELLO"; the pointer s points to:

A
the whole word HELLO as one unit
B
the character 'H' (first character)
Correct answer
C
the character 'O'
D
the null character
C165Pointers • Pointer arithmetic
ImportantHard

Q15.If p points to an element of an int array, then *(p + 1) accesses the:

A
same element
B
previous element
C
next element
Correct answer
D
last element
C077Pointers • Null pointer
OtherMedium

Q16.A pointer that points to no valid memory location and holds the value 0 is called a:

A
wild pointer
B
null pointer
Correct answer
C
void pointer
D
dangling pointer
C079Pointers • Void pointer
OtherMedium

Q17.A pointer that can point to any data type is declared as:

A
int *
B
char *
C
void *
Correct answer
D
null *
C161Pointers • Pointer to pointer
OtherHard

Q18.A pointer that stores the address of another pointer is called a:

A
null pointer
B
void pointer
C
pointer to pointer (double pointer)
Correct answer
D
wild pointer
C162Pointers • Pointer size
OtherHard

Q19.On a given machine, all pointer variables have:

A
different sizes for each type
B
the same size (they all store an address)
Correct answer
C
the size of the data they point to
D
no size
C167Pointers • Identity
OtherHard

Q20.The expression *&a is equal to:

A
the address of a
B
a
Correct answer
C
0
D
NULL