Q121
Open question#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .k = 1, 3};
printf("%f \n", x.f);
}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
7/10
Page
Pick an option on a question to see the right answer and solution.
Q121
Open question#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .k = 1, 3};
printf("%f \n", x.f);
}Select an option to see the answer and solution.
Q122
Open question#include <stdio.h>
struct student
{
int no = 5;
char name[20];
};
void main()
{
struct student s;
s.no = 8;
printf("hello");
}Select an option to see the answer and solution.
Q123
Open question#include <stdio.h>
struct student
{
char *name;
};
struct student s;
struct student fun(void)
{
s.name = "newton";
printf("%s\n", s.name);
s.name = "alan";
return s;
}
void main()
{
struct student m = fun();
printf("%s\n", m.name);
m.name = "turing";
printf("%s\n", s.name);
}Select an option to see the answer and solution.
Q124
Open question#include <stdio.h>
typedef int integer;
int main()
{
int i = 10, *ptr;
float f = 20;
integer j = i;
ptr = &j;
printf("%d\n", *ptr);
return 0;
}Select an option to see the answer and solution.
Q125
Open questionSelect an option to see the answer and solution.
Q126
Open question#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1[] = {1, 2, 3, 4};
foo(p1);
}
void foo(struct point p[])
{
printf("%d\n", p[1].x);
}Select an option to see the answer and solution.
Q127
Open question#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
(*s).c = "hello";
printf("%s", m.c);
}Select an option to see the answer and solution.
Q128
Open question#include <stdio.h>
union temp
{
int a;
float b;
char c;
};
union temp s = {1,2.5,’A’}; //REF LINESelect an option to see the answer and solution.
Q129
Open questionSelect an option to see the answer and solution.
Q130
Open question#include <stdio.h>
struct
{
int k;
char c;
} p;
int p = 10;
int main()
{
p.k = 10;
printf("%d %d\n", p.k, p);
}Select an option to see the answer and solution.
Q131
Open question#include <stdio.h>
struct point
{
int x;
int y;
};
void foo(struct point*);
int main()
{
struct point p1[] = {1, 2, 3, 4};
foo(p1);
}
void foo(struct point p[])
{
printf("%d %d\n", p->x, ++p->x);
}Select an option to see the answer and solution.
Q132
Open question#include <stdio.h>
struct p
{
unsigned int x : 2;
unsigned int y : 2;
};
int main()
{
struct p p;
p.x = 3;
p.y = 1;
printf("%d\n", sizeof(p));
}Select an option to see the answer and solution.
Q133
Open question#include <stdio.h>
union u_tag
{
int ival;
float fval;
char *sval;
} u;Select an option to see the answer and solution.
Q134
Open question#include <stdio.h>
typedef struct p
{
int x, y;
};
int main()
{
p k1 = {1, 2};
printf("%d\n", k1.x);
}Select an option to see the answer and solution.
Q135
Open question#include <stdio.h>
struct p
{
int k;
char c;
float f;
};
int main()
{
struct p x = {.c = 97, .f = 3, .k = 1};
printf("%f\n", x.f);
}Select an option to see the answer and solution.
Q136
Open question#include <stdio.h>
struct p
{
unsigned int x : 2;
unsigned int y : 2;
};
int main()
{
struct p p;
p.x = 3;
p.y = 4;
printf("%d\n", p.y);
}Select an option to see the answer and solution.
Q137
Open question#include <stdio.h>
void main()
{
int lookup[100] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
printf("%d", lookup[3]);
}Select an option to see the answer and solution.
Q138
Open question#include <stdio.h>
typedef struct p
{
int x, y;
}k = {1, 2};
int main()
{
p k1 = k;
printf("%d\n", k1.x);
}Select an option to see the answer and solution.
Q139
Open question#include <stdio.h>
int main()
{
struct p
{
char *name;
struct p *next;
};
struct p *ptrary[10];
struct p p, q;
p.name = "xyz";
p.next = NULL;
ptrary[0] = &p;
q.name = (char*)malloc(sizeof(char)*3);
strcpy(q.name, p.name);
q.next = &q;
ptrary[1] = &q;
printf("%s\n", ptrary[1]->next->next->name);
}Select an option to see the answer and solution.
Q140
Open questionSelect an option to see the answer and solution.