Pointer MCQs

253 questionsC-ProgramPage 20 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 172easy
What will be the output of the following C code?
#include <stdio.h>
void first()
{
    printf("Hello World");
}
void main()
{
    void *ptr() = first;
    ptr++
    ptr();
}
Question 173easy
An array of strings can be initialized by . . . . . . . .
Question 174easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char a[1][5] = {"hello"};
    printf("%s", a[0]);
    return 0;
}
Advertisement
Question 175easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char *s = "hello";
    char *p = s;
    printf("%p\t%p", p, s);
}
Question 176easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *str = "hello world";
    char strary[] = "hello world";
    printf("%d %d\n", strlen(str), strlen(strary));
    return 0;
}
Question 177easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    char *str = "hello, world!!\n";
    char strc[] = "good morning\n";
    strcpy(strc, str);
    printf("%s\n", strc);
    return 0;
}
Advertisement
Question 178easy
A program that has no command line arguments will have argc . . . . . . . .
Question 179easy
What is argv[0] in command line arguments?
Question 180easy
What will be the output of the following C code?
#include <stdio.h>
int main()
{
    void *p;
    int a[4] = {1, 2, 3, 4};
    p = &a[3];
    int *ptr = &a[2];
    int n = (int*)p - ptr;
    printf("%d\n", n);
}