adplus-dvertising

Welcome to the Pointers and Arrays in C MCQs Page

Dive deep into the fascinating world of Pointers and Arrays in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Pointers and Arrays in C, a crucial aspect of C Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Pointers and Arrays in C, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Pointers and Arrays in C. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Pointers and Arrays in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Pointers and Arrays in C MCQs | Page 23 of 53

Q221.
What will be the output of the following program code?
#include
void main()
{
      int i = 10;
      void *p = &i;
      printf("%f\\n", *(float *)p);
}
Discuss
Answer: (c).0.000000
Discuss
Answer: (c).The pointers point to elements of the same array
Discuss
Answer: (b).p is a pointer to a 5 elements integer array
Discuss
Answer: (a).We cannot change the value pointed by ptr
Q225.
What is the output of the following code ?
#include<stdio.h>
void main()
{
      int *ptr, a=10;
      ptr = &a;
      *ptr += 1;
      printf("%d, %d", *ptr, a);
}
Discuss
Answer: (d).11, 11
Q226.
A function 'p' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as
Discuss
Answer: (a).int(*p(char *))[]
Q227.
What will be printed after compiling and running the following code?
main() 
{ 
    char *p; 
    printf("%d %d",sizeof(*p), sizeof(p));
}
Discuss
Answer: (b).1 2
Q228.
What will be the output of the following program code?
#include <stdio.h>
void main()
{
    int i=3, *j, **k;
    j = &i;
    k = &j;
    printf("%d%d%d", *j, **k, *(*k));
}
Discuss
Answer: (c).333
Q229.
Which of the following is the correct way of declaring a float pointer:
Discuss
Answer: (b).float *ptr;
Q230.
Find the output of the following program.
void main()
{
   char *msg = "hi";
   printf(msg);
}
Discuss
Answer: (a).hi

Suggested Topics

Are you eager to expand your knowledge beyond C Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!