Quiz for C (Pointers Concepts)
Q.1. What does a pointer store?
Q.2. When declaring a pointer, what is the * operator known as?
Q.3. The * operator is a _____ operator
Q.4. The * operator is also used to get
Q.5. The & operator gives
Q.6. Correct declaration of a pointer variable is:
Q.7. The data type of the pointer should be same as the data type of the variable it is pointing to.
Q.8. Placeholder for pointers in C is
Q.9. Output of the following piece of code is
int main()
{
int a=10;
int *ptr=&a;
printf("%p\n",ptr);
printf("%d",*ptr);
return 0;
}
Q.10. What happens when the following statements are executed?
int a[5]={10,20,30,40,50};
int *ptr=a;
ptr++;
Q.11. What will be the output of the following code?
#include <stdio.h>
void main()
{
char *s= "Hello World";
char *p = s;
printf("%c %c", *++p, *p++);
}
Q.12. An array name acts like a pointer constant that points to the first element of the array.
Q.13. If
int n[3][2]={{10,20,30},{40,50}};
then, *(n+1)+1 points to?
Q.14. In call by reference, ____ of the variable is passed
Q.15. What will be the output of the following block of code?
void swap(int *p, int *q)
{
int temp = *p;
*p = *q;
*q = temp;
}
void main()
{
int a = 10, b = 20;
swap(&a, &b);
printf("%d %d\n", a, b);
}
Instructions:-
- This Quiz is based on the Pointers concepts of C
- Each correct answer will carry 2 points
- Once an option is selected you cannot select any other, So choose wisely
- Do not refresh the page as it will reset the quiz
- Once the time is up the quiz will automatically get submitted with no of Question responded
- Your total score alongwith your name will be shown after submission of the Quiz
- Wish you ALL THE BEST 👍👍
START
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP