1) Which operator is used to get the "content of a
variable pointed to by a pointer"?
1.Dot Operator (.)
2.Address of Operator (&)
3.Indirection or De-reference Operator (*)
4.Arrow Operator (→)
Answer & Explanation:
Correct answer: 3
Indirection or De-reference Operator (*)
2) What will be the type of a pointer, which is pointing to
an integer variable?
1.int *
2.long int *
3.char *
4.unsigned *
Answer & Explanation:
Correct answer: 1
int *
3) If ptr is a pointer to one dimensional array, which
statement will return the value of 3rd element?
1.(ptr+3)
2.*(ptr+3)
3.(&ptr+3)
4.*ptr+3
Answer & Explanation:
Correct answer: 2
*(ptr+3)
int* ptr1,ptr2;
What is the type of ptr2 here?
1.int * (Integer pointer)
2.void
3.void * (void pointer)
4.int (integer)
Answer & Explanation:
Correct answer: 2
int (integer)
int ptr2;
Thus, ptr is not int*, it is int type variable.
5) What will be the correct way to declare two integer
pointers using single line declaration?
1.int *ptr1,*ptr2;
2.int* ptr1,ptr2;
3.int * ptr1, ptr2;
4.All of the above
Answer & Explanation:
Correct answer: 1
int *ptr1,*ptr2;
6) Consider the following statement:
int arr[5],*ptr;
How to initialize ptr with the address of array arr?
1.ptr = arr;
2.ptr = &arr[0];
3.ptr = &arr;
4.Both 1) and 2)
Answer & Explanation:
Correct answer: 4
Both 1 and 2
Hi C Programming Team,
ReplyDeleteMy name is Anuj Agarwal. I'm Founder of Feedspot.
I would like to personally congratulate you as your blog C Programming has been selected by our panelist as one of the Top 25 C Programming Blogs on the web.
https://blog.feedspot.com/c_programming_blogs/
I personally give you a high-five and want to thank you for your contribution to this world. This is the most comprehensive list of Top 25 C Programming Blogs on the internet and I’m honored to have you as part of this!
Also, you have the honor of displaying the badge on your blog.
Best,
Anuj
Nice post.
ReplyDeleteFor more information on C programming, visit https://verkkonet.com/blog/c-program-without-main-function/?unapproved=588&moderation-hash=cfd8131d3ee034ffb2fa4383673e1454#comment-588
Helpful article.....
ReplyDeletelearn C programming with lot of examples.....
Basic C programming examples
C pattern programming examples
C Arrays examples
Loops in C examples
if-else in C with examples
Strings in C with examples
and many more.....
React.js offers a faster development environment, and its very easy to use. Learn them without taking care of too many setups, when you are developing apps by serving HTML files.
ReplyDeleteLearn How to Use Reactjs Cdn