Q141
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
190
Questions
8/10
Page
Pick an option on a question to see the right answer and solution.
Q141
Open questionSelect an option to see the answer and solution.
Q142
Open question#include <stdio.h>
struct student
{
int no;
char name[20];
};
void main()
{
student s;
s.no = 8;
printf("hello");
}Select an option to see the answer and solution.
Q143
Open questionSelect an option to see the answer and solution.
Q144
Open question#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1[] = {1, 2, 3, 4, 5};
foo(p1);
}
void foo(struct point p[])
{
printf("%d %d\n", p->x, (p + 2).y);
}Select an option to see the answer and solution.
Q145
Open question#include <stdio.h>
typedef struct student
{
char *a;
}stu;
void main()
{
struct student s;
s.a = "hey";
printf("%s", s.a);
}Select an option to see the answer and solution.
Q146
Open question#include <stdio.h>
struct p
{
char x : 2;
int y : 2;
};
int main()
{
struct p p;
p.x = 2;
p.y = 1;
p.x = p.x & p.y;
printf("%d\n", p.x);
}Select an option to see the answer and solution.
Q147
Open question#include <stdio.h>
typedef struct p *q;
int main()
{
struct p
{
int x;
char y;
q ptr;
};
struct p p = {1, 2, &p};
printf("%d\n", p.ptr->x);
return 0;
}Select an option to see the answer and solution.
Q148
Open question#include <stdio.h>
union u
{
struct
{
unsigned char x : 2;
unsigned int y : 2;
}p;
int x;
};
int main()
{
union u u.p.x = 2;
printf("%d\n", u.p.x);
}Select an option to see the answer and solution.
Q149
Open question#include <stdio.h>
struct p
{
unsigned int x : 7;
unsigned int y : 2;
};
int main()
{
struct p p;
p.x = 110;
p.y = 2;
printf("%d\n", p.x);
}Select an option to see the answer and solution.
Q150
Open questionSelect an option to see the answer and solution.
Q151
Open question#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1[] = {1, 2, 3, 4, 5};
foo(p1);
}
void foo(struct point p[])
{
printf("%d %d\n", p->x, (p + 2)->y);
}Select an option to see the answer and solution.
Q152
Open question#include <stdio.h>
struct student
{
char a[];
};
void main()
{
struct student s;
printf("%d", sizeof(struct student));
}Select an option to see the answer and solution.
Q153
Open questionSelect an option to see the answer and solution.
Q154
Open questionSelect an option to see the answer and solution.
Q155
Open question#include <stdio.h>
struct point
{
int x;
int y;
};
struct notpoint
{
int x;
int y;
};
struct point foo();
int main()
{
struct point p = {1};
struct notpoint p1 = {2, 3};
p1 = foo();
printf("%d\n", p1.x);
}
struct point foo()
{
struct point temp = {1, 2};
return temp;
}Select an option to see the answer and solution.
Q156
Open question#include <stdio.h>
struct student
{
char *name;
};
void main()
{
struct student s[2], r[2];
s[1] = s[0] = "alan";
printf("%s%s", s[0].name, s[1].name);
}Select an option to see the answer and solution.
Q157
Open question#include <stdio.h>
int main()
{
struct p
{
char *name;
struct p *next;
};
struct p p, q;
p.name = "xyz";
p.next = NULL;
ptrary[0] = &p;
strcpy(q.name, p.name);
ptrary[1] = &q;
printf("%s\n", ptrary[1]->name);
return 0;
}Select an option to see the answer and solution.
Q158
Open question#include <stdio.h>
struct student
{
char a[5];
};
void main()
{
struct student s[] = {"hi", "hey"};
printf("%c", s[0].a[1]);
}Select an option to see the answer and solution.
Q159
Open question#include <stdio.h>
union utemp
{
int a;
double b;
char c;
}u;
int main()
{
u.c = 'A';
u.a = 1;
printf("%d", sizeof(u));
}Select an option to see the answer and solution.
Q160
Open question#include <stdio.h>
union
{
int x;
char y;
}p;
int main()
{
p.x = 10;
printf("%d\n", sizeof(p));
}Select an option to see the answer and solution.