ExamTray App is now Available on Google Play EXAMTRAY android app link

 

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

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

Instructions

Total Questions: 10

Total Minutes: 10

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

1) What is the output of c program with structures.?
int main()
{
    struct car
    {int color;};
    struct garage
    {
        struct car mycar[10];
    }gar;
    struct car c1={5};
    gar.mycar[0]=c1;
    printf("%d",gar.mycar[0]);
    return 0;
}
2) What is the size of the below C structure in TurboC?
int main()
{
    struct books{
        int pages;
        char str[4];
    }b;
    printf("%d",sizeof(b));
    return 0;
}
3) What is the output of C program with Structure pointer in TurboC.?
int main()
{
    struct books{
        int pages;
        char str[4];
    }*ptr;
    printf("%d",sizeof(ptr));
    return 0;
}
4) In a nested structure definition, with country.state.district statement, memeber state is actually present in the structure.? (COUNTY, STATE, DISTRICT structures)
5) What is actually passed if you pass a structure variable to a function.?
6) What is the output of C program with structures.?
void show(int,int);
int main()
{
    struct paint{
        int type;
        int color;
    }p;
    p.type=1;
    p.color=5;
    show(p.type,p.color);
    return 0;
}
void show(int a,int b)
{
    printf("%d %d",a,b);
}
7) What is the output of C program with structures.?
int main()
{
    struct paint{
        int type;
        int color;
    }p1, p2;
    p1.type=1;
    p1.color=5;
    if(sizeof(p1)==sizeof(p2))
    {
        printf("SAME");
    }
    else
    {
        printf("DIFFERENT");
    }
    return 0;
}
8) Choose a correct statement about C structures.
9) Choose a correct statement about structure and array.?
10) What are the types of data allowed inside a structure.?