ExamVeda
Login
Home
51
What will be the output of the following C code?
#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);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
52
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    char a[];
};
void main()
{
    struct student s;
    printf("%d", sizeof(struct student));
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
53
Which function is responsible for searching in the table? (For #define IN 1, the name IN and replacement text 1 are stored in a "table")
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
54
Which is the correct syntax to use typedef for struct?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following C code?
#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;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
What will be the output of the following C code?
#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);
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
57
What will be the output of the following C code?
#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;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
58
What will be the output of the following C code?
#include <stdio.h>
struct student
{
    char a[5];
};
void main()
{
    struct student s[] = {"hi", "hey"};
    printf("%c", s[0].a[1]);
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
59
What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8)
#include <stdio.h>
union utemp
{
    int a;
    double b;
    char c;
}u;
int main()
{
    u.c = 'A';
    u.a = 1;
    printf("%d", sizeof(u));
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
60
What will be the output of the following C code?
#include <stdio.h>
union
{
    int x;
    char y;
}p;
int main()
{
    p.x = 10;
    printf("%d\n", sizeof(p));
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board