TOTAL QS = 20Time [ 00 : 00 : 00 ]
00:00:00

C Programming Basics Tutorial - Structures and Pointers - Online Test 1

Instructions

Total Questions: 20

Total Minutes: 20

This ExamTray Free Online Exam or MCQ Quiz tests your C Programming Skills on C Structures and Pointers. Examples are given as questions and answers. Easily Attend Competitive Exams and Job Interview Questions.

Go through C Theory Notes on Structures and Pointers before attempting this test.

All the Best

Challenge SCORE

0 / 20

Take This Exam
1) What is a structure in C language.?
2) What is the size of a C structure.?
3) What is the output of C program with structures.?
int main()
{
    structure hotel
    {
        int items;
        char name[10];
    }a;
    strcpy(a.name, "TAJ");
    a.items=10;
    printf("%s", a.name);
    return 0;
}
4) What is the output of C program.?
int main()
{
    struct book
    {
        int pages;
        char name[10];
    }a;
    a.pages=10;
    strcpy(a.name,"Cbasics");
    printf("%s=%d", a.name,a.pages);
    return 0;
}
5) Choose a correct statement about C structures.
6) Choose a correct statement about C structure.?
int main()
{
    struct ship
    {

    };
    return 0;
}
7) What is the output of C program.?
int main()
{
    struct ship
    {
        int size;
        char color[10];
    }boat1, boat2;
    boat1.size=10;
    boat2 = boat1;
    printf("boat2=%d",boat2.size);
    return 0;
}
8) What is the output of C program with structures.?
int main()
{
    struct ship
    {
        char color[10];
    }boat1, boat2;
    strcpy(boat1.color,"RED");
    printf("%s ",boat1.color);
    boat2 = boat1;
    strcpy(boat2.color,"YELLOW");
    printf("%s",boat1.color);
    return 0;
}
9) What is the output of C program with structures.?
int main()
{
    struct tree
    {
        int h;
    }
    struct tree tree1;
    tree1.h=10;
    printf("Height=%d",tree1.h);
    return 0;
}
10) Choose a correct statement about C structure elements.?
11) A C Structure or User defined data type is also called.?
12) What are the uses of C Structures.?
13) What is the output of C program with structures.?
int main()
{
    struct tree
    {
        int h;
        int w;
    };
    struct tree tree1={10};
    printf("%d ",tree1.w);
    printf("%d",tree1.h);
    return 0;
}
14) What is the output of C program with structures.?
int main()
{
    struct tree
    {
        int h;
        int rate;
    };
    struct tree tree1={0};
    printf("%d ",tree1.rate);
    printf("%d",tree1.h);
    return 0;
}
15) What is the output of C program.?
int main()
{
    struct laptop
    {
        int cost;
        char brand[10];
    };
    struct laptop L1={5000,"ACER"};
    struct laptop L2={6000,"IBM"};
    printf("Name=%s",L1.brand);
    return 0;
}
16) What is the output of C program with structures pointers.?
int main()
{
    struct forest
    {
        int trees;
        int animals;
    }F1,*F2;
    F1.trees=1000;
    F1.animals=20;
    F2=&F1;
    printf("%d ",F2.animals);
    return 0;
}
17) What
int main()
{
    struct bus
    {
        int seats;
    }F1, *F2;
    F1.seats=20;
    F2=&F1;
    F2->seats=15;
    printf("%d ",F1.seats);
    return 0;
}
18) What is the output of C program with structure arrays.?
int main()
{
    struct pens
    {
        int color;
    }p1[2];
    struct pens p2[3];
    p1[0].color=5;
    p1[1].color=9;
    printf("%d ",p1[0].color);
    printf("%d",p1[1].color);
    return 0;
}
19) What is the output of C program with structure array pointers.?
int main()
{
    struct car
    {
        int km;
    }*p1[2];
    struct car c1={1234};
    p1[0]=&c1;
    printf("%d ",p1[0]->km);
    return 0;
}
20) Choose a correct statement about C structures.
Certification Group ID
3864

Open Certification Helper Popup Reset Popup