ExamVeda
Login
Home
21
Which keyword is used to declare a union in C++?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
22
What is the correct syntax to define a union in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
23
What is the output of the following code: struct Book { char title[50]; int pages; }; Book b; cout << sizeof(b); in C++?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
24
What is the output of the following code: union Number { int x; float y; }; Number n; n.x = 10; cout << n.y; in C++?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
25
What is a dangling pointer in C++?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
26
The declaration of the structure is also called as?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
27
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
struct sec 
{
    int a;
    char b;
};
int main()
{
    struct sec s ={25,50};
    struct sec *ps =(struct sec *)&s;
    cout << ps->a << ps->b;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
28
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
struct Time 
{
    int hours;
    int minutes;
    int seconds;
};
int toSeconds(Time now);
int main()
{
    Time t;
    t.hours = 5;
    t.minutes = 30;
    t.seconds = 45;
    cout << "Total seconds: " << toSeconds(t) << endl;
    return 0;
}
int toSeconds(Time now)
{
    return 3600 * now.hours + 60 * now.minutes + now.seconds;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
29
What will be the output of the following C++ code?
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
    struct student 
    {
        int num;
        char name[25];
    };
    student stu;
    stu.num = 123;
    strcpy(stu.name, "John");
    cout << stu.num << endl;
    cout << stu.name << endl;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
30
What will be used when terminating a structure?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board