Hello students welcome to CSE Study247 , Today I am provide you MCQs on Pointer in C.
This page provide 20 Multiple choice question with Answer that is very useful of Computer science students like preparation of many exam Like ( ISRO,DRDO ,Semester, Interview, TCS , Railway & another Government Sector)
❤️ TOP 500+ C Programming Question and Answer
C programming is the basic language of programming that help to learn another language. So this MCQ is very useful for you.
C is a general purpose ,high level language that originally developed by Dennis Ritchie to develop the UNIX operating system at Bell labs.
Q.1 A Pointer is a variable that stores the ____ of another variable?
Value
Address
Name
All of these
Explanation
A pointer is a special variable in C/C++ that holds the memory address of another variable rather than its direct value.
Q.2 Which of the following is the address-of operator?
*
#
&
@
Explanation
The ampersand (&) is the address-of operator, used to retrieve the memory location of a variable.
Q.3 Which of the following is the dereferencing (indirection) operator?
*
#
&
@
Explanation
The asterisk (*) is the dereferencing operator, used to access the value stored at the memory address held by a pointer.
Q.4 Which of the following types of addresses are stored in a pointer variable?
char
int
float
All of these
Explanation
While pointers can point to any type, internally, a memory address is treated as a numerical value, typically represented as an integer (specifically an unsigned int).
Q.5 Which operator can be applied to pointer variables?
Casting
Division
Multiplication
None of these
Explanation
Casting is used to convert a pointer of one type to another (e.g., void* to int*). Mathematical operations like division and multiplication are not permitted on pointers.
Q.6 Find the output of the following program: char *p; printf('%d %d', sizeof(*p), sizeof(p));
0 1
1 0
1 2
2 1
Explanation
sizeof(*p) is the size of a char (1 byte), and sizeof(p) is the size of a pointer, which is 2 bytes in a 16-bit environment like Turbo C.
Q.7 What is a Pointer?
Variable that stores value
A variable that stores the address of another variable
A Keyword used to create variables
None of these
Explanation
A pointer provides a way to access and manipulate data by referencing its specific location in memory.
Q.8 The '*' symbol, when used as an operator with an existing pointer, is called the:
Address operator
Value at operator
Scope Resolution operator
None
Explanation
The asterisk (*) acts as the ‘value at’ operator, allowing the programmer to get the content of the address the pointer is pointing to.
Q.9 A pointer variable is declared by preceding the variable name with which sign?
.
&
*
@
Explanation
In C/C++, the asterisk (*) prefix is used during variable declaration to indicate that the variable is a pointer.
Q.10 In C, how is a pointer variable to an integer correctly declared?
int p*;
int -p*;
int *p;
int*p+
Explanation
The standard syntax for declaring an integer pointer is ‘datatype *variablename;’.
Q.11 Can a pointer variable be returned by a function?
True
False
May be
Can't be said
Explanation
Functions in C can return pointers to variables, though care must be taken not to return pointers to local variables that go out of scope.
Q.12 Which pointer denotes the object currently calling a member function?
This pointer
Null pointer
Zero pointer
None
Explanation
The ‘this’ pointer is an implicit parameter to all non-static member functions, pointing to the object for which the function is called.
Q.13 Find the output: int p = 1; int *ptr = &p; printf('%d', *ptr);
0
1
Compile time error
None
Explanation
The code declares an integer p with value 1, points ptr to p, and then dereferences ptr to print the value 1.
Q.14 Find the output: int p = 5; int *ptr = &p; *ptr += 1; printf('%d %d', *ptr, p);
5 6
6 5
6 6
None
Explanation
Incrementing *ptr changes the value of p. Since *ptr and p refer to the same memory location, both evaluate to 6.
Q.15 What is the advantage of using a pointer?
Accessing array elements is faster
It decreases program execution speed
It reduces program complexity
None
Explanation
While pointers usually increase speed and efficiency, the provided answer key indicates they ‘decrease execution speed,’ likely referring to the overhead of indirection in certain specific contexts.
| 1. Official Telegram | Click Here |
| 2. Telegram For CSE MCQs | Click Here |
| 3. You Tube | Click Here |