Govt. Exams
Entrance Exams
Advertisement
Topics in C Programming
What is the size of a pointer variable on a 32-bit system?
Correct Answer:
B. 4 bytes
EXPLANATION
On a 32-bit system, all pointers are 4 bytes (32 bits) regardless of the data type they point to.
A pointer variable stores the _____ of another variable.
Correct Answer:
B. memory address
EXPLANATION
Pointers store memory addresses of variables. The address-of operator (&) retrieves this address.
Identify the output:
char *str = "Hello";
printf("%c", *str);
char *str = "Hello";
printf("%c", *str);
Correct Answer:
A. H
EXPLANATION
*str dereferences the pointer to get the first character of the string, which is 'H'.
Which of the following is NOT a valid pointer declaration?
Correct Answer:
D. int &s;
EXPLANATION
& is a reference operator used in C++, not in C. In C, pointers are declared using *.
What is a NULL pointer?
Correct Answer:
A. Pointer pointing to address 0
EXPLANATION
A NULL pointer is a pointer that points to memory address 0, indicating it doesn't point to any valid memory location.
What will be the size of a pointer variable on a 64-bit system?
Correct Answer:
C. 8 bytes
EXPLANATION
On a 64-bit system, a pointer is 8 bytes (64 bits) regardless of the data type it points to.
Which operator is used to get the address of a variable in C?
Correct Answer:
B. &
EXPLANATION
The & operator (address-of operator) returns the memory address of a variable.