Q161
Open question(Assume: struct temp{int a;}s;)Select 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
9/10
Page
Pick an option on a question to see the right answer and solution.
Q161
Open question(Assume: struct temp{int a;}s;)Select an option to see the answer and solution.
Q162
Open question#include <stdio.h>
struct student
{
};
void main()
{
struct student s[2];
printf("%d", sizeof(s));
}Select an option to see the answer and solution.
Q163
Open question#include <stdio.h>
struct point
{
int x;
int y;
} p[] = {1, 2, 3, 4, 5};
void foo(struct point*);
int main()
{
foo(p);
}
void foo(struct point p[])
{
printf("%d %d\n", p->x, p[2].y);
}Select an option to see the answer and solution.
Q164
Open questionSelect an option to see the answer and solution.
Q165
Open questionstruct temp
{
int a : 1;
int b : 2;
int c : 4;
int d : 4;
}s;Select an option to see the answer and solution.
Q166
Open question#include <stdio.h>
typedef struct student
{
char *a;
}stu;
void main()
{
struct stu s;
s.a = "hi";
printf("%s", s.a);
}Select an option to see the answer and solution.
Q167
Open question#include <stdio.h>
void main()
{
struct student
{
int no;
char name[20];
};
struct student s;
s.no = 8;
printf("%d", s.no);
}Select an option to see the answer and solution.
Q168
Open questionSelect an option to see the answer and solution.
Q169
Open question#include <stdio.h>
union u
{
struct p
{
unsigned char x : 2;
unsigned int y : 2;
};
int x;
};
int main()
{
union u u;
u.p.x = 2;
printf("%d\n", u.p.x);
}Select an option to see the answer and solution.
Q170
Open questiontypedef char *string;Select an option to see the answer and solution.
Q171
Open question#include <stdio.h>
struct p
{
int x;
char y;
};
int main()
{
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / 3);
if (x == sizeof(int) + sizeof(char))
printf("%d\n", ptr1->x);
else
printf("falsen");
}Select an option to see the answer and solution.
Q172
Open questionstruct node
{
struct node *next;
};Select an option to see the answer and solution.
Q173
Open questionstruct-declarator:
declarator
type-specifier declarator opt : constant-expressionSelect an option to see the answer and solution.
Q174
Open question#include <stdio.h>
struct p
{
int x;
int y;
};
int main()
{
struct p p1[] = {1, 2, 3, 4, 5, 6};
struct p *ptr1 = p1;
printf("%d %d\n", ptr1->x, (ptr1 + 2)->x);
}Select an option to see the answer and solution.
Q175
Open question#include <stdio.h>
union uTemp
{
double a;
int b[10];
char c;
}u;Select an option to see the answer and solution.
Q176
Open question#include <stdio.h>
union p
{
int x;
float y;
};
int main()
{
union p p, b;
p.x = 10;
printf("%f\n", p.y);
}Select an option to see the answer and solution.
Q177
Open question#include <stdio.h>
struct student fun(void)
{
struct student
{
char *name;
};
struct student s;
s.name = "alan";
return s;
}
void main()
{
struct student m = fun();
printf("%s", m.name);
}Select an option to see the answer and solution.
Q178
Open questionSelect an option to see the answer and solution.
Q179
Open question#include <stdio.h>
typedef struct p *q;
struct p
{
int x;
char y;
q ptr;
};
int main()
{
struct p p = {1, 2, &p};
printf("%d\n", p.ptr->ptr->x);
return 0;
}Select an option to see the answer and solution.
Q180
Open question#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97};
printf("%f\n", x.f);
}Select an option to see the answer and solution.