Pointer MCQs

253 questionsC-ProgramPage 7 of 29

Practice free Pointer multiple-choice questions with instant answer feedback and step-by-step solutions. Click an option to check yourself, reveal the full explanation, and work through all 253 questions — no login required.

Question 55easy
What would be the output for the following Turbo C code?
#include<stdio.h>
void main()
{
   int a[]={ 1, 2, 3, 4, 5 }, *p;
   p=a;
   ++*p;
   printf("%d ", *p);
   p += 2;
   printf("%d", *p);
}
Question 56easy
char* myfunc(char *ptr)
{
   ptr+=3;
   return(ptr);
}

void main()
{
   char *x, *y;
   x = "EXAMVEDA";
   y = myfunc(x);
   printf("y=%s", y);
}

What will be printed when the sample code above is executed?
Question 57easy
char *ptr;
char myString[] = "abcdefg";
ptr = myString;
ptr += 5;

what string does ptr point to in the sample code above?
Advertisement
Question 58easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    int i = 10;
    int *p = &i
    foo(&p);
    printf("%d ", *p);
    printf("%d ", *p);
}
void foo(int **const p)
{
    int j = 11;
    *p = &j
    printf("%d ", **p);
}
Question 59easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *s= "hello";
    char *p = s;
    printf("%c\t%c", *(p + 3),  s[1]);
}
Question 60easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int a[3] = {1, 2, 3};
    int *p = a;
    int **r = &p
    printf("%p %p", *r, a);
}
Advertisement
Question 61easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *s = "hello";
    char *p = s * 3;
    printf("%c\t%c", *p, s[1]);
}
Question 62easy
Which of the following operation is possible using a pointer char? (Assuming the declaration is char *a;)
Question 63easy
Comment on the following C statement.
int (*a)[7];