Pointer MCQs

253 questionsC-ProgramPage 26 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 226easy
Which of the following arithmetic operation can be applied to pointers a and b?(Assuming initialization as int *a = (int *)2; int *b = (int *)3;)
Question 227easy
What will be the output of the following C code?
#include <stdio.h>
void main()
{
    char a[10][5] = {"hi", "hello", "fellows"};
    printf("%d", sizeof(a[1]));
}
Question 228easy
Comment on the following two operations.
int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}};//- 2
Advertisement
Question 229easy
Which function is not called in the following C program?
#include <stdio.h>
void first()
{
    printf("first");
}
void second()
{
    first();
}
void third()
{
    second();
}
void main()
{
    void (*ptr)();
    ptr = third;
    ptr();
}
Question 230easy
Which of the following syntax is correct for command-line arguments?
Question 231easy
What is the correct way to declare and assign a function pointer?
(Assuming the function to be assigned is "int multi(int, int);")
Advertisement
Question 232easy
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    int no = 5;
    char name[20];
};
void main()
{
    struct student s;
    s.no = 8;
    printf("hello");
}
Question 233easy
What type of array is generally generated in Command-line argument?
Question 234easy
What will be the output of the following C code?
#include <stdio.h>
void f(int (*x)(int));
int myfoo(int i);
int (*foo)(int) = myfoo;
int main()
{
    f(foo(10));
}
void f(int (*i)(int))
{
    i(11);
}
int myfoo(int i)
{
    printf("%d\n", i);
    return i;
}