Pointer MCQs

253 questionsC-ProgramPage 21 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 181easy
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", 1[p], s[1]);
}
Question 182easy
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    int no;
    char name[20];
}
void main()
{
    struct student s;
    s.no = 8;
    printf("hello");
}
Question 183easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    int a[2][3] = {1, 2, 3, 4, 5};
    int i = 0, j = 0;
    for (i = 0; i < 2; i++)
    for (j = 0; j < 3; j++)
    printf("%d", a[i][j]);
}
Advertisement
Question 184easy
What is the advantage of a multidimensional array over pointer array?
Question 185easy
What will be the output of the following C statement? (assuming the input is "cool brother in city")
printf(“%s\n”, argv[argc]);
Question 186easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char a[2][6] = {"hello", "hi"};
    printf("%s", *a + 1);
    return 0;
}
Advertisement
Question 187easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *str = "hello world";
    char strc[] = "good morning india\n";
    strcpy(strc, str);
    printf("%s\n", strc);
    return 0;
}
Question 188easy
What will be the output of the following C code?
#include <stdio.h>
void m(int p)
{
    printf("%d\n", p);
}
void main()
{
    int a = 6, b = 5;
    m(a, b);
    printf("%d %d\n", a, b);
}
Question 189easy
What will be the output of the following C code on a 32-bit system?
#include <stdio.h>
void main()
{
    char *a[10] = {"hi", "hello", "how"};
    printf("%d\n", sizeof(a));
}