C Structure & Union Questions 2

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

Question 1

Time: 00:00:00
The following declaration won't show any compilation error and 2 struct of type Name will be generated.
typedef struct Name
{
int age;
int sex;
} Name;

Name n1;
struct Name n2;

True

True

False

False

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What is the expected output of the following C program ?
#include<stdio.h>
int main()
{
struct {int n[2];} array[] = {{11,13},{23,25}};

printf("%d %d %d %d",array[0].n[0],array[0].n[1],array[1].n[0],array[1].n[1]);

return 0;
}

11 0 23 0

11 0 23 0

11 13 23 25

11 13 23 25

Compilation error because the declaration of struct as well as array has been in done incorrectly, struct followed by tag name then array should be defined in that same name.

Compilation error because the declaration of struct as well as array has been in done incorrectly, struct followed by tag name then array should be defined in that same name.

Compilation error due to initialization of array, declaration of struct is correct.

Compilation error due to initialization of array, declaration of struct is correct.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]
Hey ! Follow us on G+